-
Notifications
You must be signed in to change notification settings - Fork 14
/
WiimoteSensorDevice.hpp
57 lines (37 loc) · 1.08 KB
/
WiimoteSensorDevice.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __WIIMOTE_SENSOR_DEVICE_HPP__
#define __WIIMOTE_SENSOR_DEVICE_HPP__
#include "StreamingDevice.hpp"
#include <vector>
#include <yarp/os/Value.h>
#include <yarp/dev/IAnalogSensor.h>
#define DEFAULT_STEP 0.01
namespace roboticslab
{
/**
* @ingroup streamingDeviceController
*
* @brief Represents a Wiimote device wrapped as an
* analog sensor by YARP.
*/
class WiimoteSensorDevice : public StreamingDevice
{
public:
//! Constructor
WiimoteSensorDevice(yarp::os::Searchable & config, bool usingPose);
bool acquireInterfaces() override;
bool initialize(bool usingStreamingPreset) override;
bool acquireData() override;
bool transformData(double scaling) override;
bool hasValidMovementData() const override;
void sendMovementCommand(double timestamp) override;
void stopMotion() override;
private:
enum cmd_mode { NONE, FWD, BKWD, ROT };
yarp::dev::IAnalogSensor * iAnalogSensor;
cmd_mode mode;
std::vector<double> buffer;
bool usingPose;
double step;
};
} // namespace roboticslab
#endif // __WIIMOTE_SENSOR_DEVICE_HPP__