mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 18:33:33 +08:00
MC auto: add maximum RC assist distance during landing
This commit is contained in:
committed by
Mathieu Bresciani
parent
d6fa42fefd
commit
c7bddda1db
@@ -75,7 +75,8 @@ void StickAccelerationXY::generateSetpoints(Vector2f stick_xy, const float yaw,
|
||||
{
|
||||
// maximum commanded acceleration and velocity
|
||||
Vector2f acceleration_scale(_param_mpc_acc_hor.get(), _param_mpc_acc_hor.get());
|
||||
Vector2f velocity_scale(_param_mpc_vel_manual.get(), _param_mpc_vel_manual.get());
|
||||
const float velocity_sc = fminf(_param_mpc_vel_manual.get(), _velocity_constraint);
|
||||
Vector2f velocity_scale(velocity_sc, velocity_sc);
|
||||
|
||||
acceleration_scale *= 2.f; // because of drag the average acceleration is half
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ public:
|
||||
void generateSetpoints(matrix::Vector2f stick_xy, const float yaw, const float yaw_sp, const matrix::Vector3f &pos,
|
||||
const matrix::Vector2f &vel_sp_feedback, const float dt);
|
||||
void getSetpoints(matrix::Vector3f &pos_sp, matrix::Vector3f &vel_sp, matrix::Vector3f &acc_sp);
|
||||
float getMaxAcceleration() { return _param_mpc_acc_hor.get(); };
|
||||
float getMaxJerk() { return _param_mpc_jerk_max.get(); };
|
||||
void setVelocityConstraint(float vel) { _velocity_constraint = fmaxf(vel, FLT_EPSILON); };
|
||||
|
||||
private:
|
||||
void applyJerkLimit(const float dt);
|
||||
@@ -79,6 +82,8 @@ private:
|
||||
matrix::Vector2f _acceleration_setpoint;
|
||||
matrix::Vector2f _acceleration_setpoint_prev;
|
||||
|
||||
float _velocity_constraint{INFINITY};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamFloat<px4::params::MPC_VEL_MANUAL>) _param_mpc_vel_manual,
|
||||
(ParamFloat<px4::params::MPC_VEL_MAN_SIDE>) _param_mpc_vel_man_side,
|
||||
|
||||
Reference in New Issue
Block a user