Add acceleration stick mapping for position mode

This commit is contained in:
Matthias Grob
2020-10-26 14:40:15 +01:00
parent b50e6bda69
commit 0b8f092d2b
18 changed files with 837 additions and 6 deletions
@@ -597,6 +597,10 @@ void MulticopterPositionControl::start_flight_task()
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPositionSmoothVel);
break;
case 4:
error = _flight_tasks.switchTask(FlightTaskIndex::ManualAcceleration);
break;
default:
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPosition);
break;
@@ -463,7 +463,10 @@ PARAM_DEFINE_FLOAT(MPC_VELD_LP, 5.0f);
/**
* Maximum horizontal acceleration for auto mode and for manual mode
*
* Maximum deceleration for MPC_POS_MODE 1. Maximum acceleration and deceleration for MPC_POS_MODE 3.
* MPC_POS_MODE
* 1 just deceleration
* 3 acceleration and deceleration
* 4 just acceleration
*
* @unit m/s^2
* @min 2.0
@@ -536,7 +539,7 @@ PARAM_DEFINE_FLOAT(MPC_ACC_DOWN_MAX, 3.0f);
*
* Setting this to the maximum value essentially disables the limit.
*
* Note: This is only used when MPC_POS_MODE is set to a smoothing mode 1 or 3.
* Note: This is only used when MPC_POS_MODE is set to a smoothing mode 1, 3 or 4.
*
* @unit m/s^3
* @min 0.5
@@ -727,13 +730,15 @@ PARAM_DEFINE_FLOAT(MPC_TKO_RAMP_T, 3.0f);
* 1 Smooth position control with maximum acceleration and jerk limits based on slew-rates.
* 3 Smooth position control with maximum acceleration and jerk limits based on
* jerk optimized trajectory generator (different algorithm than 1).
* 4 Smooth position control where sticks map to acceleration and there's a virtual brake drag
*
* @value 0 Simple position control
* @value 1 Smooth position control
* @value 3 Smooth position control (Jerk optimized)
* @value 4 Acceleration based input
* @group Multicopter Position Control
*/
PARAM_DEFINE_INT32(MPC_POS_MODE, 3);
PARAM_DEFINE_INT32(MPC_POS_MODE, 4);
/**
* Enforced delay between arming and takeoff