YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
JoypadControlClient.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
9#include <vector>
12
13#define DEFAULT_THREAD_PERIOD 10
14
17{
18public:
20 virtual ~JoypadControlWatchdog() = default;
21
22
23 std::vector<JoypadControl::LoopablePort*> m_ports;
24 void run() override;
25
26};
27
41{
42private:
43 //---------------utils
44 template<typename T>
48
49 //---------------properties
50 yarp::os::Port m_rpcPort;
51 JOYPORT<Vector> m_buttonsPort;
52 JOYPORT<Vector> m_axisPort;
53 JOYPORT<Vector> m_trackballPort;
54 JOYPORT<Vector> m_touchPort;
55 JOYPORT<CharVector> m_hatsPort;
56 JOYPORT<Vector> m_stickPort;
57 std::vector<size_t> m_stickDof;
58 bool m_rpc_only;
59
60 JoypadControlWatchdog watchdog;
61 std::vector<JoypadControl::LoopablePort*> m_ports;
62
63 //--------------method
64 bool getCount(const int& vocab_toget, unsigned int& value);
65 bool getJoypadInfo();
66
67public:
73 ~JoypadControlClient() override = default;
74
75 //rateThread
76
77 //DeviceDriver
78 bool open(yarp::os::Searchable& config) override;
79 bool close() override;
80
81 //IJoypadController;
82 bool getRawAxisCount(unsigned int& axis_count) override;
83 bool getRawButtonCount(unsigned int& button_count) override;
84 bool getRawTrackballCount(unsigned int& Trackball_count) override;
85 bool getRawHatCount(unsigned int& Hat_count) override;
86 bool getRawTouchSurfaceCount(unsigned int& touch_count) override;
87 bool getRawStickCount(unsigned int& stick_count) override;
88 bool getRawStickDoF(unsigned int stick_id, unsigned int& DoF) override;
89 bool getRawButton(unsigned int button_id, float& value) override;
90 bool getRawTrackball(unsigned int trackball_id, yarp::sig::Vector& value) override;
91 bool getRawHat(unsigned int hat_id, unsigned char& value) override;
92 bool getRawAxis(unsigned int axis_id, double& value) override;
93 bool getRawStick(unsigned int stick_id, yarp::sig::Vector& value, JoypadCtrl_coordinateMode coordinate_mode) override;
94 bool getRawTouch(unsigned int touch_id, yarp::sig::Vector& value) override;
95};
This class is the parameters parser for class JoypadControlClient.
JoypadControlClient: joypad input network wrapper on client side
JoypadControlClient(JoypadControlClient &&)=delete
bool getRawAxisCount(unsigned int &axis_count) override
bool getRawHatCount(unsigned int &Hat_count) override
JoypadControlClient & operator=(JoypadControlClient &&)=delete
bool getRawButtonCount(unsigned int &button_count) override
JoypadControlClient(const JoypadControlClient &)=delete
bool getRawTrackballCount(unsigned int &Trackball_count) override
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
JoypadControlClient & operator=(const JoypadControlClient &)=delete
~JoypadControlClient() override=default
bool getRawButton(unsigned int button_id, float &value) override
bool getRawHat(unsigned int hat_id, unsigned char &value) override
bool getRawStickDoF(unsigned int stick_id, unsigned int &DoF) override
bool close() override
Close the DeviceDriver.
bool getRawStickCount(unsigned int &stick_count) override
bool getRawStick(unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode) override
bool getRawTrackball(unsigned int trackball_id, yarp::sig::Vector &value) override
bool getRawTouch(unsigned int touch_id, yarp::sig::Vector &value) override
bool getRawTouchSurfaceCount(unsigned int &touch_count) override
bool getRawAxis(unsigned int axis_id, double &value) override
virtual ~JoypadControlWatchdog()=default
void run() override
Loop function.
std::vector< JoypadControl::LoopablePort * > m_ports
Interface implemented by all device drivers.
An abstraction for a periodic thread.
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative)
Constructor.
A mini-server for network communication.
Definition Port.h:46
A base class for nested structures that can be searched.
Definition Searchable.h:31