mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 05:33:33 +08:00
FlightTaskManualAltitude: add deadzone for yaw
This commit is contained in:
committed by
Beat Küng
parent
cd1e01d5a0
commit
ec4089cebf
@@ -34,7 +34,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file FlightTaskManual.hpp
|
* @file FlightTaskManual.hpp
|
||||||
*
|
*
|
||||||
* Flight task for manual controlled altitude.
|
* Flight-task for manual controlled altitude.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -51,7 +51,9 @@ FlightTaskManualAltitude::FlightTaskManualAltitude(control::SuperBlock *parent,
|
|||||||
_vel_max_up(parent, "MPC_Z_VEL_MAX_UP", false),
|
_vel_max_up(parent, "MPC_Z_VEL_MAX_UP", false),
|
||||||
_yaw_rate_scaling(parent, "MPC_MAN_Y_MAX", false),
|
_yaw_rate_scaling(parent, "MPC_MAN_Y_MAX", false),
|
||||||
_acc_max_up(parent, "MPC_ACC_UP_MAX", false),
|
_acc_max_up(parent, "MPC_ACC_UP_MAX", false),
|
||||||
_acc_max_down(parent, "MPC_ACC_DOWN_MAX", false)
|
_acc_max_down(parent, "MPC_ACC_DOWN_MAX", false),
|
||||||
|
_stick_deadzone(parent, "MPC_HOLD_DZ", false)
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool FlightTaskManualAltitude::activate()
|
bool FlightTaskManualAltitude::activate()
|
||||||
@@ -76,7 +78,7 @@ void FlightTaskManualAltitude::scaleSticks()
|
|||||||
|
|
||||||
void FlightTaskManualAltitude::updateHeadingSetpoints()
|
void FlightTaskManualAltitude::updateHeadingSetpoints()
|
||||||
{
|
{
|
||||||
if (fabsf(_sticks(3)) < FLT_EPSILON) {
|
if (fabsf(_sticks(3)) < _stick_deadzone.get()) {
|
||||||
/* Want to hold yaw */
|
/* Want to hold yaw */
|
||||||
_yaw_rate_sp = NAN;
|
_yaw_rate_sp = NAN;
|
||||||
_yaw_sp = _yaw_sp_predicted;
|
_yaw_sp = _yaw_sp_predicted;
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ protected:
|
|||||||
control::BlockParamFloat _yaw_rate_scaling; /**< scaling factor from stick to yaw rate */
|
control::BlockParamFloat _yaw_rate_scaling; /**< scaling factor from stick to yaw rate */
|
||||||
control::BlockParamFloat _acc_max_up; /**< maximum acceleration upward */
|
control::BlockParamFloat _acc_max_up; /**< maximum acceleration upward */
|
||||||
control::BlockParamFloat _acc_max_down; /**< maximum acceleration downward */
|
control::BlockParamFloat _acc_max_down; /**< maximum acceleration downward */
|
||||||
|
control::BlockParamFloat _stick_deadzone; /**< stick is considered zero if below deadzone */
|
||||||
|
|
||||||
virtual void updateSetpoints(); /**< updates all setpoints */
|
virtual void updateSetpoints(); /**< updates all setpoints */
|
||||||
virtual void scaleSticks(); /**< scales sticks to velocity */
|
virtual void scaleSticks(); /**< scales sticks to velocity */
|
||||||
|
|||||||
Reference in New Issue
Block a user