mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 23:13:34 +08:00
MC auto: add parameter to set the trajectory slow-down
In some cases e.g.: (VTOL in wind) a good tracking cannot be achieved. This condition then needs to be relaxed, otherwise the drone cannot land properly.
This commit is contained in:
+1
-1
@@ -455,7 +455,7 @@ void FlightTaskAutoLineSmoothVel::_generateTrajectory()
|
||||
Vector2f drone_to_trajectory_xy(position_trajectory_xy - position_xy);
|
||||
float position_error = drone_to_trajectory_xy.length();
|
||||
|
||||
float time_stretch = 1.f - math::constrain(position_error * 0.5f, 0.f, 1.f);
|
||||
float time_stretch = 1.f - math::constrain(position_error / _param_mpc_xy_err_max.get(), 0.f, 1.f);
|
||||
|
||||
// Don't stretch time if the drone is ahead of the position setpoint
|
||||
if (drone_to_trajectory_xy.dot(vel_traj_xy) < 0.f) {
|
||||
|
||||
+2
-1
@@ -96,6 +96,7 @@ protected:
|
||||
(ParamFloat<px4::params::MPC_ACC_UP_MAX>) _param_mpc_acc_up_max,
|
||||
(ParamFloat<px4::params::MPC_ACC_DOWN_MAX>) _param_mpc_acc_down_max,
|
||||
(ParamFloat<px4::params::MPC_JERK_AUTO>) _param_mpc_jerk_auto,
|
||||
(ParamFloat<px4::params::MPC_XY_TRAJ_P>) _param_mpc_xy_traj_p
|
||||
(ParamFloat<px4::params::MPC_XY_TRAJ_P>) _param_mpc_xy_traj_p,
|
||||
(ParamFloat<px4::params::MPC_XY_ERR_MAX>) _param_mpc_xy_err_max
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user