FlightTaskAutoMapper: clarify influence of sticks

This commit is contained in:
Matthias Grob 2020-07-15 15:25:53 +02:00 committed by Julian Kent
parent 079c5a11c2
commit 0d56035a46
4 changed files with 19 additions and 19 deletions

View File

@ -180,22 +180,17 @@ bool FlightTaskAutoMapper::_highEnoughForLandingGear()
float FlightTaskAutoMapper::_getLandSpeed()
{
float speed = 0;
float land_speed = math::gradual(_dist_to_ground,
_param_mpc_land_alt2.get(), _param_mpc_land_alt1.get(),
_param_mpc_land_speed.get(), _constraints.speed_down);
if (_dist_to_ground > _param_mpc_land_alt1.get()) {
speed = _constraints.speed_down;
} else {
const float land_speed = math::gradual(_dist_to_ground,
_param_mpc_land_alt2.get(), _param_mpc_land_alt1.get(),
_param_mpc_land_speed.get(), _constraints.speed_down);
// user input assisted land speed
if (_param_mpc_land_rc_help.get()) {
_sticks.evaluateSticks(_time_stamp_current);
speed = land_speed + _sticks.getPositionExpo()(2) * land_speed;
}
// user input assisted land speed
if (_param_mpc_land_rc_help.get()
&& (_dist_to_ground < _param_mpc_land_alt1.get())
&& _sticks.evaluateSticks(_time_stamp_current)) {
// stick full up -1 -> stop, stick full down 1 -> double the speed
land_speed *= (1 + _sticks.getPositionExpo()(2));
}
return speed;
return land_speed;
}

View File

@ -43,7 +43,7 @@ Sticks::Sticks(ModuleParams *parent) :
ModuleParams(parent)
{};
void Sticks::evaluateSticks(hrt_abstime now)
bool Sticks::evaluateSticks(hrt_abstime now)
{
_sub_manual_control_setpoint.update();
@ -80,6 +80,8 @@ void Sticks::evaluateSticks(hrt_abstime now)
_positions.zero();
_positions_expo.zero();
}
return _input_available;
}
void Sticks::applyGearSwitch(landing_gear_s &gear)

View File

@ -53,7 +53,7 @@ public:
Sticks(ModuleParams *parent);
~Sticks() = default;
void evaluateSticks(hrt_abstime now); ///< checks and sets stick inputs
bool evaluateSticks(hrt_abstime now); ///< checks and sets stick inputs
void applyGearSwitch(landing_gear_s &gear); ///< Sets gears according to switch
bool isAvailable() { return _input_available; };
const matrix::Vector<float, 4> &getPosition() { return _positions; };

View File

@ -359,8 +359,11 @@ PARAM_DEFINE_FLOAT(MPC_LAND_VEL_XY, 10.0f);
/**
* Enable user assisted descent speed for autonomous land routine.
* When enabled, descent speed will be equal to MPC_LAND_SPEED at half throttle,
* MPC_Z_VEL_MAX_DN at zero throttle, and 0.5 * MPC_LAND_SPEED at full throttle.
*
* When enabled, descent speed will be:
* stick full up - 0
* stick centered - MPC_LAND_SPEED
* stick full down - 2 * MPC_LAND_SPEED
*
* @min 0
* @max 1