-
Notifications
You must be signed in to change notification settings - Fork 17.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_BattMonitor: add option minimum volt option #28148
Conversation
You can setup your low voltage failsafes on the individual battery monitors before combining them in the sum. That is not a option for ESC of course. I think the problem here is that the consumed energy calculation will be thrown off. Maybe you could apply the min voltage after the |
That works for failsafes, but we wanted to display the relevant number easily to the pilot. That could be done with GCS customizations instead I suppose, but this felt nicer. Good point about the consumed energy calculation. We can revise so that this option doesn't impact that calc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be included on minimize boards..
5e002e1
to
28faae5
Compare
If we need to go this route to prevent this 96 byte change (for Plane on Pixhawk1-1M), then I'd recommend we go further and save 200 bytes over the current master by disabling I can make that a part of this PR if we want. |
I agree, the options are not used in the minimized boards since its difficult( if not impossible )on some boards to use more than one monitor or a non-analog one(usually built-in) ....thats why everything except analog is omitted from minimize builds....we should make the SUM backend a build option while we are at it like the others are |
Wait - getting rid of I suggest we accept this PR without fussing too much about the 100 bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks good.
@@ -133,6 +137,12 @@ void AP_BattMonitor_ESC::read(void) | |||
update_consumed(_state, dt_us); | |||
|
|||
} | |||
|
|||
// Check if we want to report the minimum voltage instead of the average | |||
// (we do this after calculating consumed Wh so this doesn't affect that calculation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// (we do this after calculating consumed Wh so this doesn't affect that calculation | |
// (we do this after calculating consumed Wh so this doesn't affect that calculation) |
@@ -154,7 +154,7 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = { | |||
// @Param: OPTIONS | |||
// @DisplayName: Battery monitor options | |||
// @Description: This sets options to change the behaviour of the battery monitor | |||
// @Bitmask: 0:Ignore DroneCAN SoC, 1:MPPT reports input voltage and current, 2:MPPT Powered off when disarmed, 3:MPPT Powered on when armed, 4:MPPT Powered off at boot, 5:MPPT Powered on at boot, 6:Send resistance compensated voltage to GCS, 7:Allow DroneCAN InfoAux to be from a different CAN node | |||
// @Bitmask: 0:Ignore DroneCAN SoC, 1:MPPT reports input voltage and current, 2:MPPT Powered off when disarmed, 3:MPPT Powered on when armed, 4:MPPT Powered off at boot, 5:MPPT Powered on at boot, 6:Send resistance compensated voltage to GCS, 7:Allow DroneCAN InfoAux to be from a different CAN node, 9:Aggregate monitor reports minimum voltage instead of average. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be better to call out sum and ESC specifically.
if (voltage_count == 0 || _mon.voltage(i) < voltage_min) { | ||
voltage_min = _mon.voltage(i); | ||
} | ||
voltage_sum += _mon.voltage(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the fetched voltage as a const float just to prevent getting it three times.
28faae5
to
09c8cc5
Compare
Allows aggregate monitors like Sum and ESC to report the minimum voltage instead of the average voltage. This is useful for systems with multiple isolated batteries where the lowest voltage is the limiting factor.
09c8cc5
to
9f2f5a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -103,6 +108,12 @@ AP_BattMonitor_Sum::read() | |||
|
|||
update_consumed(_state, dt_us); | |||
|
|||
// Check if we want to report the minimum voltage instead of the average |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
race condition for scripting or DDS, I think we need to create a local float state_voltage and then set that once
Closed in favor of #28227 |
Allows aggregate monitors like Sum and ESC to report the minimum voltage instead of the average voltage. This is useful for systems with multiple isolated batteries where the lowest voltage is the limiting factor.
@robertlong13