YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IJoypadController.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEV_IJOYPADCONTROLLER_H
7#define YARP_DEV_IJOYPADCONTROLLER_H
8
9#include <yarp/sig/Vector.h>
10#include <yarp/dev/api.h>
13#include <yarp/dev/TouchData.h>
14#include <yarp/dev/StickData.h>
15#include <vector>
16#include <string>
17
18#define HAT_ACTIONS_ID_SHIFT 100
19
20namespace yarp::dev {
21class IJoypadController;
22}
23
25{
26public:
27 enum class JoypadCtrl_coordinateMode {JypCtrlcoord_POLAR = 0, JypCtrlcoord_CARTESIAN = 1};
28
29public:
30
35
42 virtual yarp::dev::ReturnValue getAxisCount(size_t& axis_count) = 0;
43
50 virtual yarp::dev::ReturnValue getButtonCount(size_t& button_count) = 0;
51
58 virtual yarp::dev::ReturnValue getTrackballCount(size_t& Trackball_count) = 0;
59
66 virtual yarp::dev::ReturnValue getHatCount(size_t& Hat_count) = 0;
67
77 virtual yarp::dev::ReturnValue getTouchSurfaceCount(size_t& touch_count) = 0;
78
85 virtual yarp::dev::ReturnValue getStickCount(size_t& stick_count) = 0;
86
97 virtual yarp::dev::ReturnValue getButton(size_t button_id, double& value) = 0;
98
106 virtual yarp::dev::ReturnValue getTrackball(size_t trackball_id, yarp::dev::TrackballData& value) = 0;
107
115 virtual yarp::dev::ReturnValue getHat(size_t hat_id, unsigned char& value) = 0;
116
126 virtual yarp::dev::ReturnValue getAxis(size_t axis_id, double& value) = 0;
127
134 virtual yarp::dev::ReturnValue getAllAxes(std::vector<double>& values);
135
145 virtual yarp::dev::ReturnValue getStick(size_t stick_id, yarp::dev::StickData& value, JoypadCtrl_coordinateMode coordinate_mode) = 0;
146
153 virtual yarp::dev::ReturnValue getTouch(size_t touch_id, std::vector<yarp::dev::TouchData>& value) = 0;
154};
155
156#define YRPJOY_HAT_CENTERED 0x00
157#define YRPJOY_HAT_UP 0x01
158#define YRPJOY_HAT_RIGHT 0x02
159#define YRPJOY_HAT_DOWN 0x04
160#define YRPJOY_HAT_LEFT 0x08
161#define YRPJOY_HAT_RIGHTUP (YRPJOY_HAT_RIGHT|YRPJOY_HAT_UP)
162#define YRPJOY_HAT_RIGHTDOWN (YRPJOY_HAT_RIGHT|YRPJOY_HAT_DOWN)
163#define YRPJOY_HAT_LEFTUP (YRPJOY_HAT_LEFT |YRPJOY_HAT_UP)
164#define YRPJOY_HAT_LEFTDOWN (YRPJOY_HAT_LEFT |YRPJOY_HAT_DOWN)
165
166#endif //#define YARP_DEV_IJOYPADCONTROLLER_H
contains the definition of a Vector type
virtual yarp::dev::ReturnValue getTouchSurfaceCount(size_t &touch_count)=0
Get the number of touch surface.
virtual yarp::dev::ReturnValue getAxisCount(size_t &axis_count)=0
Get number of axes.
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.
virtual ~IJoypadController()
Destructor.
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 getAllAxes(std::vector< double > &values)
Get the values of all available joystick axes.
virtual yarp::dev::ReturnValue getButton(size_t button_id, double &value)=0
Get the value of a button.
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 getHat(size_t hat_id, unsigned char &value)=0
Get the value of an Hat.
virtual yarp::dev::ReturnValue getButtonCount(size_t &button_count)=0
Get number of buttons.
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 getStickCount(size_t &stick_count)=0
Get the number of the sticks.
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.
For streams capable of holding different kinds of content, check what they actually have.
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_dev_API
Definition api.h:18