YARP
Yet Another Robot Platform
IPositionControl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2019 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_IPOSITIONCONTROL_H
11 #define YARP_DEV_IPOSITIONCONTROL_H
12 
13 #include <yarp/dev/api.h>
14 #include <yarp/os/Vocab.h>
15 
16 namespace yarp {
17  namespace dev {
18  class IPositionControlRaw;
19  class IPositionControl;
20  }
21 }
22 
30 {
31 public:
35  virtual ~IPositionControlRaw() {}
36 
43  virtual bool getAxes(int *ax) = 0;
44 
50  virtual bool positionMoveRaw(int j, double ref)=0;
51 
56  virtual bool positionMoveRaw(const double *refs)=0;
57 
64  virtual bool relativeMoveRaw(int j, double delta)=0;
65 
70  virtual bool relativeMoveRaw(const double *deltas)=0;
71 
78  virtual bool checkMotionDoneRaw(int j, bool *flag)=0;
79 
85  virtual bool checkMotionDoneRaw(bool *flag)=0;
86 
93  virtual bool setRefSpeedRaw(int j, double sp)=0;
94 
100  virtual bool setRefSpeedsRaw(const double *spds)=0;
101 
108  virtual bool setRefAccelerationRaw(int j, double acc)=0;
109 
115  virtual bool setRefAccelerationsRaw(const double *accs)=0;
116 
123  virtual bool getRefSpeedRaw(int j, double *ref)=0;
124 
129  virtual bool getRefSpeedsRaw(double *spds)=0;
130 
137  virtual bool getRefAccelerationRaw(int j, double *acc)=0;
138 
144  virtual bool getRefAccelerationsRaw(double *accs)=0;
145 
150  virtual bool stopRaw(int j)=0;
151 
155  virtual bool stopRaw()=0;
156 
162  virtual bool positionMoveRaw(const int n_joint, const int *joints, const double *refs)=0;
163 
169  virtual bool relativeMoveRaw(const int n_joint, const int *joints, const double *deltas)=0;
170 
177  virtual bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags)=0;
178 
185  virtual bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds)=0;
186 
193  virtual bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs)=0;
194 
201  virtual bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds)=0;
202 
209  virtual bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs)=0;
210 
215  virtual bool stopRaw(const int n_joint, const int *joints)=0;
216 
226  virtual bool getTargetPositionRaw(const int joint, double *ref) { return false;}
227 
237  virtual bool getTargetPositionsRaw(double *refs) { return false;}
238 
248  virtual bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) { return false;}
249 };
250 
257 {
258 public:
262  virtual ~IPositionControl() {}
263 
270  virtual bool getAxes(int *ax) = 0;
271 
277  virtual bool positionMove(int j, double ref)=0;
278 
283  virtual bool positionMove(const double *refs)=0;
284 
291  virtual bool relativeMove(int j, double delta)=0;
292 
297  virtual bool relativeMove(const double *deltas)=0;
298 
305  virtual bool checkMotionDone(int j, bool *flag)=0;
306 
312  virtual bool checkMotionDone(bool *flag)=0;
313 
320  virtual bool setRefSpeed(int j, double sp)=0;
321 
327  virtual bool setRefSpeeds(const double *spds)=0;
328 
335  virtual bool setRefAcceleration(int j, double acc)=0;
336 
342  virtual bool setRefAccelerations(const double *accs)=0;
343 
350  virtual bool getRefSpeed(int j, double *ref)=0;
351 
356  virtual bool getRefSpeeds(double *spds)=0;
357 
364  virtual bool getRefAcceleration(int j, double *acc)=0;
365 
371  virtual bool getRefAccelerations(double *accs)=0;
372 
377  virtual bool stop(int j)=0;
378 
382  virtual bool stop()=0;
383 
389  virtual bool positionMove(const int n_joint, const int *joints, const double *refs)=0;
390 
396  virtual bool relativeMove(const int n_joint, const int *joints, const double *deltas)=0;
397 
403  virtual bool checkMotionDone(const int n_joint, const int *joints, bool *flag)=0;
404 
411  virtual bool setRefSpeeds(const int n_joint, const int *joints, const double *spds)=0;
412 
419  virtual bool setRefAccelerations(const int n_joint, const int *joints, const double *accs)=0;
420 
427  virtual bool getRefSpeeds(const int n_joint, const int *joints, double *spds)=0;
428 
435  virtual bool getRefAccelerations(const int n_joint, const int *joints, double *accs)=0;
436 
441  virtual bool stop(const int n_joint, const int *joints)=0;
442 
452  virtual bool getTargetPosition(const int joint, double *ref) { return false;}
453 
463  virtual bool getTargetPositions(double *refs) { return false;}
464 
474  virtual bool getTargetPositions(const int n_joint, const int *joints, double *refs) { return false;}
475 };
476 
483 
484 #endif // YARP_DEV_IPOSITIONCONTROL_H
#define YARP_dev_API
Definition: api.h:19
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEED_GROUP
Interface for a generic control board device implementing position control.
virtual ~IPositionControlRaw()
Destructor.
std::int32_t vocab32_t
Definition: numeric.h:52
The main, catch-all namespace for YARP.
Definition: numeric.h:47
Interface for a generic control board device implementing position control in encoder coordinates...
constexpr yarp::conf::vocab32_t VOCAB_STOP_GROUP
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONE_GROUP
virtual bool getTargetPositions(const int n_joint, const int *joints, double *refs)
Get the last position reference for the specified group of axes.
virtual bool getTargetPosition(const int joint, double *ref)
Get the last position reference for the specified axis.
virtual ~IPositionControl()
Destructor.
virtual bool getTargetPositionRaw(const int joint, double *ref)
Get the last position reference for the specified axis.
virtual bool getTargetPositions(double *refs)
Get the last position reference for all axes.
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVE_GROUP
virtual bool getTargetPositionsRaw(double *refs)
Get the last position reference for all axes.
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATION_GROUP
virtual bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs)
Get the last position reference for the specified group of axes.