![]() |
BoB robotics
The Brains on Board robotics library
|
Classes for working with human interface devices (e.g. joysticks) More...
Classes | |
class | JoystickBase |
Generic joystick class for Xbox 360 controller, from which JoystickLinux and JoystickWindows classes inherit. More... | |
class | JoystickDummy |
class | JoystickLinux |
Class for reading from joysticks on Linux. More... | |
class | JoystickWindows |
Class for reading from joysticks on Windows. More... | |
Typedefs | |
using | JAxis = JAxisDummy |
JAxis is set to JAxisDummy on Dummy and JAxisWindows on Windows. More... | |
using | JButton = JButtonDummy |
JButton is set to JButtonLinux on Linux and JButtonWindows on Windows. | |
using | Joystick = JoystickDummy |
Joystick is set to JoystickLinux on Linux and JoystickWindows on Windows. | |
Enumerations | |
enum | ButtonState { StateDown = (1 << 0) , StatePressed = (1 << 1) , StateReleased = (1 << 2) } |
The current state of a joystick button. More... | |
enum class | JAxisDummy { LeftStickHorizontal = 0 , LeftStickVertical = 1 , RightStickHorizontal = 3 , RightStickVertical = 4 , LeftTrigger = 2 , RightTrigger = 5 , DpadHorizontal = 6 , DpadVertical = 7 , LENGTH } |
Controller axes, including thumbsticks, triggers and D-pad (Dummy) | |
enum class | JButtonDummy { A = 0 , B = 1 , X = 2 , Y = 3 , LB = 4 , RB = 5 , Back = 6 , Start = 7 , Xbox = 8 , LeftStick = 9 , RightStick = 10 , LENGTH } |
Controller buttons (Dummy) More... | |
enum class | JAxisLinux { LeftStickHorizontal = 0 , LeftStickVertical = 1 , RightStickHorizontal = 3 , RightStickVertical = 4 , LeftTrigger = 2 , RightTrigger = 5 , DpadHorizontal = 6 , DpadVertical = 7 , LENGTH } |
Controller axes, including thumbsticks, triggers and D-pad (Linux) | |
enum class | JButtonLinux { A = 0 , B = 1 , X = 2 , Y = 3 , LB = 4 , RB = 5 , Back = 6 , Start = 7 , Xbox = 8 , LeftStick = 9 , RightStick = 10 , LENGTH } |
Controller buttons (Linux) More... | |
enum class | JAxisWindows { LeftStickHorizontal = 0 , LeftStickVertical = 1 , RightStickHorizontal = 3 , RightStickVertical = 4 , LeftTrigger = 2 , RightTrigger = 5 , DpadHorizontal = 6 , DpadVertical = 7 , LENGTH } |
Controller axes, including thumbsticks, triggers and D-pad (Windows) | |
enum class | JButtonWindows { Start = 4 , Back , LeftStick , RightStick , LB , RB , A = 12 , B , X , Y , LENGTH } |
Controller buttons (Windows) More... | |
Functions | |
template<class RobotType > | |
void | drive (RobotType &robot, const JoystickBase< JAxis, JButton > &joystick) |
template<class AckermannType , std::enable_if_t< Robots::IsAckermann< AckermannType >::value, int > = 0> | |
constexpr auto | usedAxes () |
template<class RobotType , std::enable_if_t<!Robots::IsUAV< RobotType >::value, int > = 0> | |
void | addJoystick (RobotType &robot, JoystickBase< JAxis, JButton > &joystick, float deadZone=0.25f) |
Add a handler to control a robot with a joystick. More... | |
template<class AckermannType , std::enable_if_t< Robots::IsAckermann< AckermannType >::value, int > = 0> | |
void | drive (AckermannType &robot, JoystickBase< JAxis, JButton > &joystick, float deadZone) |
template<class Omni2DType , std::enable_if_t< Robots::IsOmni2D< Omni2DType >::value, int > = 0> | |
void | drive (Omni2DType &robot, const JoystickBase< JAxis, JButton > &joystick, float deadZone) |
template<class TankType , std::enable_if_t< Robots::IsTank< TankType >::value, int > = 0> | |
void | drive (TankType &robot, const JoystickBase< JAxis, JButton > &joystick, float deadZone) |
template<class TankType , std::enable_if_t< Robots::IsTank< TankType >::value, int > = 0> | |
void | controlWithThumbsticks (TankType &robot, JoystickBase< JAxis, JButton > &joystick) |
template<class UAVType , std::enable_if_t< Robots::IsUAV< UAVType >::value, int > = 0> | |
void | drive (UAVType &uav, const JoystickBase< JAxis, JButton > &joystick) |
template<class UAVType , std::enable_if_t< Robots::IsUAV< UAVType >::value, int > = 0> | |
void | addJoystick (UAVType &uav, JoystickBase< JAxis, JButton > &joystick) |
Classes for working with human interface devices (e.g. joysticks)
typedef JAxisWindows BoBRobotics::HID::JAxis |
JAxis is set to JAxisDummy on Dummy and JAxisWindows on Windows.
JAxis is set to JAxisLinux on Linux and JAxisWindows on Windows.
|
strong |
Controller buttons (Dummy)
The left stick and right stick are also buttons (you can click them).
|
strong |
Controller buttons (Linux)
The left stick and right stick are also buttons (you can click them).
|
strong |
Controller buttons (Windows)
The left stick and right stick are also buttons (you can click them).
void BoBRobotics::HID::addJoystick | ( | RobotType & | robot, |
JoystickBase< JAxis, JButton > & | joystick, | ||
float | deadZone = 0.25f |
||
) |
Add a handler to control a robot with a joystick.
!
Save boilerplate by writing this function generically.