aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/state_machine_helper.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-05-25 08:22:54 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-05-25 08:22:54 +0200
commitc7bf00562d685b513e1720f558fee5840aca151b (patch)
tree4d89a73a064d6f4ecc51652793acdfe86ec0b19d /src/modules/commander/state_machine_helper.cpp
parent36495cdb62e21b30a5a1851ec802c9f6a40c1171 (diff)
downloadpx4-firmware-c7bf00562d685b513e1720f558fee5840aca151b.tar.gz
px4-firmware-c7bf00562d685b513e1720f558fee5840aca151b.tar.bz2
px4-firmware-c7bf00562d685b513e1720f558fee5840aca151b.zip
commander: Enforce (in presence of power sensing) that a) system is not purely servo rail powered and b) power rail voltage is higher than 4.5V on the main avionics rail
Diffstat (limited to 'src/modules/commander/state_machine_helper.cpp')
-rw-r--r--src/modules/commander/state_machine_helper.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp
index 87309b238..818974648 100644
--- a/src/modules/commander/state_machine_helper.cpp
+++ b/src/modules/commander/state_machine_helper.cpp
@@ -144,6 +144,28 @@ arming_state_transition(struct vehicle_status_s *status, /// current
valid_transition = false;
}
+ // Fail transition if power is not good
+ if (!status->condition_power_input_valid) {
+
+ if (mavlink_fd) {
+ mavlink_log_critical(mavlink_fd, "#audio: NOT ARMING: Connect power module.");
+ }
+
+ valid_transition = false;
+ }
+
+ // Fail transition if power levels on the avionics rail
+ // are insufficient
+ if ((status->avionics_power_rail_voltage > 0.0f) &&
+ (status->avionics_power_rail_voltage < 4.5f)) {
+
+ if (mavlink_fd) {
+ mavlink_log_critical(mavlink_fd, "#audio: NOT ARMING: Avionics power low: %6.2f V.", status->avionics_power_rail_voltage);
+ }
+
+ valid_transition = false;
+ }
+
} else if (new_arming_state == ARMING_STATE_STANDBY && status->arming_state == ARMING_STATE_ARMED_ERROR) {
new_arming_state = ARMING_STATE_STANDBY_ERROR;
}