Copter: complete addition of SafeRTL flight mode

This commit is contained in:
Randy Mackay 2017-09-04 11:39:54 +09:00
parent 218983d594
commit 8df042f00c
5 changed files with 6 additions and 0 deletions

View File

@ -52,6 +52,7 @@ NOINLINE void Copter::send_heartbeat(mavlink_channel_t chan)
case CIRCLE: case CIRCLE:
case POSHOLD: case POSHOLD:
case BRAKE: case BRAKE:
case SAFE_RTL:
base_mode |= MAV_MODE_FLAG_GUIDED_ENABLED; base_mode |= MAV_MODE_FLAG_GUIDED_ENABLED;
// note that MAV_MODE_FLAG_AUTO_ENABLED does not match what // note that MAV_MODE_FLAG_AUTO_ENABLED does not match what
// APM does in any mode, as that is defined as "system finds its own goal // APM does in any mode, as that is defined as "system finds its own goal

View File

@ -369,6 +369,7 @@ void Copter::notify_flight_mode(control_mode_t mode)
case AVOID_ADSB: case AVOID_ADSB:
case GUIDED_NOGPS: case GUIDED_NOGPS:
case LAND: case LAND:
case SAFE_RTL:
// autopilot modes // autopilot modes
AP_Notify::flags.autopilot_mode = true; AP_Notify::flags.autopilot_mode = true;
break; break;

View File

@ -108,6 +108,7 @@ void Copter::heli_update_landing_swash()
break; break;
case RTL: case RTL:
case SAFE_RTL:
if (rtl_state == RTL_Land) { if (rtl_state == RTL_Land) {
motors->set_collective_for_landing(true); motors->set_collective_for_landing(true);
}else{ }else{

View File

@ -32,6 +32,7 @@ void Copter::calc_wp_distance()
case AUTO: case AUTO:
case RTL: case RTL:
case SAFE_RTL:
wp_distance = wp_nav->get_wp_distance_to_destination(); wp_distance = wp_nav->get_wp_distance_to_destination();
break; break;
@ -59,6 +60,7 @@ void Copter::calc_wp_bearing()
case AUTO: case AUTO:
case RTL: case RTL:
case SAFE_RTL:
wp_bearing = wp_nav->get_wp_bearing_to_destination(); wp_bearing = wp_nav->get_wp_bearing_to_destination();
break; break;

View File

@ -360,6 +360,7 @@ void Copter::update_sensor_status_flags(void)
case POSHOLD: case POSHOLD:
case BRAKE: case BRAKE:
case THROW: case THROW:
case SAFE_RTL:
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL; control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL;
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL; control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL;
break; break;