mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 01:18:52 +08:00
change power supply limit from watts to amps
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ Please add a note of your changes below this heading if you make a Pull Request.
|
||||
* Gain scheduling for anti-hunt when close to 0 position error
|
||||
* Velocity Limiting in Current Control mode according to `vel_limit` and `vel_gain`
|
||||
* Regen current limiting according to `max_regen_limit`, in Amps
|
||||
* DC Bus Power limiting according to `power_supply_wattage`
|
||||
* DC Bus hard current limiting according to `power_supply_min_current` and `power_supply_max_current`
|
||||
* Unit Testing with Doctest has been started for select algorithms, see [Firmware/Tests/test_runner.cpp](Firmware/Tests/test_runner.cpp)
|
||||
* Added support for Flylint VSCode Extension for static code analysis
|
||||
* Using an STM32F405 .svd file allows CortexDebug to view registers during debugging
|
||||
|
||||
@@ -174,10 +174,11 @@ bool Axis::do_checks() {
|
||||
}
|
||||
}
|
||||
|
||||
if(board_config.power_supply_wattage > 0.0f &&
|
||||
(Ibus_sum * vbus_voltage) > board_config.power_supply_wattage)
|
||||
{
|
||||
error_ |= ERROR_DC_BUS_OVER_POWER;
|
||||
if (Ibus_sum > board_config.power_supply_max_current) {
|
||||
error_ |= ERROR_DC_BUS_OVER_CURRENT;
|
||||
}
|
||||
if (Ibus_sum < board_config.power_supply_min_current) {
|
||||
error_ |= ERROR_DC_BUS_UNDER_CURRENT;
|
||||
}
|
||||
|
||||
// Sub-components should use set_error which will propegate to this error_
|
||||
|
||||
@@ -24,7 +24,8 @@ public:
|
||||
ERROR_MIN_ENDSTOP_PRESSED = 0x1000,
|
||||
ERROR_MAX_ENDSTOP_PRESSED = 0x2000,
|
||||
ERROR_ESTOP_REQUESTED = 0x4000,
|
||||
ERROR_DC_BUS_OVER_POWER = 0x8000,
|
||||
ERROR_DC_BUS_UNDER_CURRENT = 0x8000, // too much current pushed into the power supply
|
||||
ERROR_DC_BUS_OVER_CURRENT = 0x10000, // too much current pulled out of the power supply
|
||||
};
|
||||
|
||||
enum State_t {
|
||||
|
||||
@@ -83,7 +83,8 @@ struct BoardConfig_t {
|
||||
//<! This protects against cases in which the power supply fails to dissipate
|
||||
//<! the brake power if the brake resistor is disabled.
|
||||
//<! The default is 26V for the 24V board version and 52V for the 48V board version.
|
||||
float power_supply_wattage = 0.0f;
|
||||
float power_supply_max_current = INFINITY; // Max current [A] the power supply can source
|
||||
float power_supply_min_current = 0.0f; // Max current [A] the power supply can sink
|
||||
PWMMapping_t pwm_mappings[GPIO_COUNT];
|
||||
PWMMapping_t analog_mappings[GPIO_COUNT];
|
||||
};
|
||||
|
||||
@@ -156,7 +156,8 @@ static inline auto make_obj_tree() {
|
||||
make_protocol_property("enable_ascii_protocol_on_usb", &board_config.enable_ascii_protocol_on_usb),
|
||||
make_protocol_property("dc_bus_undervoltage_trip_level", &board_config.dc_bus_undervoltage_trip_level),
|
||||
make_protocol_property("dc_bus_overvoltage_trip_level", &board_config.dc_bus_overvoltage_trip_level),
|
||||
make_protocol_property("power_supply_wattage", &board_config.power_supply_wattage),
|
||||
make_protocol_property("power_supply_min_current", &board_config.power_supply_min_current),
|
||||
make_protocol_property("power_supply_max_current", &board_config.power_supply_max_current),
|
||||
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 3
|
||||
make_protocol_object("gpio1_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[0])),
|
||||
make_protocol_object("gpio2_pwm_mapping", make_protocol_definitions(board_config.pwm_mappings[1])),
|
||||
|
||||
Reference in New Issue
Block a user