mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 20:20:36 +08:00
FlightTaskManualAltitude: vertical velocity limit interface
This commit is contained in:
@@ -92,8 +92,9 @@ void FlightTaskManualAltitude::_updateConstraintsFromEstimator()
|
||||
void FlightTaskManualAltitude::_scaleSticks()
|
||||
{
|
||||
// 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() :
|
||||
_param_mpc_z_vel_max_up.get();
|
||||
const float vel_max_up = fminf(_param_mpc_z_vel_max_up.get(), _velocity_constraint_up);
|
||||
const float vel_max_down = fminf(_param_mpc_z_vel_max_dn.get(), _velocity_constraint_down);
|
||||
const float vel_max_z = (_sticks.getPosition()(2) > 0.0f) ? vel_max_down : vel_max_up;
|
||||
_velocity_setpoint(2) = vel_max_z * _sticks.getPositionExpo()(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ protected:
|
||||
bool _sticks_data_required = true; ///< let inherited task-class define if it depends on stick data
|
||||
bool _terrain_hold{false}; /**< true when vehicle is controlling height above a static ground position */
|
||||
|
||||
float _velocity_constraint_up{INFINITY};
|
||||
float _velocity_constraint_down{INFINITY};
|
||||
|
||||
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask,
|
||||
(ParamFloat<px4::params::MPC_HOLD_MAX_Z>) _param_mpc_hold_max_z,
|
||||
(ParamInt<px4::params::MPC_ALT_MODE>) _param_mpc_alt_mode,
|
||||
|
||||
Reference in New Issue
Block a user