kinematics-dynamics
Loading...
Searching...
No Matches
WiimoteSensorDevice.hpp
1#ifndef __WIIMOTE_SENSOR_DEVICE_HPP__
2#define __WIIMOTE_SENSOR_DEVICE_HPP__
3
4#include "StreamingDevice.hpp"
5
6#include <vector>
7
8#include <yarp/os/Value.h>
9#include <yarp/dev/IAnalogSensor.h>
10
11#define DEFAULT_STEP 0.01
12
13namespace roboticslab
14{
15
23{
24public:
26 WiimoteSensorDevice(yarp::os::Searchable & config, bool usingPose);
27
28 bool acquireInterfaces() override;
29
30 bool initialize(bool usingStreamingPreset) override;
31
32 bool acquireData() override;
33
34 bool transformData(double scaling) override;
35
36 bool hasValidMovementData() const override;
37
38 void sendMovementCommand(double timestamp) override;
39
40 void stopMotion() override;
41
42private:
43 enum cmd_mode { NONE, FWD, BKWD, ROT };
44
45 yarp::dev::IAnalogSensor * iAnalogSensor;
46
47 cmd_mode mode;
48
49 std::vector<double> buffer;
50
51 bool usingPose;
52 double step;
53};
54
55} // namespace roboticslab
56
57#endif // __WIIMOTE_SENSOR_DEVICE_HPP__
Abstract class for a YARP streaming device.
Definition StreamingDevice.hpp:46
Represents a Wiimote device wrapped as an analog sensor by YARP.
Definition WiimoteSensorDevice.hpp:23
void sendMovementCommand(double timestamp) override
Sends movement command to the cartesian controller.
Definition WiimoteSensorDevice.cpp:132
bool hasValidMovementData() const override
Checks whether the device may forward acquired and processed data to the controller.
Definition WiimoteSensorDevice.cpp:127
bool transformData(double scaling) override
Performs required operations on stored data.
Definition WiimoteSensorDevice.cpp:87
bool initialize(bool usingStreamingPreset) override
Perform any custom initialization needed. This method is called after the successful creation of the ...
Definition WiimoteSensorDevice.cpp:38
bool acquireInterfaces() override
Acquires plugin interfaces.
Definition WiimoteSensorDevice.cpp:25
void stopMotion() override
Sends a movement command that would stop motion.
Definition WiimoteSensorDevice.cpp:162
bool acquireData() override
Acquires data from remote device.
Definition WiimoteSensorDevice.cpp:66
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6