mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Sticks : Add utility functions to get pitch, roll, throttle and yaw values intuitively and rename ambiguously named function checkAndSetStickInputs()
This commit is contained in:
parent
db7430aa65
commit
8266a4df98
@ -44,7 +44,7 @@ Sticks::Sticks(ModuleParams *parent) :
|
||||
ModuleParams(parent)
|
||||
{}
|
||||
|
||||
bool Sticks::checkAndSetStickInputs()
|
||||
bool Sticks::checkAndUpdateStickInputs()
|
||||
{
|
||||
// Sticks are rescaled linearly and exponentially to [-1,1]
|
||||
manual_control_setpoint_s manual_control_setpoint;
|
||||
|
||||
@ -53,11 +53,20 @@ public:
|
||||
Sticks(ModuleParams *parent);
|
||||
~Sticks() = default;
|
||||
|
||||
bool checkAndSetStickInputs();
|
||||
// Checks for updated manual control input & updates internal values
|
||||
bool checkAndUpdateStickInputs();
|
||||
|
||||
bool isAvailable() { return _input_available; };
|
||||
|
||||
// Position : 0 : pitch, 1 : roll, 2 : throttle, 3 : yaw
|
||||
const matrix::Vector<float, 4> &getPosition() { return _positions; };
|
||||
const matrix::Vector<float, 4> &getPositionExpo() { return _positions_expo; };
|
||||
|
||||
// Helper functions to get stick values more intuitively
|
||||
float getPitch() { return _positions(0); }
|
||||
float getRoll() { return _positions(1); }
|
||||
float getThrottle() { return _positions(2); }
|
||||
float getYaw() { return _positions(3); }
|
||||
|
||||
/**
|
||||
* Limit the the horizontal input from a square shaped joystick gimbal to a unit circle
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user