YARP
Yet Another Robot Platform
yarp::dev::IJoypadController Class Referenceabstract

#include <yarp/dev/IJoypadController.h>

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

Public Types

enum  JoypadCtrl_coordinateMode {
  JypCtrlcoord_POLAR = 0,
  JypCtrlcoord_CARTESIAN = 1
}
 

Public Member Functions

virtual ~IJoypadController ()
 Destructor. More...
 
virtual bool eventDriven (bool enable, yarp::dev::IJoypadEvent *event=nullptr)
 Activate event Driven mode. More...
 
virtual bool isEventDriven ()
 
virtual bool getAxisCount (unsigned int &axis_count)=0
 Get number of Axes. More...
 
virtual bool getButtonCount (unsigned int &button_count)=0
 Get number of Buttons. More...
 
virtual bool getTrackballCount (unsigned int &Trackball_count)=0
 Get number of trackballs. More...
 
virtual bool getHatCount (unsigned int &Hat_count)=0
 Get number of Hats. More...
 
virtual bool getTouchSurfaceCount (unsigned int &touch_count)=0
 get the number of touch surface. More...
 
virtual bool getStickCount (unsigned int &stick_count)=0
 get the number of the sticks More...
 
virtual bool getStickDoF (unsigned int stick_id, unsigned int &DoF)=0
 Get the Degree Of Freedom count for desired stick. More...
 
virtual bool getButton (unsigned int button_id, float &value)=0
 Get the value of a button. More...
 
virtual bool getTrackball (unsigned int trackball_id, yarp::sig::Vector &value)=0
 Get the axes change of a Trackball. More...
 
virtual bool getHat (unsigned int hat_id, unsigned char &value)=0
 Get the value of an Hat. More...
 
virtual bool getAxis (unsigned int axis_id, double &value)=0
 Get the value of an axis if present, return false otherwise. More...
 
virtual bool getStick (unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode)=0
 Get the value of a stick if present, return false otherwise. More...
 
virtual bool getTouch (unsigned int touch_id, yarp::sig::Vector &value)=0
 Get the value of a touch if present, return false otherwise. More...
 

Protected Member Functions

virtual bool parseActions (const yarp::os::Searchable &cfg, int *count=nullptr)
 
virtual bool executeAction (int action_id)
 

Protected Attributes

std::map< int, std::string > m_actions
 

Detailed Description

Definition at line 34 of file IJoypadController.h.

Member Enumeration Documentation

◆ JoypadCtrl_coordinateMode

Enumerator
JypCtrlcoord_POLAR 
JypCtrlcoord_CARTESIAN 

Definition at line 37 of file IJoypadController.h.

Constructor & Destructor Documentation

◆ ~IJoypadController()

virtual yarp::dev::IJoypadController::~IJoypadController ( )
inlinevirtual

Destructor.

~IJoypadController

Returns

Definition at line 52 of file IJoypadController.h.

Member Function Documentation

◆ eventDriven()

virtual bool yarp::dev::IJoypadController::eventDriven ( bool  enable,
yarp::dev::IJoypadEvent event = nullptr 
)
inlinevirtual

Activate event Driven mode.

eventDriven

Parameters
enablea bool to turn on or off the eventDriven mode
eventa pointer to a valid yarp::dev::IJoypadEvent object whom action() method will be called on event detection
Returns
true if succeeded. false otherwise

Reimplemented in yarp::dev::IJoypadEventDriven.

Definition at line 61 of file IJoypadController.h.

◆ executeAction()

bool yarp::dev::IJoypadController::executeAction ( int  action_id)
protectedvirtual

Definition at line 392 of file IJoypadController.cpp.

◆ getAxis()

virtual bool yarp::dev::IJoypadController::getAxis ( unsigned int  axis_id,
double &  value 
)
pure virtual

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

getAxis

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 yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getAxisCount()

virtual bool yarp::dev::IJoypadController::getAxisCount ( unsigned int &  axis_count)
pure virtual

Get number of Axes.

getAxisCount

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getButton()

virtual bool yarp::dev::IJoypadController::getButton ( unsigned int  button_id,
float &  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

getButton

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 yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getButtonCount()

virtual bool yarp::dev::IJoypadController::getButtonCount ( unsigned int &  button_count)
pure virtual

Get number of Buttons.

getButtonCount

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getHat()

virtual bool yarp::dev::IJoypadController::getHat ( unsigned int  hat_id,
unsigned char &  value 
)
pure virtual

Get the value of an Hat.

getHat

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 yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getHatCount()

virtual bool yarp::dev::IJoypadController::getHatCount ( unsigned int &  Hat_count)
pure virtual

Get number of Hats.

getHatsCount

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getStick()

virtual bool yarp::dev::IJoypadController::getStick ( unsigned int  stick_id,
yarp::sig::Vector value,
JoypadCtrl_coordinateMode  coordinate_mode 
)
pure virtual

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

getStick

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 (spheric in 3 dof position cases) mode
Returns
true if succeeded, false otherwise

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getStickCount()

virtual bool yarp::dev::IJoypadController::getStickCount ( unsigned int &  stick_count)
pure virtual

get the number of the sticks

getStickCount

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getStickDoF()

virtual bool yarp::dev::IJoypadController::getStickDoF ( unsigned int  stick_id,
unsigned int &  DoF 
)
pure virtual

Get the Degree Of Freedom count for desired stick.

getStickDoF

Parameters
stick_idId of the stick. must be > -1 && < getStickCount(), return false otherwise
DoFan unsigned int reference that will contain the value.
Returns
true if succeeded, false otherwise

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getTouch()

virtual bool yarp::dev::IJoypadController::getTouch ( unsigned int  touch_id,
yarp::sig::Vector value 
)
pure virtual

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

getTouch

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getTouchSurfaceCount()

virtual bool yarp::dev::IJoypadController::getTouchSurfaceCount ( unsigned int &  touch_count)
pure virtual

get the number of touch surface.

multiple touch surface can rappresent either multiple physical monotouch surface or a multitouch surface or a combination of the two

hasTouchSurface

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getTrackball()

virtual bool yarp::dev::IJoypadController::getTrackball ( unsigned int  trackball_id,
yarp::sig::Vector value 
)
pure virtual

Get the axes change of a Trackball.

getTrackball

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 yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ getTrackballCount()

virtual bool yarp::dev::IJoypadController::getTrackballCount ( unsigned int &  Trackball_count)
pure virtual

Get number of trackballs.

getTrackballCount

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

Implemented in yarp::dev::IJoypadEventDriven, and yarp::dev::OVRHeadset.

◆ isEventDriven()

virtual bool yarp::dev::IJoypadController::isEventDriven ( )
inlinevirtual

Reimplemented in yarp::dev::IJoypadEventDriven.

Definition at line 62 of file IJoypadController.h.

◆ parseActions()

bool yarp::dev::IJoypadController::parseActions ( const yarp::os::Searchable cfg,
int *  count = nullptr 
)
protectedvirtual

Definition at line 407 of file IJoypadController.cpp.

Member Data Documentation

◆ m_actions

std::map<int, std::string> yarp::dev::IJoypadController::m_actions
protected

Definition at line 40 of file IJoypadController.h.


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