YARP
Yet Another Robot Platform

SDLJoypad: Device that reads inputs of Joypads compatible with the SDL library. More...

#include <SDLJoypad/SDLJoypad.h>

+ Inheritance diagram for SDLJoypad:

Public Member Functions

 SDLJoypad ()
 
virtual ~SDLJoypad ()
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
bool getRawAxisCount (unsigned int &axis_count) override
 
bool getRawButtonCount (unsigned int &button_count) override
 
bool getRawHatCount (unsigned int &hat_count) override
 
bool getRawTrackballCount (unsigned int &trackball_count) override
 
bool getRawTouchSurfaceCount (unsigned int &touch_count) override
 
bool getRawStickCount (unsigned int &stick_count) override
 
bool getRawStickDoF (unsigned int stick_id, unsigned int &DoF) override
 
bool getRawButton (unsigned int button_id, float &value) override
 
bool getRawTrackball (unsigned int trackball_id, yarp::sig::Vector &value) override
 
bool getRawHat (unsigned int hat_id, unsigned char &value) override
 
bool getRawAxis (unsigned int axis_id, double &value) override
 
bool getRawStick (unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode) override
 
bool getRawTouch (unsigned int touch_id, yarp::sig::Vector &value) override
 
- Public Member Functions inherited from yarp::dev::IJoypadEventDriven
bool getAxisCount (unsigned int &axis_count) override final
 Get number of Axes. More...
 
bool getButtonCount (unsigned int &button_count) override final
 Get number of Buttons. More...
 
bool getTrackballCount (unsigned int &Trackball_count) override final
 Get number of trackballs. More...
 
bool getHatCount (unsigned int &Hat_count) override final
 Get number of Hats. More...
 
bool getTouchSurfaceCount (unsigned int &touch_count) override final
 get the number of touch surface. More...
 
bool getStickCount (unsigned int &stick_count) override final
 get the number of the sticks More...
 
bool getStickDoF (unsigned int stick_id, unsigned int &DoF) override final
 Get the Degree Of Freedom count for desired stick. More...
 
bool getButton (unsigned int button_id, float &value) override final
 Get the value of a button. More...
 
bool getTrackball (unsigned int trackball_id, yarp::sig::Vector &value) override final
 Get the axes change of a Trackball. More...
 
bool getHat (unsigned int hat_id, unsigned char &value) override final
 Get the value of an Hat. More...
 
bool getAxis (unsigned int axis_id, double &value) override final
 Get the value of an axis if present, return false otherwise. More...
 
bool getStick (unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode) override final
 Get the value of a stick if present, return false otherwise. More...
 
bool getTouch (unsigned int touch_id, yarp::sig::Vector &value) override final
 Get the value of a touch if present, return false otherwise. More...
 
 IJoypadEventDriven ()
 
 IJoypadEventDriven (int rate)
 
 IJoypadEventDriven (double period)
 
bool threadInit () override final
 Initialization method. More...
 
void run () override final
 Loop function. More...
 
bool eventDriven (bool enable, yarp::dev::IJoypadEvent *event=nullptr) override
 Activate event Driven mode. More...
 
bool isEventDriven () override
 
- Public Member Functions inherited from yarp::dev::IJoypadController
virtual ~IJoypadController ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 ~DeviceDriver () override=default
 Destructor. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 

Additional Inherited Members

- Public Types inherited from yarp::dev::IJoypadEventDriven
enum  JoypadCtrl_coordinateMode
 
- Public Types inherited from yarp::dev::IJoypadController
enum  JoypadCtrl_coordinateMode {
  JypCtrlcoord_POLAR = 0,
  JypCtrlcoord_CARTESIAN = 1
}
 
- Protected Member Functions inherited from yarp::dev::IJoypadEventDriven
virtual bool executeAction (int action_id)
 
virtual bool parseActions (const yarp::os::Searchable &cfg, int *count=nullptr)
 
- Protected Member Functions inherited from yarp::dev::IJoypadController
virtual bool parseActions (const yarp::os::Searchable &cfg, int *count=nullptr)
 
virtual bool executeAction (int action_id)
 
