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
Battery critical/low actions #7213
Merged
OXINARF
merged 15 commits into
ArduPilot:master
from
WickedShell:wickedshell/batt-failsafes
Mar 27, 2018
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
979eadb
AP_AdvancedFailsafe: Allow GCS teriminate to supply a reason cause
WickedShell ba99b2c
GCS_MAVLink: Support AFS changes
WickedShell 1284f5e
AP_Compass: Read current for compensation from the battery singleton
WickedShell 97df441
AP_Motors: Use battery singleton
WickedShell 432b3c7
AP_BattMonitor: Support critical and low battery failsafes
WickedShell 2d7b750
AP_Frsky_Telem: Remove unneeded battery failsafe parameters
WickedShell a8bbbb0
Plane: Support new battery failsafes
WickedShell d928a58
Copter: Support new battery failsafes
WickedShell 27e0347
Sub: Support new battery failsafes
WickedShell eafeb55
Rover: Support new battery interface
WickedShell 2a7a02b
AntennaTracker: Support new battery failsafes
WickedShell 0e6e9d2
Replay: Support GCS_MAVLink changes
WickedShell 0b9270c
SITL: Create a second voltage to monitor for battery voltages
WickedShell 320010a
AutoTest: Update copter battery failsafe test
WickedShell a30868a
AP_Motors: Allow specifying which battery is used for compensation
WickedShell File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,7 +293,8 @@ void Rover::update_sensor_status_flags(void) | |
~MAV_SYS_STATUS_SENSOR_YAW_POSITION & | ||
~MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL & | ||
~MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS & | ||
~MAV_SYS_STATUS_LOGGING); | ||
~MAV_SYS_STATUS_LOGGING & | ||
~MAV_SYS_STATUS_SENSOR_BATTERY); | ||
if (control_mode->attitude_stabilized()) { | ||
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL; // 3D angular rate control | ||
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION; // 3D angular rate control | ||
|
@@ -312,6 +313,10 @@ void Rover::update_sensor_status_flags(void) | |
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS; | ||
} | ||
|
||
if (battery.num_instances() > 0) { | ||
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_BATTERY; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You forgot to remove it from the default enabled sensors above. |
||
} | ||
|
||
// default to all healthy except compass and gps which we set individually | ||
control_sensors_health = control_sensors_present & (~MAV_SYS_STATUS_SENSOR_3D_MAG & ~MAV_SYS_STATUS_SENSOR_GPS); | ||
if (g.compass_enabled && compass.healthy(0) && ahrs.use_compass()) { | ||
|
@@ -352,6 +357,10 @@ void Rover::update_sensor_status_flags(void) | |
control_sensors_health &= ~MAV_SYS_STATUS_LOGGING; | ||
} | ||
|
||
if (!battery.healthy() || battery.has_failsafed()) { | ||
control_sensors_enabled &= ~MAV_SYS_STATUS_SENSOR_BATTERY; | ||
} | ||
|
||
if (!initialised || ins.calibrating()) { | ||
// while initialising the gyros and accels are not enabled | ||
control_sensors_enabled &= ~(MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since this is new, why doesn't it have the same order as the priority list?
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 actually matches the order in
APMrover2/failsafe.cpp
for the g.fs_action parameter. The next logical step is to make the normal failsafe handler use this same enum (and actually collapse the handling further). (This future intent is actually why these are called Failsafe_Action instead of Battery_Failsafe)