YARP
Yet Another Robot Platform
ImplementPositionControl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_DEV_IPOSITIONCONTROLIMPL_H
10 #define YARP_DEV_IPOSITIONCONTROLIMPL_H
11 
12 
14 
15 namespace yarp{
16  namespace dev {
17  class ImplementPositionControl;
18  class StubImplPositionControlRaw;
19  }
20 }
21 
22 namespace yarp {
23 namespace dev {
24 namespace impl {
25 
26 template <typename T>
27 class FixedSizeBuffersManager;
28 
29 } // namespace impl
30 } // namespace dev
31 } // namespace yarp
32 
39 {
40 protected:
42  void *helper;
46 
56  bool initialize (int size, const int *amap, const double *enc, const double *zos);
57 
62  bool uninitialize ();
63 
64 public:
71 
75  virtual ~ImplementPositionControl();
76 
77 
83  bool getAxes(int *axis) override;
84 
85  bool positionMove(int j, double ref) override;
86  bool positionMove(const int n_joint, const int *joints, const double *refs) override;
87  bool positionMove(const double *refs) override;
88  bool relativeMove(int j, double delta) override;
89  bool relativeMove(const int n_joint, const int *joints, const double *deltas) override;
90  bool relativeMove(const double *deltas) override;
91  bool checkMotionDone(bool *flag) override;
92  bool checkMotionDone(const int n_joint, const int *joints, bool *flags) override;
93  bool checkMotionDone(int j, bool *flag) override;
94  bool setRefSpeed(int j, double sp) override;
95  bool setRefSpeeds(const int n_joint, const int *joints, const double *spds) override;
96  bool setRefSpeeds(const double *spds) override;
97  bool setRefAcceleration(int j, double acc) override;
98  bool setRefAccelerations(const int n_joint, const int *joints, const double *accs) override;
99  bool setRefAccelerations(const double *accs) override;
100  bool getRefSpeed(int j, double *ref) override;
101  bool getRefSpeeds(const int n_joint, const int *joints, double *spds) override;
102  bool getRefSpeeds(double *spds) override;
103  bool getRefAcceleration(int j, double *acc) override;
104  bool getRefAccelerations(const int n_joint, const int *joints, double *accs) override;
105  bool getRefAccelerations(double *accs) override;
106  bool stop(int j) override;
107  bool stop(const int n_joint, const int *joints) override;
108  bool stop() override;
109  bool getTargetPosition(const int joint, double *ref) override;
110  bool getTargetPositions(double *refs) override;
111  bool getTargetPositions(const int n_joint, const int *joints, double *refs) override;
112 };
113 
129 {
130 private:
135  bool NOT_YET_IMPLEMENTED(const char *func=0);
136 
137 public:
139 
140  bool getAxes(int *ax) override
141  {return NOT_YET_IMPLEMENTED("getAxes");}
142 
143  bool positionMoveRaw(int j, double ref) override
144  {return NOT_YET_IMPLEMENTED("positionMoveRaw");}
145 
146  bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override
147  {return NOT_YET_IMPLEMENTED("positionMoveRaw");}
148 
149  bool positionMoveRaw(const double *refs) override
150  {return NOT_YET_IMPLEMENTED("positionMoveRaw");}
151 
152  bool relativeMoveRaw(int j, double delta) override
153  {return NOT_YET_IMPLEMENTED("relativeMoveRaw");}
154 
155  bool relativeMoveRaw(const int n_joint, const int *joints, const double *refs) override
156  {return NOT_YET_IMPLEMENTED("relativeMoveRaw");}
157 
158  bool relativeMoveRaw(const double *deltas) override
159  {return NOT_YET_IMPLEMENTED("relativeMoveRaw");}
160 
161  bool checkMotionDoneRaw(int j, bool *flag) override
162  {return NOT_YET_IMPLEMENTED("checkMotionDoneRaw");}
163 
164  bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override
165  {return NOT_YET_IMPLEMENTED("checkMotionDoneRaw");}
166 
167  bool checkMotionDoneRaw(bool *flag) override
168  {return NOT_YET_IMPLEMENTED("checkMotionDoneRaw");}
169 
170  bool setRefSpeedRaw(int j, double sp) override
171  {return NOT_YET_IMPLEMENTED("setRefSpeedRaw");}
172 
173  bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override
174  {return NOT_YET_IMPLEMENTED("setRefSpeedsRaw");}
175 
176  bool setRefSpeedsRaw(const double *spds) override
177  {return NOT_YET_IMPLEMENTED("setRefSpeedsRaw");}
178 
179  bool setRefAccelerationRaw(int j, double acc) override
180  {return NOT_YET_IMPLEMENTED("setRefAccelerationRaw");}
181 
182  bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override
183  {return NOT_YET_IMPLEMENTED("setRefAccelerationsRaw");}
184 
185  bool setRefAccelerationsRaw(const double *accs) override
186  {return NOT_YET_IMPLEMENTED("setRefAccelerationsRaw");}
187 
188  bool getRefSpeedRaw(int j, double *ref) override
189  {return NOT_YET_IMPLEMENTED("getRefSpeedRaw");}
190 
191  bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override
192  {return NOT_YET_IMPLEMENTED("getRefSpeedsRaw");}
193 
194  bool getRefSpeedsRaw(double *spds) override
195  {return NOT_YET_IMPLEMENTED("getRefSpeedsRaw");}
196 
197  bool getRefAccelerationRaw(int j, double *acc) override
198  {return NOT_YET_IMPLEMENTED("getRefAccelerationRaw");}
199 
200  bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override
201  {return NOT_YET_IMPLEMENTED("getRefAccelerationsRaw");}
202 
203  bool getRefAccelerationsRaw(double *accs) override
204  {return NOT_YET_IMPLEMENTED("getRefAccelerationsRaw");}
205 
206  bool stopRaw(int j) override
207  {return NOT_YET_IMPLEMENTED("stopRaw");}
208 
209  bool stopRaw(const int n_joint, const int *joints) override
210  {return NOT_YET_IMPLEMENTED("stopRaw");}
211 
212  bool stopRaw() override
213  {return NOT_YET_IMPLEMENTED("stopRaw");}
214 
215  bool getTargetPositionRaw(const int joint, double *ref) override
216  {return NOT_YET_IMPLEMENTED("stopRaw");}
217 
218  bool getTargetPositionsRaw(double *refs) override
219  {return NOT_YET_IMPLEMENTED("stopRaw");}
220 
221  bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override
222  {return NOT_YET_IMPLEMENTED("stopRaw");}
223 };
224 
225 #endif // YARP_DEV_IPOSITIONCONTROLIMPL_H
yarp::dev::StubImplPositionControlRaw::getTargetPositionsRaw
bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override
Get the last position reference for the specified group of axes.
Definition: ImplementPositionControl.h:221
yarp::dev::IPositionControl::setRefAccelerations
virtual bool setRefAccelerations(const double *accs)=0
Set reference acceleration on all joints.
yarp::dev::StubImplPositionControlRaw
Stub implementation of IPositionControlRaw interface.
Definition: ImplementPositionControl.h:129
yarp::dev::StubImplPositionControlRaw::getRefAccelerationsRaw
bool getRefAccelerationsRaw(double *accs) override
Get reference acceleration of all joints.
Definition: ImplementPositionControl.h:203
yarp::dev::StubImplPositionControlRaw::getRefAccelerationRaw
bool getRefAccelerationRaw(int j, double *acc) override
Get reference acceleration for a joint.
Definition: ImplementPositionControl.h:197
yarp::dev::IPositionControl::positionMove
virtual bool positionMove(int j, double ref)=0
Set new reference point for a single axis.
yarp::dev::ImplementPositionControl
Default implementation of the IPositionControl interface.
Definition: ImplementPositionControl.h:39
yarp::dev::StubImplPositionControlRaw::positionMoveRaw
bool positionMoveRaw(const double *refs) override
Set new reference point for all axes.
Definition: ImplementPositionControl.h:149
yarp::dev::ImplementPositionControl::boolBuffManager
yarp::dev::impl::FixedSizeBuffersManager< bool > * boolBuffManager
Definition: ImplementPositionControl.h:45
yarp::dev::ImplementPositionControl::iPosition
IPositionControlRaw * iPosition
Definition: ImplementPositionControl.h:41
yarp::dev::StubImplPositionControlRaw::getTargetPositionRaw
bool getTargetPositionRaw(const int joint, double *ref) override
Get the last position reference for the specified axis.
Definition: ImplementPositionControl.h:215
yarp::dev::StubImplPositionControlRaw::positionMoveRaw
bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override
Set new reference point for a subset of joints.
Definition: ImplementPositionControl.h:146
yarp::dev::StubImplPositionControlRaw::positionMoveRaw
bool positionMoveRaw(int j, double ref) override
Set new reference point for a single axis.
Definition: ImplementPositionControl.h:143
yarp::dev::StubImplPositionControlRaw::getRefAccelerationsRaw
bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override
Get reference acceleration for a joint.
Definition: ImplementPositionControl.h:200
yarp::dev::impl::FixedSizeBuffersManager< int >
yarp::dev::StubImplPositionControlRaw::getRefSpeedRaw
bool getRefSpeedRaw(int j, double *ref) override
Get reference speed for a joint.
Definition: ImplementPositionControl.h:188
yarp::dev::IPositionControl::getRefAcceleration
virtual bool getRefAcceleration(int j, double *acc)=0
Get reference acceleration for a joint.
yarp::dev::StubImplPositionControlRaw::getTargetPositionsRaw
bool getTargetPositionsRaw(double *refs) override
Get the last position reference for all axes.
Definition: ImplementPositionControl.h:218
yarp::dev::ImplementPositionControl::intBuffManager
yarp::dev::impl::FixedSizeBuffersManager< int > * intBuffManager
Definition: ImplementPositionControl.h:43
yarp::dev::IPositionControl::setRefSpeed
virtual bool setRefSpeed(int j, double sp)=0
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
yarp::dev::IPositionControl::getRefSpeeds
virtual bool getRefSpeeds(double *spds)=0
Get reference speed of all joints.
NOT_YET_IMPLEMENTED
bool NOT_YET_IMPLEMENTED(const char *txt)
Definition: DynamixelAX12FtdiDriver.cpp:25
yarp::dev::IPositionControl::setRefAcceleration
virtual bool setRefAcceleration(int j, double acc)=0
Set reference acceleration for a joint.
yarp::dev::StubImplPositionControlRaw::stopRaw
bool stopRaw() override
Stop motion, multiple joints.
Definition: ImplementPositionControl.h:212
yarp::dev::StubImplPositionControlRaw::relativeMoveRaw
bool relativeMoveRaw(const int n_joint, const int *joints, const double *refs) override
Set relative position for a subset of joints.
Definition: ImplementPositionControl.h:155
yarp::dev::ImplementPositionControl::~ImplementPositionControl
virtual ~ImplementPositionControl()
Destructor.
Definition: ImplementPositionControl.cpp:29
yarp::dev::StubImplPositionControlRaw::checkMotionDoneRaw
bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override
Check if the current trajectory is terminated.
Definition: ImplementPositionControl.h:164
yarp::dev::StubImplPositionControlRaw::setRefSpeedRaw
bool setRefSpeedRaw(int j, double sp) override
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
Definition: ImplementPositionControl.h:170
yarp::dev::StubImplPositionControlRaw::setRefSpeedsRaw
bool setRefSpeedsRaw(const double *spds) override
Set reference speed on all joints.
Definition: ImplementPositionControl.h:176
yarp::dev::IPositionControl::getRefSpeed
virtual bool getRefSpeed(int j, double *ref)=0
Get reference speed for a joint.
yarp::dev::ImplementPositionControl::initialize
bool initialize(int size, const int *amap, const double *enc, const double *zos)
Initialize the internal data and alloc memory.
Definition: ImplementPositionControl.cpp:42
yarp::dev::IPositionControl::checkMotionDone
virtual bool checkMotionDone(int j, bool *flag)=0
Check if the current trajectory is terminated.
yarp::dev::StubImplPositionControlRaw::checkMotionDoneRaw
bool checkMotionDoneRaw(int j, bool *flag) override
Check if the current trajectory is terminated.
Definition: ImplementPositionControl.h:161
yarp::dev::StubImplPositionControlRaw::setRefAccelerationRaw
bool setRefAccelerationRaw(int j, double acc) override
Set reference acceleration for a joint.
Definition: ImplementPositionControl.h:179
yarp::dev::StubImplPositionControlRaw::stopRaw
bool stopRaw(int j) override
Stop motion, single joint.
Definition: ImplementPositionControl.h:206
yarp::dev::StubImplPositionControlRaw::relativeMoveRaw
bool relativeMoveRaw(int j, double delta) override
Set relative position.
Definition: ImplementPositionControl.h:152
yarp::dev::IPositionControl::relativeMove
virtual bool relativeMove(int j, double delta)=0
Set relative position.
yarp::dev::StubImplPositionControlRaw::setRefSpeedsRaw
bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override
Set reference speed on all joints.
Definition: ImplementPositionControl.h:173
yarp::dev::IPositionControl::getAxes
virtual bool getAxes(int *ax)=0
Get the number of controlled axes.
yarp::dev::IPositionControl::stop
virtual bool stop()=0
Stop motion, multiple joints.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::StubImplPositionControlRaw::~StubImplPositionControlRaw
virtual ~StubImplPositionControlRaw()
Definition: ImplementPositionControl.h:138
yarp::dev::StubImplPositionControlRaw::getRefSpeedsRaw
bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override
Get reference speed of all joints.
Definition: ImplementPositionControl.h:191
yarp::dev::ImplementPositionControl::helper
void * helper
Definition: ImplementPositionControl.h:42
yarp::dev::IPositionControl::getTargetPositions
virtual bool getTargetPositions(double *refs)
Get the last position reference for all axes.
Definition: IPositionControl.h:463
yarp::dev::StubImplPositionControlRaw::checkMotionDoneRaw
bool checkMotionDoneRaw(bool *flag) override
Check if the current trajectory is terminated.
Definition: ImplementPositionControl.h:167
yarp::dev::StubImplPositionControlRaw::stopRaw
bool stopRaw(const int n_joint, const int *joints) override
Stop motion for subset of joints.
Definition: ImplementPositionControl.h:209
IPositionControl.h
yarp::dev::StubImplPositionControlRaw::setRefAccelerationsRaw
bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override
Set reference acceleration on all joints.
Definition: ImplementPositionControl.h:182
yarp::dev::StubImplPositionControlRaw::setRefAccelerationsRaw
bool setRefAccelerationsRaw(const double *accs) override
Set reference acceleration on all joints.
Definition: ImplementPositionControl.h:185
yarp::dev::IPositionControlRaw
Interface for a generic control board device implementing position control in encoder coordinates.
Definition: IPositionControl.h:30
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::IPositionControl::setRefSpeeds
virtual bool setRefSpeeds(const double *spds)=0
Set reference speed on all joints.
yarp::dev::StubImplPositionControlRaw::getRefSpeedsRaw
bool getRefSpeedsRaw(double *spds) override
Get reference speed of all joints.
Definition: ImplementPositionControl.h:194
yarp::dev::ImplementPositionControl::doubleBuffManager
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
Definition: ImplementPositionControl.h:44
yarp::dev::ImplementPositionControl::ImplementPositionControl
ImplementPositionControl(yarp::dev::IPositionControlRaw *y)
Constructor.
Definition: ImplementPositionControl.cpp:20
yarp::dev::StubImplPositionControlRaw::getAxes
bool getAxes(int *ax) override
Get the number of controlled axes.
Definition: ImplementPositionControl.h:140
yarp::dev::StubImplPositionControlRaw::relativeMoveRaw
bool relativeMoveRaw(const double *deltas) override
Set relative position, all joints.
Definition: ImplementPositionControl.h:158
yarp::dev::IPositionControl::getTargetPosition
virtual bool getTargetPosition(const int joint, double *ref)
Get the last position reference for the specified axis.
Definition: IPositionControl.h:452
yarp::dev::IPositionControl::getRefAccelerations
virtual bool getRefAccelerations(double *accs)=0
Get reference acceleration of all joints.
yarp::dev::IPositionControl
Interface for a generic control board device implementing position control.
Definition: IPositionControl.h:257
yarp::dev::ImplementPositionControl::uninitialize
bool uninitialize()
Clean up internal data and memory.
Definition: ImplementPositionControl.cpp:65