yarp-devices
Loading...
Searching...
No Matches
TextilesHand.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __TEXTILES_HAND_HPP__
4#define __TEXTILES_HAND_HPP__
5
6#include <yarp/conf/version.h>
7
8#include <yarp/dev/PolyDriver.h>
9#include <yarp/dev/DeviceDriver.h>
10#include <yarp/dev/IControlMode.h>
11#include <yarp/dev/IPositionDirect.h>
12#include <yarp/dev/ISerialDevice.h>
13
14#include "TextilesHand_ParamsParser.h"
15
26class TextilesHand : public yarp::dev::DeviceDriver,
27 public yarp::dev::IControlMode,
28 public yarp::dev::IPositionDirect,
30{
31public:
32 // --------- DeviceDriver Declarations. Implementation in DeviceDriverImpl.cpp ---------
33
34 bool open(yarp::os::Searchable & config) override;
35 bool close() override;
36
37 // --------- IControlMode Declarations. Implementation in IControlModeImpl.cpp ---------
38
39#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
40 yarp::dev::ReturnValue getAvailableControlModes(int j, std::vector<yarp::dev::SelectableControlModeEnum> & avail) override;
41 yarp::dev::ReturnValue getControlMode(int j, yarp::dev::ControlModeEnum & mode) override;
42 yarp::dev::ReturnValue getControlModes(std::vector<yarp::dev::ControlModeEnum> & modes) override;
43 yarp::dev::ReturnValue getControlModes(const std::vector<int> & joints, std::vector<yarp::dev::ControlModeEnum> & modes) override;
44 yarp::dev::ReturnValue setControlMode(int j, yarp::dev::SelectableControlModeEnum mode) override;
45 yarp::dev::ReturnValue setControlModes(const std::vector<int> & joints, const std::vector<yarp::dev::SelectableControlModeEnum> & modes) override;
46 yarp::dev::ReturnValue setControlModes(const std::vector<yarp::dev::SelectableControlModeEnum> & modes) override;
47#else
48 bool getControlMode(int j, int * mode) override;
49 bool getControlModes(int * modes) override;
50 bool getControlModes(int n_joint, const int * joints, int * modes) override;
51 bool setControlMode(int j, const int mode) override;
52 bool setControlModes(int n_joint, const int * joints, int * modes) override;
53 bool setControlModes(int * modes) override;
54#endif
55
56 // ------- IPositionDirect declarations. Implementation in IPositionDirectImpl.cpp -------
57
58#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
59 yarp::dev::ReturnValue getAxes(std::size_t & ax) override;
60 yarp::dev::ReturnValue setPosition(int j, double ref) override;
61 yarp::dev::ReturnValue setPositions(int n_joint, const int * joints, const double * refs) override;
62 yarp::dev::ReturnValue setPositions(const double * refs) override;
63 yarp::dev::ReturnValue getRefPosition(int joint, double * ref) override;
64 yarp::dev::ReturnValue getRefPositions(double * refs) override;
65 yarp::dev::ReturnValue getRefPositions(int n_joint, const int * joints, double * refs) override;
66#else
67 bool getAxes(int * ax) override;
68 bool setPosition(int j, double ref) override;
69 bool setPositions(const double * refs) override;
70 bool setPositions(int n_joint, const int * joints, const double * refs) override;
71 bool getRefPosition(int joint, double * ref) override;
72 bool getRefPositions(double * refs) override;
73 bool getRefPositions(int n_joint, const int * joints, double * refs) override;
74#endif
75
76private:
77 double lastTarget {0.0};
78
79 yarp::dev::PolyDriver serialDevice;
80 yarp::dev::ISerialDevice * iSerialDevice {nullptr};
81};
82
83#endif // __TEXTILES_HAND_HPP__
Definition TextilesHand_ParamsParser.h:42
Implementation for the custom UC3M Textiles Hand as a single CAN bus joint (control board raw interfa...
Definition TextilesHand.hpp:30