YARP
Yet Another Robot Platform
ImplementVelocityControl.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_IVELOCITYCONTROLIMPL_H
10 #define YARP_DEV_IVELOCITYCONTROLIMPL_H
11 
12 
14 #include <yarp/os/Log.h>
15 
16 namespace yarp {
17  namespace dev {
18  class ImplementVelocityControl;
19  class StubImplVelocityControlRaw;
20  }
21 }
22 
23 namespace yarp {
24 namespace dev {
25 namespace impl {
26 
27 template <typename T>
28 class FixedSizeBuffersManager;
29 
30 } // namespace impl
31 } // namespace dev
32 } // namespace yarp
33 
35 {
36 protected:
38  void *helper;
41 
51  bool initialize (int size, const int *amap, const double *enc, const double *zos);
52 
57  bool uninitialize();
58 
59 public:
66 
70  virtual ~ImplementVelocityControl();
71 
72  bool getAxes(int *axes) override;
73  bool velocityMove(int j, double sp) override;
74  bool velocityMove(const double *sp) override;
75  bool setRefAcceleration(int j, double acc) override;
76  bool setRefAccelerations(const double *accs) override;
77  bool getRefAcceleration(int j, double *acc) override;
78  bool getRefAccelerations(double *accs) override;
79  bool stop(int j) override;
80  bool stop() override;
81 
82 
83  // specific of IVelocityControl2
84  bool velocityMove(const int n_joint, const int *joints, const double *spds) override;
85  bool getRefVelocity(const int joint, double *vel) override;
86  bool getRefVelocities(double *vels) override;
87  bool getRefVelocities(const int n_joint, const int *joints, double *vels) override;
88  bool setRefAccelerations(const int n_joint, const int *joints, const double *accs) override;
89  bool getRefAccelerations(const int n_joint, const int *joints, double *accs) override;
90  bool stop(const int n_joint, const int *joints) override;
91 };
92 
93 
109 {
110 private:
115  bool NOT_YET_IMPLEMENTED(const char *func = 0)
116  {
117  if (func)
118  yError("%s: not yet implemented\n", func);
119  else
120  yError("Function not yet implemented\n");
121 
122  return false;
123  }
124 
125 public:
126  bool getAxes(int *axes) override
127  {return NOT_YET_IMPLEMENTED("getAxesRaw");}
128 
129  bool velocityMoveRaw(int j, double sp) override
130  {return NOT_YET_IMPLEMENTED("velocityMoveRaw");}
131 
132  bool velocityMoveRaw(const double *sp) override
133  {return NOT_YET_IMPLEMENTED("velocityMoveRaw");}
134 
135  bool setRefAccelerationRaw(int j, double acc) override
136  {return NOT_YET_IMPLEMENTED("setRefAccelerationRaw");}
137 
138  bool setRefAccelerationsRaw(const double *accs) override
139  {return NOT_YET_IMPLEMENTED("setRefAccelerationsRaw");}
140 
141  bool getRefAccelerationRaw(int j, double *acc) override
142  {return NOT_YET_IMPLEMENTED("getRefAccelerationRaw");}
143 
144  bool getRefAccelerationsRaw(double *accs) override
145  {return NOT_YET_IMPLEMENTED("getRefAccelerationsRaw");}
146 
147  bool stopRaw(int j) override
148  {return NOT_YET_IMPLEMENTED("stopRaw");}
149 
150  bool stopRaw() override
151  {return NOT_YET_IMPLEMENTED("stopRaw");}
152 
153 
154  // specific of IVelocityControl2
155  bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override
156  {return NOT_YET_IMPLEMENTED("velocityMoveRaw");}
157 
158  bool getRefVelocityRaw(const int joint, double *vel) override
159  {return NOT_YET_IMPLEMENTED("getRefVelocityRaw");}
160 
161  bool getRefVelocitiesRaw(double *vels) override
162  {return NOT_YET_IMPLEMENTED("getRefVelocitiesRaw");}
163 
164  bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *vels) override
165  {return NOT_YET_IMPLEMENTED("getRefVelocitiesRaw");}
166 
167  bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override
168  {return NOT_YET_IMPLEMENTED("setRefAccelerationsRaw");}
169 
170  bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override
171  {return NOT_YET_IMPLEMENTED("getRefAccelerationsRaw");}
172 
173  bool stopRaw(const int n_joint, const int *joints) override
174  {return NOT_YET_IMPLEMENTED("stopRaw");}
175 
176 };
177 #endif // YARP_DEV_IVELOCITYCONTROLIMPL_H
yarp::dev::IVelocityControl::velocityMove
virtual bool velocityMove(int j, double sp)=0
Start motion at a given speed, single joint.
yarp::dev::StubImplVelocityControlRaw::stopRaw
bool stopRaw(const int n_joint, const int *joints) override
Stop motion for a subset of joints.
Definition: ImplementVelocityControl.h:173
yarp::dev::ImplementVelocityControl::initialize
bool initialize(int size, const int *amap, const double *enc, const double *zos)
Initialize the internal data and alloc memory.
Definition: ImplementVelocityControl.cpp:32
yarp::dev::StubImplVelocityControlRaw::stopRaw
bool stopRaw() override
Stop motion, multiple joints.
Definition: ImplementVelocityControl.h:150
yarp::dev::StubImplVelocityControlRaw::stopRaw
bool stopRaw(int j) override
Stop motion, single joint.
Definition: ImplementVelocityControl.h:147
yarp::dev::StubImplVelocityControlRaw::setRefAccelerationsRaw
bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override
Set reference acceleration for a subset of joints.
Definition: ImplementVelocityControl.h:167
yarp::dev::ImplementVelocityControl::doubleBuffManager
yarp::dev::impl::FixedSizeBuffersManager< double > * doubleBuffManager
Definition: ImplementVelocityControl.h:40
yarp::dev::IVelocityControl::getRefVelocities
virtual bool getRefVelocities(double *vels)
Get the last reference speed set by velocityMove for all joints.
Definition: IVelocityControl.h:255
yarp::dev::IVelocityControl::stop
virtual bool stop()=0
Stop motion, multiple joints.
yarp::dev::StubImplVelocityControlRaw::getRefAccelerationsRaw
bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override
Get reference acceleration for a subset of joints.
Definition: ImplementVelocityControl.h:170
yarp::dev::ImplementVelocityControl::ImplementVelocityControl
ImplementVelocityControl(yarp::dev::IVelocityControlRaw *y)
Constructor.
Definition: ImplementVelocityControl.cpp:20
yarp::dev::IVelocityControl::setRefAcceleration
virtual bool setRefAcceleration(int j, double acc)=0
Set reference acceleration for a joint.
yarp::dev::impl::FixedSizeBuffersManager< int >
yarp::dev::ImplementVelocityControl::uninitialize
bool uninitialize()
Clean up internal data and memory.
Definition: ImplementVelocityControl.cpp:49
yError
#define yError(...)
Definition: Log.h:282
yarp::dev::IVelocityControl::getRefVelocity
virtual bool getRefVelocity(const int joint, double *vel)
Get the last reference speed set by velocityMove for single joint.
Definition: IVelocityControl.h:249
yarp::dev::StubImplVelocityControlRaw::getRefAccelerationRaw
bool getRefAccelerationRaw(int j, double *acc) override
Get reference acceleration for a joint.
Definition: ImplementVelocityControl.h:141
Log.h
yarp::dev::StubImplVelocityControlRaw::setRefAccelerationRaw
bool setRefAccelerationRaw(int j, double acc) override
Set reference acceleration for a joint.
Definition: ImplementVelocityControl.h:135
yarp::dev::IVelocityControl::getRefAcceleration
virtual bool getRefAcceleration(int j, double *acc)=0
Get reference acceleration for a joint.
yarp::dev::StubImplVelocityControlRaw::getRefVelocitiesRaw
bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *vels) override
Get the last reference speed set by velocityMove for a group of joints.
Definition: ImplementVelocityControl.h:164
yarp::dev::StubImplVelocityControlRaw::getRefVelocitiesRaw
bool getRefVelocitiesRaw(double *vels) override
Get the last reference speed set by velocityMove for all joints.
Definition: ImplementVelocityControl.h:161
yarp::dev::ImplementVelocityControl::helper
void * helper
Definition: ImplementVelocityControl.h:38
yarp::dev::ImplementVelocityControl::iVelocity
IVelocityControlRaw * iVelocity
Definition: ImplementVelocityControl.h:37
yarp::dev::StubImplVelocityControlRaw::setRefAccelerationsRaw
bool setRefAccelerationsRaw(const double *accs) override
Set reference acceleration on all joints.
Definition: ImplementVelocityControl.h:138
yarp::dev::StubImplVelocityControlRaw::getRefAccelerationsRaw
bool getRefAccelerationsRaw(double *accs) override
Get reference acceleration of all joints.
Definition: ImplementVelocityControl.h:144
yarp::dev::IVelocityControl::getRefAccelerations
virtual bool getRefAccelerations(double *accs)=0
Get reference acceleration of all joints.
yarp::dev::StubImplVelocityControlRaw::velocityMoveRaw
bool velocityMoveRaw(int j, double sp) override
Start motion at a given speed, single joint.
Definition: ImplementVelocityControl.h:129
IVelocityControl.h
yarp::dev::IVelocityControl::setRefAccelerations
virtual bool setRefAccelerations(const double *accs)=0
Set reference acceleration on all joints.
yarp::dev::StubImplVelocityControlRaw::velocityMoveRaw
bool velocityMoveRaw(const double *sp) override
Start motion at a given speed, multiple joints.
Definition: ImplementVelocityControl.h:132
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IVelocityControl
Interface for control boards implementing velocity control.
Definition: IVelocityControl.h:160
yarp::dev::ImplementVelocityControl::intBuffManager
yarp::dev::impl::FixedSizeBuffersManager< int > * intBuffManager
Definition: ImplementVelocityControl.h:39
yarp::dev::IVelocityControl::getAxes
virtual bool getAxes(int *axes)=0
Get the number of controlled axes.
yarp::dev::ImplementVelocityControl
Definition: ImplementVelocityControl.h:35
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::StubImplVelocityControlRaw
Stub implementation of IPositionControl2Raw interface.
Definition: ImplementVelocityControl.h:109
yarp::dev::IVelocityControlRaw
Interface for control boards implementig velocity control in encoder coordinates.
Definition: IVelocityControl.h:29
yarp::dev::StubImplVelocityControlRaw::velocityMoveRaw
bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override
Start motion at a given speed for a subset of joints.
Definition: ImplementVelocityControl.h:155
yarp::dev::StubImplVelocityControlRaw::getRefVelocityRaw
bool getRefVelocityRaw(const int joint, double *vel) override
Get the last reference speed set by velocityMove for single joint.
Definition: ImplementVelocityControl.h:158
yarp::dev::ImplementVelocityControl::~ImplementVelocityControl
virtual ~ImplementVelocityControl()
Destructor.
Definition: ImplementVelocityControl.cpp:27
yarp::dev::StubImplVelocityControlRaw::getAxes
bool getAxes(int *axes) override
Get the number of controlled axes.
Definition: ImplementVelocityControl.h:126