|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
9 #ifndef YARP_DEV_IJOYPADCONTROLLER_H
10 #define YARP_DEV_IJOYPADCONTROLLER_H
22 #define HAT_ACTIONS_ID_SHIFT 100
28 class IJoypadController;
30 class IJoypadEventDriven;
120 virtual bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF) = 0;
129 virtual bool getButton(
unsigned int button_id,
float& value) = 0;
147 virtual bool getHat(
unsigned int hat_id,
unsigned char& value) = 0;
158 virtual bool getAxis(
unsigned int axis_id,
double& value) = 0;
212 bool EventDrivenEnabled;
229 virtual bool getRawHat(
unsigned int hat_id,
unsigned char& value) = 0;
230 virtual bool getRawAxis(
unsigned int axis_id,
double& value) = 0;
239 bool getAxisCount(
unsigned int& axis_count)
override final;
242 bool getHatCount(
unsigned int& Hat_count)
override final;
244 bool getStickCount(
unsigned int& stick_count)
override final;
245 bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF)
override final;
246 bool getButton(
unsigned int button_id,
float& value)
override final;
248 bool getHat(
unsigned int hat_id,
unsigned char& value)
override final;
249 bool getAxis(
unsigned int axis_id,
double& value)
override final;
259 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
260 #if defined(_MSC_VER) && _MSC_VER <= 1900 // VS 2015
270 void run() override final;
272 bool eventDriven(
bool enable,
yarp::dev::
IJoypadEvent* event =
nullptr) override;
273 bool isEventDriven()
override {
return EventDrivenEnabled;}
277 #define YRPJOY_HAT_CENTERED 0x00
278 #define YRPJOY_HAT_UP 0x01
279 #define YRPJOY_HAT_RIGHT 0x02
280 #define YRPJOY_HAT_DOWN 0x04
281 #define YRPJOY_HAT_LEFT 0x08
282 #define YRPJOY_HAT_RIGHTUP (YRPJOY_HAT_RIGHT|YRPJOY_HAT_UP)
283 #define YRPJOY_HAT_RIGHTDOWN (YRPJOY_HAT_RIGHT|YRPJOY_HAT_DOWN)
284 #define YRPJOY_HAT_LEFTUP (YRPJOY_HAT_LEFT |YRPJOY_HAT_UP)
285 #define YRPJOY_HAT_LEFTDOWN (YRPJOY_HAT_LEFT |YRPJOY_HAT_DOWN)
299 #endif //#define YARP_DEV_IJOYPADCONTROLLER_H
JoypadCtrl_coordinateMode
virtual bool getRawButtonCount(unsigned int &button_count)=0
bool getStickCount(unsigned int &stick_count) override final
get the number of the sticks
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
virtual bool getTrackballCount(unsigned int &Trackball_count)=0
Get number of trackballs.
virtual bool eventDriven(bool enable, yarp::dev::IJoypadEvent *event=nullptr)
Activate event Driven mode.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...)
Suppress MSVC C4251 warning for the declaration.
A base class for nested structures that can be searched.
virtual bool getRawStickDoF(unsigned int stick_id, unsigned int &DoF)=0
constexpr yarp::conf::vocab32_t VOCAB_STICKDOF
contains the definition of a Vector type
virtual bool parseActions(const yarp::os::Searchable &cfg, int *count=nullptr)
bool getTouchSurfaceCount(unsigned int &touch_count) override final
get the number of touch surface.
virtual bool getRawTouch(unsigned int touch_id, yarp::sig::Vector &value)=0
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.
virtual bool getAxis(unsigned int axis_id, double &value)=0
Get the value of an axis if present, return false otherwise.
virtual bool getAxisCount(unsigned int &axis_count)=0
Get number of Axes.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
virtual bool getButtonCount(unsigned int &button_count)=0
Get number of Buttons.
constexpr yarp::conf::vocab32_t VOCAB_TRACKBALL
virtual bool getTouchSurfaceCount(unsigned int &touch_count)=0
get the number of touch surface.
virtual bool getStickDoF(unsigned int stick_id, unsigned int &DoF)=0
Get the Degree Of Freedom count for desired stick.
bool threadInit() override final
Initialization method.
virtual bool getRawAxisCount(unsigned int &axis_count)=0
bool getHat(unsigned int hat_id, unsigned char &value) override final
Get the value of an Hat.
std::map< int, std::string > m_actions
bool getTrackballCount(unsigned int &Trackball_count) override final
Get number of trackballs.
virtual bool getStickCount(unsigned int &stick_count)=0
get the number of the sticks
virtual ~IJoypadController()
Destructor.
virtual bool getRawHatCount(unsigned int &Hat_count)=0
constexpr yarp::conf::vocab32_t VOCAB_POLAR
joyData(unsigned int id, const T &datum)
constexpr yarp::conf::vocab32_t VOCAB_BUTTON
bool getStickDoF(unsigned int stick_id, unsigned int &DoF) override final
Get the Degree Of Freedom count for desired stick.
virtual bool getButton(unsigned int button_id, float &value)=0
Get the value of a button.
virtual bool getTouch(unsigned int touch_id, yarp::sig::Vector &value)=0
Get the value of a touch if present, return false otherwise.
virtual void action(std::vector< joyData< float > > buttons, std::vector< joyData< double > > axes, std::vector< joyData< unsigned char > > hats, std::vector< joyData< yarp::sig::Vector > > trackBalls, std::vector< joyData< yarp::sig::Vector > > sticks, std::vector< joyData< yarp::sig::Vector > > Touch)=0
virtual bool getRawAxis(unsigned int axis_id, double &value)=0
constexpr yarp::conf::vocab32_t VOCAB_AXIS
constexpr yarp::conf::vocab32_t VOCAB_TOUCH
virtual bool getRawStickCount(unsigned int &stick_count)=0
virtual bool getRawTrackballCount(unsigned int &Trackball_count)=0
virtual bool executeAction(int action_id)
virtual bool getRawHat(unsigned int hat_id, unsigned char &value)=0
An abstraction for a periodic thread.
bool getHatCount(unsigned int &Hat_count) override final
Get number of Hats.
constexpr yarp::conf::vocab32_t VOCAB_CARTESIAN
constexpr yarp::conf::vocab32_t VOCAB_HAT
virtual bool getRawStick(unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode)=0
virtual bool getRawButton(unsigned int button_id, float &value)=0
bool getButtonCount(unsigned int &button_count) override final
Get number of Buttons.
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
bool getAxis(unsigned int axis_id, double &value) override final
Get the value of an axis if present, return false otherwise.
virtual bool getHat(unsigned int hat_id, unsigned char &value)=0
Get the value of an Hat.
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.
The main, catch-all namespace for YARP.
bool getTrackball(unsigned int trackball_id, yarp::sig::Vector &value) override final
Get the axes change of a Trackball.
virtual bool isEventDriven()
constexpr yarp::conf::vocab32_t VOCAB_IJOYPADCTRL
virtual bool getHatCount(unsigned int &Hat_count)=0
Get number of Hats.
bool getAxisCount(unsigned int &axis_count) override final
Get number of Axes.
virtual bool getTrackball(unsigned int trackball_id, yarp::sig::Vector &value)=0
Get the axes change of a Trackball.
bool getButton(unsigned int button_id, float &value) override final
Get the value of a button.
virtual bool getRawTrackball(unsigned int trackball_id, yarp::sig::Vector &value)=0
constexpr yarp::conf::vocab32_t VOCAB_STICK
bool getTouch(unsigned int touch_id, yarp::sig::Vector &value) override final
Get the value of a touch if present, return false otherwise.
virtual bool getRawTouchSurfaceCount(unsigned int &touch_count)=0