kinematics-dynamics
LeapMotionSensorDevice.hpp
1 #ifndef __LEAP_MOTION_SENSOR_DEVICE_HPP__
2 #define __LEAP_MOTION_SENSOR_DEVICE_HPP__
3 
4 #include "StreamingDevice.hpp"
5 
6 #include <vector>
7 
8 #include <kdl/frames.hpp>
9 
10 #include <yarp/dev/IAnalogSensor.h>
11 
12 namespace roboticslab
13 {
14 
22 {
23 public:
25  LeapMotionSensorDevice(yarp::os::Searchable & config, bool usingPose);
26 
27  bool acquireInterfaces() override;
28 
29  bool initialize(bool usingStreamingPreset) override;
30 
31  bool acquireData() override;
32 
33  bool transformData(double scaling) override;
34 
35  int getActuatorState() override;
36 
37  void sendMovementCommand(double timestamp) override;
38 
39  void stopMotion() override
40  {}
41 
42 private:
43  yarp::dev::IAnalogSensor * iAnalogSensor;
44 
45  bool usingPose;
46 
47  std::vector<double> initialTcpOffset;
48  std::vector<double> initialLeapOffset;
49 
50  KDL::Frame frame_base_leap, frame_ee_leap, frame_leap_ee;
51 
52  KDL::Frame previousPose;
53  double previousTimestamp;
54 
55  bool hasActuator;
56  bool grab, pinch;
57 };
58 
59 } // namespace roboticslab
60 
61 #endif // __LEAP_MOTION_SENSOR_DEVICE_HPP__
Represents a LeapMotion device wrapped as an analog sensor by YARP.
Definition: LeapMotionSensorDevice.hpp:22
void sendMovementCommand(double timestamp) override
Sends movement command to the cartesian controller.
Definition: LeapMotionSensorDevice.cpp:212
LeapMotionSensorDevice(yarp::os::Searchable &config, bool usingPose)
Constructor.
Definition: LeapMotionSensorDevice.cpp:18
bool transformData(double scaling) override
Performs required operations on stored data.
Definition: LeapMotionSensorDevice.cpp:141
bool initialize(bool usingStreamingPreset) override
Perform any custom initialization needed. This method is called after the successful creation of the ...
Definition: LeapMotionSensorDevice.cpp:59
int getActuatorState() override
If actuator command data is available, return its current state.
Definition: LeapMotionSensorDevice.cpp:178
bool acquireInterfaces() override
Acquires plugin interfaces.
Definition: LeapMotionSensorDevice.cpp:46
void stopMotion() override
Sends a movement command that would stop motion.
Definition: LeapMotionSensorDevice.hpp:39
bool acquireData() override
Acquires data from remote device.
Definition: LeapMotionSensorDevice.cpp:107
Abstract class for a YARP streaming device.
Definition: StreamingDevice.hpp:46
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6