- Protected Attributes inherited from yarp::dev::IJoypadEventDriven
std::map< int, std::string > m_actions
 
- Protected Attributes inherited from yarp::dev::IJoypadController
std::map< int, std::string > m_actions
 

Detailed Description

SDLJoypad: Device that reads inputs of Joypads compatible with the SDL library.

Description of input parameters

Parameters accepted in the config argument of the open method:

Parameter name Type Units Default Value Required Description Notes
UseAllJoypadAsOne string if there are more than one joypad connected merge together multiple joypad set it to 1 to have all the connected joypad as one
DefaultJoystickNumber string will be asked No select the id of the joypad to use important if there are more than one joypad and UseAllJoypadAsOne is set to 0. if not present, a input will be requested to the user
sticks int Yes count of sticks to configure for each stick there must be a group called STICK<id here> with data on the axis to be configured as stickl
STICK[ID] group depending on 'sticks' parameter group containing axes data for this stick
axes int yes axes count for this stick set it for each stick in the proper stick group
axis[ID]_id int depending on axes parameter axis id for current stick related axis set it for each stick in the proper stick group
invert_axis_[ID] bool false no invert the current axis set it for each stick in the proper stick group
deadZone double 0.0 yes set the deadzone for this stick set it for each stick in the proper stick group

Definition at line 61 of file SDLJoypad.h.

Constructor & Destructor Documentation

◆ SDLJoypad()

SDLJoypad::SDLJoypad ( )
default

◆ ~SDLJoypad()

SDLJoypad::~SDLJoypad ( )
virtualdefault

Member Function Documentation

◆ close()

bool SDLJoypad::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 262 of file SDLJoypad.cpp.

◆ getRawAxis()

bool SDLJoypad::getRawAxis ( unsigned int  axis_id,
double &  value 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 363 of file SDLJoypad.cpp.

◆ getRawAxisCount()

bool SDLJoypad::getRawAxisCount ( unsigned int &  axis_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 267 of file SDLJoypad.cpp.

◆ getRawButton()

bool SDLJoypad::getRawButton ( unsigned int  button_id,
float &  value 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 314 of file SDLJoypad.cpp.

◆ getRawButtonCount()

bool SDLJoypad::getRawButtonCount ( unsigned int &  button_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 273 of file SDLJoypad.cpp.

◆ getRawHat()

bool SDLJoypad::getRawHat ( unsigned int  hat_id,
unsigned char &  value 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 410 of file SDLJoypad.cpp.

◆ getRawHatCount()

bool SDLJoypad::getRawHatCount ( unsigned int &  hat_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 285 of file SDLJoypad.cpp.

◆ getRawStick()

bool SDLJoypad::getRawStick ( unsigned int  stick_id,
yarp::sig::Vector value,
JoypadCtrl_coordinateMode  coordinate_mode 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 379 of file SDLJoypad.cpp.

◆ getRawStickCount()

bool SDLJoypad::getRawStickCount ( unsigned int &  stick_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 297 of file SDLJoypad.cpp.

◆ getRawStickDoF()

bool SDLJoypad::getRawStickDoF ( unsigned int  stick_id,
unsigned int &  DoF 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 303 of file SDLJoypad.cpp.

◆ getRawTouch()

bool SDLJoypad::getRawTouch ( unsigned int  touch_id,
yarp::sig::Vector value 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 405 of file SDLJoypad.cpp.

◆ getRawTouchSurfaceCount()

bool SDLJoypad::getRawTouchSurfaceCount ( unsigned int &  touch_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 291 of file SDLJoypad.cpp.

◆ getRawTrackball()

bool SDLJoypad::getRawTrackball ( unsigned int  trackball_id,
yarp::sig::Vector value 
)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 432 of file SDLJoypad.cpp.

◆ getRawTrackballCount()

bool SDLJoypad::getRawTrackballCount ( unsigned int &  trackball_count)
overridevirtual

Implements yarp::dev::IJoypadEventDriven.

Definition at line 279 of file SDLJoypad.cpp.

◆ open()

bool SDLJoypad::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 44 of file SDLJoypad.cpp.


The documentation for this class was generated from the following files: