YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::dev::IJoypadController Class Referenceabstract

#include <yarp/dev/IJoypadController.h>

+ Inheritance diagram for yarp::dev::IJoypadController:

Public Types

enum class  JoypadCtrl_coordinateMode {
  JypCtrlcoord_POLAR = 0 ,
  JypCtrlcoord_CARTESIAN = 1
}
 

Public Member Functions

virtual ~IJoypadController ()
 Destructor.
 
virtual yarp::dev::ReturnValue getAxisCount (size_t &axis_count)=0
 Get number of axes.
 
virtual yarp::dev::ReturnValue getButtonCount (size_t &button_count)=0
 Get number of buttons.
 
virtual yarp::dev::ReturnValue getTrackballCount (size_t &Trackball_count)=0
 Get number of trackballs.
 
virtual yarp::dev::ReturnValue getHatCount (size_t &Hat_count)=0
 Get number of hats.
 
virtual yarp::dev::ReturnValue getTouchSurfaceCount (size_t &touch_count)=0
 Get the number of touch surface.
 
virtual yarp::dev::ReturnValue getStickCount (size_t &stick_count)=0
 Get the number of the sticks.
 
virtual yarp::dev::ReturnValue getButton (size_t button_id, double &value)=0
 Get the value of a button.
 
virtual yarp::dev::ReturnValue getTrackball (size_t trackball_id, yarp::dev::TrackballData &value)=0
 Get the axes change of a Trackball.
 
virtual yarp::dev::ReturnValue getHat (size_t hat_id, unsigned char &value)=0
 Get the value of an Hat.
 
virtual yarp::dev::ReturnValue getAxis (size_t axis_id, double &value)=0
 Get the value of an axis if present, return false otherwise.
 
virtual yarp::dev::ReturnValue getAllAxes (std::vector< double > &values)
 Get the values of all available joystick axes.
 
virtual yarp::dev::ReturnValue getStick (size_t stick_id, yarp::dev::StickData &value, JoypadCtrl_coordinateMode coordinate_mode)=0
 Get the value of a stick if present, return false otherwise.
 
virtual yarp::dev::ReturnValue getTouch (size_t touch_id, std::vector< yarp::dev::TouchData > &value)=0
 Get the value of a touch if present, return false otherwise.
 

Detailed Description

Definition at line 24 of file IJoypadController.h.

Member Enumeration Documentation

◆ JoypadCtrl_coordinateMode

Enumerator
JypCtrlcoord_POLAR 
JypCtrlcoord_CARTESIAN 

Definition at line 27 of file IJoypadController.h.

Constructor & Destructor Documentation

◆ ~IJoypadController()

IJoypadController::~IJoypadController ( )
virtualdefault

Destructor.

Member Function Documentation

◆ getAllAxes()

ReturnValue IJoypadController::getAllAxes ( std::vector< double > &  values)
virtual

Get the values of all available joystick axes.

Parameters
valuesthe vector containing the axes values.
Returns
true if succeeded, false otherwise.

Reimplemented in JoypadControl_nwc_yarp.

Definition at line 12 of file IJoypadController.cpp.

◆ getAxis()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getAxis ( size_t  axis_id,
double &  value 
)
pure virtual

Get the value of an axis if present, return false otherwise.

Parameters
axis_idId of the axis to get. must be > -1 && < getAxisCount(), return false otherwise.
valuereference to be valued. the absolute boundaries for the values should be -1.0 and 1.0 However the actual range depends on the physical device (example: analog trigger does not have a central position thus can give a value from 0.0 to 0.1).
Returns
true if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getAxisCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getAxisCount ( size_t &  axis_count)
pure virtual

Get number of axes.

Parameters
axes_countunsigned int reference that will contain the result.
Returns
true if succeeded. false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getButton()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getButton ( size_t  button_id,
double &  value 
)
pure virtual

Get the value of a button.

From 0-unpressed to 1-fullpressed and values in the middle in the analog-face-button case.

Parameters
button_idId of the button to get. Must be > -1 && < getButtonCount(), return false otherwise
valuereference to be valued. The value will be from 0.0 (not even touched) to 1.0 (fully pressed)
Returns
true if succeeded, false otherwise

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getButtonCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getButtonCount ( size_t &  button_count)
pure virtual

Get number of buttons.

Parameters
button_countunsigned int reference that will contain the result.
Returns
true if succeeded. false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getHat()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getHat ( size_t  hat_id,
unsigned char &  value 
)
pure virtual

Get the value of an Hat.

Parameters
hat_idId of the POV hat to get. Must be > -1 && < getHatCount(), return false otherwise.
valuereference to be valued. use the YRPJOY_HAT_ macro series to get the currently pressed directions.
Returns
true if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getHatCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getHatCount ( size_t &  Hat_count)
pure virtual

Get number of hats.

Parameters
Hat_countunsigned int reference that will contain the result.
Returns
true if succeeded. false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getStick()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getStick ( size_t  stick_id,
yarp::dev::StickData &  value,
JoypadCtrl_coordinateMode  coordinate_mode 
)
pure virtual

Get the value of a stick if present, return false otherwise.

Parameters
stick_idId of the stick to get. must be > -1 && < getStickCount(), return false otherwise.
valuea vector that will contain the joystick position. the size of the vector will give you the Number of degrees of freedom and the value will be from -1.0 to 1.0.
coordinate_modeto get data in cartesian mode or polar mode.
Returns
true if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getStickCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getStickCount ( size_t &  stick_count)
pure virtual

Get the number of the sticks.

Parameters
stick_countunsigned int reference that will contain the result.
Returns
bool if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getTouch()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getTouch ( size_t  touch_id,
std::vector< yarp::dev::TouchData > &  value 
)
pure virtual

Get the value of a touch if present, return false otherwise.

Parameters
valuea vector that will contain the touch values normalized from 0.0 to 1.0.
Returns
true if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getTouchSurfaceCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getTouchSurfaceCount ( size_t &  touch_count)
pure virtual

Get the number of touch surface.

Multiple touch surface can represent either multiple physical monotouch surface or a multitouch surface or a combination of the two.

Parameters
touch_countunsigned int reference that will contain the result.
Returns
true if succeeded. false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getTrackball()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getTrackball ( size_t  trackball_id,
yarp::dev::TrackballData &  value 
)
pure virtual

Get the axes change of a Trackball.

Parameters
trackball_idId of the Trackball to get. Must be > -1 && < getTrackballCount(), return false otherwise.
valuereference to be valued. the value will be from 0.0 (not moving) to 1.0 (full velocity).
Returns
true if succeeded, false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.

◆ getTrackballCount()

virtual yarp::dev::ReturnValue yarp::dev::IJoypadController::getTrackballCount ( size_t &  Trackball_count)
pure virtual

Get number of trackballs.

Parameters
Trackball_countunsigned int reference that will contain the result.
Returns
true if succeeded. false otherwise.

Implemented in FakeJoypad, JoypadControl_nwc_yarp, and SDLJoypad.


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