mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
Sticks: Provide auxiliary analog values from manual_control_setpoint
This commit is contained in:
@@ -62,6 +62,13 @@ bool Sticks::checkAndUpdateStickInputs()
|
|||||||
_positions_expo(2) = math::expo_deadzone(_positions(2), _param_mpc_z_man_expo.get(), _param_mpc_hold_dz.get());
|
_positions_expo(2) = math::expo_deadzone(_positions(2), _param_mpc_z_man_expo.get(), _param_mpc_hold_dz.get());
|
||||||
_positions_expo(3) = math::expo_deadzone(_positions(3), _param_mpc_yaw_expo.get(), _param_mpc_hold_dz.get());
|
_positions_expo(3) = math::expo_deadzone(_positions(3), _param_mpc_yaw_expo.get(), _param_mpc_hold_dz.get());
|
||||||
|
|
||||||
|
_aux_positions(0) = manual_control_setpoint.aux1;
|
||||||
|
_aux_positions(1) = manual_control_setpoint.aux2;
|
||||||
|
_aux_positions(2) = manual_control_setpoint.aux3;
|
||||||
|
_aux_positions(3) = manual_control_setpoint.aux4;
|
||||||
|
_aux_positions(4) = manual_control_setpoint.aux5;
|
||||||
|
_aux_positions(5) = manual_control_setpoint.aux6;
|
||||||
|
|
||||||
// valid stick inputs are required
|
// valid stick inputs are required
|
||||||
_input_available = manual_control_setpoint.valid && _positions.isAllFinite();
|
_input_available = manual_control_setpoint.valid && _positions.isAllFinite();
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ public:
|
|||||||
const matrix::Vector2f getPitchRoll() { return _positions.slice<2, 1>(0, 0); }
|
const matrix::Vector2f getPitchRoll() { return _positions.slice<2, 1>(0, 0); }
|
||||||
const matrix::Vector2f getPitchRollExpo() { return _positions_expo.slice<2, 1>(0, 0); }
|
const matrix::Vector2f getPitchRollExpo() { return _positions_expo.slice<2, 1>(0, 0); }
|
||||||
|
|
||||||
|
const matrix::Vector<float, 6> &getAux() const { return _aux_positions; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit the the horizontal input from a square shaped joystick gimbal to a unit circle
|
* Limit the the horizontal input from a square shaped joystick gimbal to a unit circle
|
||||||
* @param v Vector containing x, y, z axis of the joystick gimbal. x, y get adjusted
|
* @param v Vector containing x, y, z axis of the joystick gimbal. x, y get adjusted
|
||||||
@@ -93,6 +95,8 @@ private:
|
|||||||
matrix::Vector4f _positions; ///< unmodified manual stick inputs
|
matrix::Vector4f _positions; ///< unmodified manual stick inputs
|
||||||
matrix::Vector4f _positions_expo; ///< modified manual sticks using expo function
|
matrix::Vector4f _positions_expo; ///< modified manual sticks using expo function
|
||||||
|
|
||||||
|
matrix::Vector<float, 6> _aux_positions;
|
||||||
|
|
||||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||||
uORB::Subscription _failsafe_flags_sub{ORB_ID(failsafe_flags)};
|
uORB::Subscription _failsafe_flags_sub{ORB_ID(failsafe_flags)};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user