Plane: use new APM_OBC API

This commit is contained in:
Andrew Tridgell 2014-04-21 10:36:00 +10:00
parent be9d0c1c4d
commit 2ab4ffef45
2 changed files with 8 additions and 24 deletions

View File

@ -563,7 +563,7 @@ AP_Mission mission(ahrs,
// Outback Challenge Failsafe Support // Outback Challenge Failsafe Support
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#if OBC_FAILSAFE == ENABLED #if OBC_FAILSAFE == ENABLED
APM_OBC obc(mission, barometer, gps); APM_OBC obc(mission, barometer, gps, rcmap);
#endif #endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -906,29 +906,6 @@ static void set_servos(void)
channel_rudder->radio_out = channel_rudder->radio_in; channel_rudder->radio_out = channel_rudder->radio_in;
} }
#if OBC_FAILSAFE == ENABLED
// this is to allow the failsafe module to deliberately crash
// the plane. Only used in extreme circumstances to meet the
// OBC rules
if (obc.crash_plane()) {
channel_roll->servo_out = -4500;
channel_pitch->servo_out = -4500;
channel_rudder->servo_out = -4500;
channel_throttle->servo_out = 0;
channel_roll->calc_pwm();
channel_pitch->calc_pwm();
channel_rudder->calc_pwm();
channel_throttle->calc_pwm();
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_flap_auto, 100);
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_flap, 100);
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_aileron, 4500);
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_rudder, 4500);
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_elevator, 4500);
RC_Channel_aux::set_servo_out(RC_Channel_aux::k_elevator_with_input, 4500);
}
#endif
if (g.flaperon_output != MIXING_DISABLED && g.elevon_output == MIXING_DISABLED && g.mix_mode == 0) { if (g.flaperon_output != MIXING_DISABLED && g.elevon_output == MIXING_DISABLED && g.mix_mode == 0) {
flaperon_update(auto_flap_percent); flaperon_update(auto_flap_percent);
} }
@ -956,6 +933,13 @@ static void set_servos(void)
} }
} }
#if OBC_FAILSAFE == ENABLED
// this is to allow the failsafe module to deliberately crash
// the plane. Only used in extreme circumstances to meet the
// OBC rules
obc.check_crash_plane();
#endif
#if HIL_MODE != HIL_MODE_DISABLED #if HIL_MODE != HIL_MODE_DISABLED
// get the servos to the GCS immediately for HIL // get the servos to the GCS immediately for HIL
if (comm_get_txspace(MAVLINK_COMM_0) - MAVLINK_NUM_NON_PAYLOAD_BYTES >= MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN) { if (comm_get_txspace(MAVLINK_COMM_0) - MAVLINK_NUM_NON_PAYLOAD_BYTES >= MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN) {