land-detector: switch to crawl speed for intent detection

This commit is contained in:
Thomas Debrunner
2021-10-29 16:50:12 +02:00
committed by Daniel Agar
parent 2a6d9bc1dd
commit fb8b9b647a
3 changed files with 12 additions and 9 deletions
@@ -227,14 +227,14 @@ void FlightTaskAuto::_prepareLandSetpoints()
_velocity_setpoint.setNaN(); // Don't take over any smoothed velocity setpoint
// Slow down automatic descend close to ground
float speed = math::gradual(_dist_to_ground,
_param_mpc_land_alt2.get(), _param_mpc_land_alt1.get(),
_param_mpc_land_speed.get(), _param_mpc_z_vel_max_dn.get());
float vertical_speed = math::gradual(_dist_to_ground,
_param_mpc_land_alt2.get(), _param_mpc_land_alt1.get(),
_param_mpc_land_speed.get(), _param_mpc_z_vel_max_dn.get());
bool range_dist_available = PX4_ISFINITE(_dist_to_bottom);
if (range_dist_available && _dist_to_bottom <= _param_mpc_land_alt3.get()) {
speed = _param_mpc_land_crawl_speed.get();
vertical_speed = _param_mpc_land_crawl_speed.get();
}
if (_type_previous != WaypointType::land) {
@@ -247,7 +247,7 @@ void FlightTaskAuto::_prepareLandSetpoints()
// User input assisted landing
if (_param_mpc_land_rc_help.get() && _sticks.checkAndSetStickInputs()) {
// Stick full up -1 -> stop, stick full down 1 -> double the speed
speed *= (1 + _sticks.getPositionExpo()(2));
vertical_speed *= (1 + _sticks.getPositionExpo()(2));
_stick_yaw.generateYawSetpoint(_yawspeed_setpoint, _land_heading,
_sticks.getPositionExpo()(3) * math::radians(_param_mpc_man_y_max.get()), _yaw, _is_yaw_good_for_control, _deltatime);
@@ -269,7 +269,7 @@ void FlightTaskAuto::_prepareLandSetpoints()
_position_setpoint = _land_position; // The last element of the land position has to stay NAN
_yaw_setpoint = _land_heading;
_velocity_setpoint(2) = speed;
_velocity_setpoint(2) = vertical_speed;
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
}