mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:58:53 +08:00
FlightTaskAltitude: remove duplicate, deprecated yaw stick handling
This commit is contained in:
@@ -90,10 +90,6 @@ void FlightTaskManualAltitude::_updateConstraintsFromEstimator()
|
|||||||
|
|
||||||
void FlightTaskManualAltitude::_scaleSticks()
|
void FlightTaskManualAltitude::_scaleSticks()
|
||||||
{
|
{
|
||||||
// Use stick input with deadzone, exponential curve and first order lpf for yawspeed
|
|
||||||
_stick_yaw.generateYawSetpoint(_yawspeed_setpoint, _yaw_setpoint, _sticks.getYawExpo(), _yaw,
|
|
||||||
_is_yaw_good_for_control, _deltatime);
|
|
||||||
|
|
||||||
// Use sticks input with deadzone and exponential curve for vertical velocity
|
// Use sticks input with deadzone and exponential curve for vertical velocity
|
||||||
const float vel_max_z = (_sticks.getPosition()(2) > 0.0f) ? _param_mpc_z_vel_max_dn.get() :
|
const float vel_max_z = (_sticks.getPosition()(2) > 0.0f) ? _param_mpc_z_vel_max_dn.get() :
|
||||||
_param_mpc_z_vel_max_up.get();
|
_param_mpc_z_vel_max_up.get();
|
||||||
@@ -273,40 +269,6 @@ void FlightTaskManualAltitude::_respectGroundSlowdown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightTaskManualAltitude::_updateHeadingSetpoints()
|
|
||||||
{
|
|
||||||
if (_isYawInput() || !_is_yaw_good_for_control) {
|
|
||||||
_unlockYaw();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_lockYaw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FlightTaskManualAltitude::_isYawInput()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* A threshold larger than FLT_EPSILON is required because the
|
|
||||||
* _yawspeed_setpoint comes from an IIR filter and takes too much
|
|
||||||
* time to reach zero.
|
|
||||||
*/
|
|
||||||
return fabsf(_yawspeed_setpoint) > 0.001f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlightTaskManualAltitude::_unlockYaw()
|
|
||||||
{
|
|
||||||
// no fixed heading when rotating around yaw by stick
|
|
||||||
_yaw_setpoint = NAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlightTaskManualAltitude::_lockYaw()
|
|
||||||
{
|
|
||||||
// hold the current heading when no more rotation commanded
|
|
||||||
if (!PX4_ISFINITE(_yaw_setpoint)) {
|
|
||||||
_yaw_setpoint = _yaw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlightTaskManualAltitude::_ekfResetHandlerHeading(float delta_psi)
|
void FlightTaskManualAltitude::_ekfResetHandlerHeading(float delta_psi)
|
||||||
{
|
{
|
||||||
// Only reset the yaw setpoint when the heading is locked
|
// Only reset the yaw setpoint when the heading is locked
|
||||||
@@ -317,7 +279,8 @@ void FlightTaskManualAltitude::_ekfResetHandlerHeading(float delta_psi)
|
|||||||
|
|
||||||
void FlightTaskManualAltitude::_updateSetpoints()
|
void FlightTaskManualAltitude::_updateSetpoints()
|
||||||
{
|
{
|
||||||
_updateHeadingSetpoints(); // get yaw setpoint
|
_stick_yaw.generateYawSetpoint(_yawspeed_setpoint, _yaw_setpoint, _sticks.getYawExpo(), _yaw,
|
||||||
|
_is_yaw_good_for_control, _deltatime);
|
||||||
_acceleration_setpoint.xy() = _stick_tilt_xy.generateAccelerationSetpoints(_sticks.getPitchRoll(), _deltatime, _yaw,
|
_acceleration_setpoint.xy() = _stick_tilt_xy.generateAccelerationSetpoints(_sticks.getPitchRoll(), _deltatime, _yaw,
|
||||||
_yaw_setpoint);
|
_yaw_setpoint);
|
||||||
_updateAltitudeLock();
|
_updateAltitudeLock();
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public:
|
|||||||
bool update() override;
|
bool update() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _updateHeadingSetpoints(); /**< sets yaw or yaw speed */
|
|
||||||
void _ekfResetHandlerHeading(float delta_psi) override; /**< adjust heading setpoint in case of EKF reset event */
|
void _ekfResetHandlerHeading(float delta_psi) override; /**< adjust heading setpoint in case of EKF reset event */
|
||||||
virtual void _updateSetpoints(); /**< updates all setpoints */
|
virtual void _updateSetpoints(); /**< updates all setpoints */
|
||||||
virtual void _scaleSticks(); /**< scales sticks to velocity in z */
|
virtual void _scaleSticks(); /**< scales sticks to velocity in z */
|
||||||
@@ -89,10 +88,6 @@ protected:
|
|||||||
_param_mpc_tko_speed /**< desired upwards speed when still close to the ground */
|
_param_mpc_tko_speed /**< desired upwards speed when still close to the ground */
|
||||||
)
|
)
|
||||||
private:
|
private:
|
||||||
bool _isYawInput();
|
|
||||||
void _unlockYaw();
|
|
||||||
void _lockYaw();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terrain following.
|
* Terrain following.
|
||||||
* During terrain following, the position setpoint is adjusted
|
* During terrain following, the position setpoint is adjusted
|
||||||
|
|||||||
Reference in New Issue
Block a user