mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
encapsulate attitude setpoints from position control
This commit is contained in:
@@ -842,21 +842,6 @@ FixedwingPositionControl::control_auto(const hrt_abstime &now, const Vector2d &c
|
|||||||
_att_sp.thrust_body[0] = get_tecs_thrust();
|
_att_sp.thrust_body[0] = get_tecs_thrust();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// decide when to use pitch setpoint from TECS because in some cases pitch
|
|
||||||
// setpoint is generated by other means
|
|
||||||
bool use_tecs_pitch = true;
|
|
||||||
|
|
||||||
// auto runway takeoff
|
|
||||||
use_tecs_pitch &= !(position_sp_type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF &&
|
|
||||||
(_launch_detection_state == LAUNCHDETECTION_RES_NONE || _runway_takeoff.runwayTakeoffEnabled()));
|
|
||||||
|
|
||||||
// flaring during landing
|
|
||||||
use_tecs_pitch &= !(position_sp_type == position_setpoint_s::SETPOINT_TYPE_LAND && _land_noreturn_vertical);
|
|
||||||
|
|
||||||
if (use_tecs_pitch) {
|
|
||||||
_att_sp.pitch_body = get_tecs_pitch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1086,6 +1071,8 @@ FixedwingPositionControl::control_auto_position(const hrt_abstime &now, const Ve
|
|||||||
tecs_fw_mission_throttle,
|
tecs_fw_mission_throttle,
|
||||||
false,
|
false,
|
||||||
radians(_param_fw_p_lim_min.get()));
|
radians(_param_fw_p_lim_min.get()));
|
||||||
|
|
||||||
|
_att_sp.pitch_body = get_tecs_pitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1197,6 +1184,7 @@ FixedwingPositionControl::control_auto_loiter(const hrt_abstime &now, const Vect
|
|||||||
tecs_fw_mission_throttle,
|
tecs_fw_mission_throttle,
|
||||||
false,
|
false,
|
||||||
radians(_param_fw_p_lim_min.get()));
|
radians(_param_fw_p_lim_min.get()));
|
||||||
|
_att_sp.pitch_body = get_tecs_pitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1356,6 +1344,8 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
|
|||||||
radians(_param_fw_p_lim_min.get()));
|
radians(_param_fw_p_lim_min.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_att_sp.pitch_body = get_tecs_pitch();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Tell the attitude controller to stop integrating while we are waiting
|
/* Tell the attitude controller to stop integrating while we are waiting
|
||||||
* for the launch */
|
* for the launch */
|
||||||
@@ -1368,6 +1358,13 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
|
|||||||
_att_sp.pitch_body = radians(_takeoff_pitch_min.get());
|
_att_sp.pitch_body = radians(_takeoff_pitch_min.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// flaring during landing
|
||||||
|
use_tecs_pitch &= !(position_sp_type == position_setpoint_s::SETPOINT_TYPE_LAND && _land_noreturn_vertical);
|
||||||
|
|
||||||
|
if (use_tecs_pitch) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1643,6 +1640,8 @@ FixedwingPositionControl::control_auto_landing(const hrt_abstime &now, const Vec
|
|||||||
false,
|
false,
|
||||||
radians(_param_fw_p_lim_min.get()));
|
radians(_param_fw_p_lim_min.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_att_sp.pitch_body = get_tecs_pitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user