FlightTaskDescend: set no vertical thrust when commanding velocity

This commit is contained in:
Matthias Grob
2019-10-15 13:53:17 +02:00
committed by Julian Oes
parent de90543d6f
commit 22c4bb498c
2 changed files with 10 additions and 11 deletions
@@ -39,11 +39,10 @@
bool FlightTaskDescend::activate(vehicle_local_position_setpoint_s last_setpoint) bool FlightTaskDescend::activate(vehicle_local_position_setpoint_s last_setpoint)
{ {
bool ret = FlightTask::activate(last_setpoint); bool ret = FlightTask::activate(last_setpoint);
_position_setpoint = {NAN, NAN, NAN}; // stay level to minimize horizontal drift
_velocity_setpoint = {NAN, NAN, NAN}; _thrust_setpoint = matrix::Vector3f(0.0f, 0.0f, NAN);
_thrust_setpoint = matrix::Vector3f(0.0f, 0.0f, -_param_mpc_thr_hover.get() * 0.6f); // keep heading
_yaw_setpoint = _yaw; _yaw_setpoint = _yaw;
_yawspeed_setpoint = 0.0f;
return ret; return ret;
} }
@@ -52,11 +51,13 @@ bool FlightTaskDescend::update()
if (PX4_ISFINITE(_velocity(2))) { if (PX4_ISFINITE(_velocity(2))) {
// land with landspeed // land with landspeed
_velocity_setpoint(2) = _param_mpc_land_speed.get(); _velocity_setpoint(2) = _param_mpc_land_speed.get();
_thrust_setpoint(2) = NAN;
} else { } else {
return false; // descend with constant thrust (crash landing)
_velocity_setpoint(2) = NAN;
_thrust_setpoint(2) = -_param_mpc_thr_hover.get() * 0.7f;
} }
return true; return true;
} }
@@ -33,7 +33,6 @@
/** /**
* @file FlightTaskDescend.hpp * @file FlightTaskDescend.hpp
*
*/ */
#pragma once #pragma once
@@ -44,15 +43,14 @@ class FlightTaskDescend : public FlightTask
{ {
public: public:
FlightTaskDescend() = default; FlightTaskDescend() = default;
virtual ~FlightTaskDescend() = default; virtual ~FlightTaskDescend() = default;
bool update() override; bool update() override;
bool activate(vehicle_local_position_setpoint_s last_setpoint) override; bool activate(vehicle_local_position_setpoint_s last_setpoint) override;
private: private:
DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask, DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask,
(ParamFloat<px4::params::MPC_LAND_SPEED>) _param_mpc_land_speed, (ParamFloat<px4::params::MPC_THR_HOVER>) _param_mpc_thr_hover, ///< thrust at hover equilibrium
(ParamFloat<px4::params::MPC_THR_HOVER>) (ParamFloat<px4::params::MPC_LAND_SPEED>) _param_mpc_land_speed ///< velocity for controlled descend
_param_mpc_thr_hover /**< throttle value at which vehicle is at hover equilibrium */
) )
}; };