yarp-devices
Loading...
Searching...
No Matches
TechnosoftIposEmbedded.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __TECHNOSOFT_IPOS_EMBEDDED_HPP__
4#define __TECHNOSOFT_IPOS_EMBEDDED_HPP__
5
6#include <atomic>
7#include <bitset>
8
9#include "TechnosoftIposBase.hpp"
10#include "embedded-pid/InterpolatedPositionBuffer.hpp"
11
12namespace roboticslab
13{
14
20{
21public:
22 using TechnosoftIposBase::TechnosoftIposBase;
23
24 // --------- DeviceDriver declarations. Implementation in DeviceDriverImpl.cpp ---------
25
26 bool open(yarp::os::Searchable & config) override;
27 bool close() override;
28
29 // --------- ICanBusSharer declarations. Implementation in ICanBusSharerImpl.cpp ---------
30
31 bool synchronize(double timestamp) override;
32
33 // --------- IControlModeRaw declarations. Implementation in IControlModeRawImpl.cpp ---------
34
35#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
36 return_t getAvailableControlModesRaw(int j, std::vector<yarp::dev::SelectableControlModeEnum> & avail) override;
37 return_t getControlModeRaw(int j, yarp::dev::ControlModeEnum & mode) override;
38 return_t setControlModeRaw(int j, yarp::dev::SelectableControlModeEnum mode) override;
39#else
40 return_t getControlModeRaw(int j, int * mode) override;
41 return_t setControlModeRaw(int j, int mode) override;
42#endif
43
44 // ------- IPositionControlRaw declarations. Implementation in IPositionControlRawImpl.cpp -------
45
46 return_t positionMoveRaw(int j, double ref) override;
47 return_t relativeMoveRaw(int j, double delta) override;
48#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
49 return_t checkMotionDoneRaw(int j, bool & flag) override;
50 return_t setTrajSpeedRaw(int j, double sp) override;
51 return_t setTrajAccelerationRaw(int j, double acc) override;
52 return_t getTrajSpeedRaw(int j, double * ref) override;
53 return_t getTrajAccelerationRaw(int j, double * acc) override;
54#else
55 return_t checkMotionDoneRaw(int j, bool * flag) override;
56 return_t setRefSpeedRaw(int j, double sp) override;
57 return_t setRefAccelerationRaw(int j, double acc) override;
58 return_t getRefSpeedRaw(int j, double * ref) override;
59 return_t getRefAccelerationRaw(int j, double * acc) override;
60#endif
61 return_t stopRaw(int j) override;
62 return_t getTargetPositionRaw(int joint, double * ref) override;
63
64 // ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
65
66 return_t setPositionRaw(int j, double ref) override;
67 return_t getRefPositionRaw(int joint, double * ref) override;
68
69 // ------- IRemoteVariablesRaw declarations. Implementation in IRemoteVariablesRawImpl.cpp -------
70
71 return_t getRemoteVariableRaw(std::string key, yarp::os::Bottle & val) override;
72 return_t setRemoteVariableRaw(std::string key, const yarp::os::Bottle & val) override;
73 return_t getRemoteVariablesListRaw(yarp::os::Bottle * listOfKeys) override;
74
75 // --------- IVelocityControlRaw declarations. Implementation in IVelocityControlRawImpl.cpp ---------
76
77 return_t velocityMoveRaw(int j, double sp) override;
78#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
79 return_t getTargetVelocityRaw(int joint, double * vel) override;
80#else
81 return_t getRefVelocityRaw(int joint, double * vel) override;
82#endif
83
84private:
85 void interpretModesOfOperation(std::int8_t modesOfOperation) override;
86 void interpretIpStatus(std::uint16_t ipStatus) override;
87 void onPositionLimitTriggered() override;
88 void reset() override;
89
90 InterpolatedPositionBuffer * ipBuffer {nullptr};
91 std::string ipMode;
92 int ipPeriodMs {0};
93
94 std::bitset<16> ipStatus;
95
96 std::atomic<bool> ipMotionStarted {false};
97 std::atomic<bool> ipBufferFilled {false};
98 std::atomic<bool> ipBufferEnabled {false};
99
100 std::atomic<bool> enableSync {false};
101 std::atomic<bool> enableCsv {false};
102
103 std::atomic<double> targetPosition {0.0};
104 std::atomic<double> targetVelocity {0.0};
105};
106
107} // namespace roboticslab
108
109#endif // __TECHNOSOFT_IPOS_EMBEDDED_HPP__
Base class for a PT/PVT buffer of setpoints.
Definition InterpolatedPositionBuffer.hpp:23
Base class for all proxied TechnosoftIpos implementations.
Definition TechnosoftIposBase.hpp:79
A TechnosoftIposBase implementation using the firmware-embedded PID.
Definition TechnosoftIposEmbedded.hpp:20
bool synchronize(double timestamp) override
Perform synchronized action on CAN master's request.
Definition ICanBusSharerImpl.cpp:9
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6