diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-09-10 00:11:09 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-09-10 00:11:09 +0200 |
commit | 3140ba658a322d98c6fe7943c5fb72bb061c46de (patch) | |
tree | 65de11b76548578173146d4b6ab36634bf2e7719 /apps/commander/state_machine_helper.c | |
parent | 6ea402efdc769a8b2d1a409ed07890f073ba4867 (diff) | |
download | px4-firmware-3140ba658a322d98c6fe7943c5fb72bb061c46de.tar.gz px4-firmware-3140ba658a322d98c6fe7943c5fb72bb061c46de.tar.bz2 px4-firmware-3140ba658a322d98c6fe7943c5fb72bb061c46de.zip |
Fixed HIL enabling, renamed failsafe to better term "lockdown", made sure HIL is actually locking down system. Pending implementation of lockdown in PWM outputs
Diffstat (limited to 'apps/commander/state_machine_helper.c')
-rw-r--r-- | apps/commander/state_machine_helper.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/commander/state_machine_helper.c b/apps/commander/state_machine_helper.c index 51ed95114..2c288e92f 100644 --- a/apps/commander/state_machine_helper.c +++ b/apps/commander/state_machine_helper.c @@ -220,7 +220,10 @@ void state_machine_publish(int status_pub, struct vehicle_status_s *current_stat void publish_armed_status(const struct vehicle_status_s *current_status) { struct actuator_armed_s armed; armed.armed = current_status->flag_system_armed; - armed.failsafe = current_status->rc_signal_lost; + /* lock down actuators if required */ + // XXX FIXME Currently any loss of RC will completely disable all actuators + // needs proper failsafe + armed.lockdown = (current_status->rc_signal_lost || current_status->flag_hil_enabled) ? true : false; orb_advert_t armed_pub = orb_advertise(ORB_ID(actuator_armed), &armed); orb_publish(ORB_ID(actuator_armed), armed_pub, &armed); } @@ -559,13 +562,15 @@ uint8_t update_state_machine_mode_request(int status_pub, struct vehicle_status_ } } - /* Switch on HIL if in standby */ - if ((current_status->state_machine == SYSTEM_STATE_STANDBY) && (mode & VEHICLE_MODE_FLAG_HIL_ENABLED)) { + /* Switch on HIL if in standby and not already in HIL mode */ + if ((current_status->state_machine == SYSTEM_STATE_STANDBY) && (mode & VEHICLE_MODE_FLAG_HIL_ENABLED) + && !current_status->flag_hil_enabled) { /* Enable HIL on request */ current_status->flag_hil_enabled = true; ret = OK; state_machine_publish(status_pub, current_status, mavlink_fd); - printf("[commander] Enabling HIL\n"); + publish_armed_status(current_status); + printf("[commander] Enabling HIL, locking down all actuators for safety.\n\t(Arming the system will not activate them while in HIL mode)\n"); } /* NEVER actually switch off HIL without reboot */ |