-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathLeapMotionSensorDevice.hpp
61 lines (40 loc) · 1.21 KB
/
LeapMotionSensorDevice.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
58
59
60
61
#ifndef __LEAP_MOTION_SENSOR_DEVICE_HPP__
#define __LEAP_MOTION_SENSOR_DEVICE_HPP__
#include "StreamingDevice.hpp"
#include <vector>
#include <kdl/frames.hpp>
#include <yarp/dev/IAnalogSensor.h>
namespace roboticslab
{
/**
* @ingroup streamingDeviceController
*
* @brief Represents a LeapMotion device wrapped as an
* analog sensor by YARP.
*/
class LeapMotionSensorDevice : public StreamingDevice
{
public:
//! Constructor
LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingPose);
bool acquireInterfaces() override;
bool initialize(bool usingStreamingPreset) override;
bool acquireData() override;
bool transformData(double scaling) override;
int getActuatorState() override;
void sendMovementCommand(double timestamp) override;
void stopMotion() override
{}
private:
yarp::dev::IAnalogSensor * iAnalogSensor;
bool usingPose;
std::vector<double> initialTcpOffset;
std::vector<double> initialLeapOffset;
KDL::Frame frame_base_leap, frame_ee_leap, frame_leap_ee;
KDL::Frame previousPose;
double previousTimestamp;
bool hasActuator;
bool grab, pinch;
};
} // namespace roboticslab
#endif // __LEAP_MOTION_SENSOR_DEVICE_HPP__