|
|
@ -1060,12 +1060,19 @@ bool QuadPlane::handle_do_vtol_transition(enum MAV_VTOL_STATE state) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool QuadPlane::in_vtol_auto(void) |
|
|
|
bool QuadPlane::in_vtol_auto(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!enable || plane.control_mode != AUTO) { |
|
|
|
if (!enable) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (plane.control_mode != AUTO && |
|
|
|
|
|
|
|
plane.control_mode != GUIDED) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (plane.auto_state.vtol_mode) { |
|
|
|
if (plane.auto_state.vtol_mode) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (plane.control_mode == GUIDED) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
switch (plane.mission.get_current_nav_cmd().id) { |
|
|
|
switch (plane.mission.get_current_nav_cmd().id) { |
|
|
|
case MAV_CMD_NAV_VTOL_LAND: |
|
|
|
case MAV_CMD_NAV_VTOL_LAND: |
|
|
|
case MAV_CMD_NAV_VTOL_TAKEOFF: |
|
|
|
case MAV_CMD_NAV_VTOL_TAKEOFF: |
|
|
@ -1690,3 +1697,23 @@ float QuadPlane::get_weathervane_yaw_rate_cds(void) |
|
|
|
// authority of the weathervane controller
|
|
|
|
// authority of the weathervane controller
|
|
|
|
return weathervane.last_output * (yaw_rate_max/2) * 100; |
|
|
|
return weathervane.last_output * (yaw_rate_max/2) * 100; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
start guided mode control |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void QuadPlane::guided_start(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
poscontrol.state = QPOS_POSITION1; |
|
|
|
|
|
|
|
poscontrol.speed_scale = 0; |
|
|
|
|
|
|
|
setup_target_position(); |
|
|
|
|
|
|
|
poscontrol.slow_descent = (plane.current_loc.alt > plane.next_WP_loc.alt); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
update guided mode control |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void QuadPlane::guided_update(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// run VTOL position controller
|
|
|
|
|
|
|
|
vtol_position_controller(); |
|
|
|
|
|
|
|
} |
|
|
|