yarp-devices
Loading...
Searching...
No Matches
LeapMotionSensor.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __LEAP_MOTION_SENSOR_HPP__
4#define __LEAP_MOTION_SENSOR_HPP__
5
6#include <Leap.h>
7
8#include <yarp/dev/DeviceDriver.h>
9#include <yarp/dev/IAnalogSensor.h>
10
11#include <yarp/sig/Vector.h>
12
30class LeapMotionSensor : public yarp::dev::DeprecatedDeviceDriver,
31 public yarp::dev::IAnalogSensor
32{
33public:
34 // --------- DeviceDriver Declarations. Implementation in DeviceDriverImpl.cpp ---------
35 bool open(yarp::os::Searchable& config) override;
36 bool close() override;
37
38 // --------- IAnalogSensor Declarations. Implementation in IAnalogSensorImpl.cpp ---------
39 int read(yarp::sig::Vector &out) override;
40 int getState(int ch) override;
41 int getChannels() override;
42 int calibrateSensor() override;
43 int calibrateSensor(const yarp::sig::Vector& value) override;
44 int calibrateChannel(int ch) override;
45 int calibrateChannel(int ch, double value) override;
46
47private:
48 Leap::Controller * controller {nullptr};
49 int32_t currentHandId {0};
50 yarp::sig::Vector lastValidData;
51};
52
53#endif // __LEAP_MOTION_SENSOR_HPP__
Implementation for the LeapMotionSensor controller.
Definition LeapMotionSensor.hpp:32