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 bool getControlModeRaw(int j, int * mode) override;
36 bool setControlModeRaw(int j, int mode) override;
37
38 // ------- IPositionControlRaw declarations. Implementation in IPositionControlRawImpl.cpp -------
39
40 bool positionMoveRaw(int j, double ref) override;
41 bool relativeMoveRaw(int j, double delta) override;
42 bool checkMotionDoneRaw(int j, bool * flag) override;
43 bool setRefSpeedRaw(int j, double sp) override;
44 bool setRefAccelerationRaw(int j, double acc) override;
45 bool getRefSpeedRaw(int j, double * ref) override;
46 bool getRefAccelerationRaw(int j, double * acc) override;
47 bool stopRaw(int j) override;
48 bool getTargetPositionRaw(int joint, double * ref) override;
49
50 // ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
51
52 bool setPositionRaw(int j, double ref) override;
53 bool getRefPositionRaw(int joint, double * ref) override;
54
55 // ------- IRemoteVariablesRaw declarations. Implementation in IRemoteVariablesRawImpl.cpp -------
56
57 bool getRemoteVariableRaw(std::string key, yarp::os::Bottle & val) override;
58 bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle & val) override;
59 bool getRemoteVariablesListRaw(yarp::os::Bottle * listOfKeys) override;
60
61 // --------- IVelocityControlRaw declarations. Implementation in IVelocityControlRawImpl.cpp ---------
62
63 bool velocityMoveRaw(int j, double sp) override;
64 bool getRefVelocityRaw(int joint, double * vel) override;
65
66private:
67 void interpretModesOfOperation(std::int8_t modesOfOperation) override;
68 void interpretIpStatus(std::uint16_t ipStatus) override;
69 void onPositionLimitTriggered() override;
70 void reset() override;
71
72 InterpolatedPositionBuffer * ipBuffer {nullptr};
73 std::string ipMode;
74 int ipPeriodMs {0};
75
76 std::bitset<16> ipStatus;
77
78 std::atomic<bool> ipMotionStarted {false};
79 std::atomic<bool> ipBufferFilled {false};
80 std::atomic<bool> ipBufferEnabled {false};
81
82 std::atomic<bool> enableSync {false};
83 std::atomic<bool> enableCsv {false};
84
85 std::atomic<double> targetPosition {0.0};
86 std::atomic<double> targetVelocity {0.0};
87};
88
89} // namespace roboticslab
90
91#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:74
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