YARP
Yet Another Robot Platform
ITorqueControl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_ITORQUECONTROL_H
7 #define YARP_DEV_ITORQUECONTROL_H
8 
9 #include <yarp/os/Vocab.h>
10 #include <yarp/dev/api.h>
11 
12 namespace yarp {
13  namespace dev {
14  class ITorqueControlRaw;
15  class ITorqueControl;
16  class MotorTorqueParameters;
17  }
18 }
19 
21 {
22  public:
23  double bemf;
24  double bemf_scale;
25  double ktau;
26  double ktau_scale;
27  MotorTorqueParameters() : bemf(0), bemf_scale(0), ktau(0), ktau_scale(0) {};
28 };
29 
36 {
37 public:
41  virtual ~ITorqueControl() {}
42 
48  virtual bool getAxes(int *ax) = 0;
49 
55  virtual bool getRefTorques(double *t)=0;
56 
63  virtual bool getRefTorque(int j, double *t)=0;
64 
69  virtual bool setRefTorques(const double *t)=0;
70 
76  virtual bool setRefTorque(int j, double t)=0;
77 
83  virtual bool setRefTorques(const int n_joint, const int *joints, const double *t) {return false;} // this function has a default implementation to keep backward compatibility with existing devices
84 
90  virtual bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
91 
97  virtual bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
98 
105  virtual bool getTorque(int j, double *t)=0;
106 
112  virtual bool getTorques(double *t)=0;
113 
120  virtual bool getTorqueRange(int j, double *min, double *max)=0;
121 
127  virtual bool getTorqueRanges(double *min, double *max)=0;
128 };
129 
136 {
137 public:
141  virtual ~ITorqueControlRaw() {}
142 
149  virtual bool getAxes(int *ax) = 0;
150 
157  virtual bool getTorqueRaw(int j, double *t)=0;
158 
164  virtual bool getTorquesRaw(double *t)=0;
165 
172  virtual bool getTorqueRangeRaw(int j, double *min, double *max)=0;
173 
179  virtual bool getTorqueRangesRaw(double *min, double *max)=0;
180 
185  virtual bool setRefTorquesRaw(const double *t)=0;
186 
192  virtual bool setRefTorqueRaw(int j, double t)=0;
193 
199  virtual bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t) {return false;} // this function has a default implementation to keep backward compatibility with existing devices
200 
206  virtual bool getRefTorquesRaw(double *t)=0;
207 
214  virtual bool getRefTorqueRaw(int j, double *t)=0;
215 
221  virtual bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
222 
228  virtual bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
229 };
230 
241 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS = yarp::os::createVocab32('d', 't', 'q', 's'); //This implements the setRefTorques for the whole part
242 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT = yarp::os::createVocab32('d', 't', 'q'); //This implements the setRefTorque for a single joint
243 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP = yarp::os::createVocab32('d', 't', 'q', 'g'); //This implements the setRefTorques with joint list
244 
245 #endif // YARP_DEV_ITORQUECONTROL_H
float t
constexpr yarp::conf::vocab32_t VOCAB_BEMF
constexpr yarp::conf::vocab32_t VOCAB_TORQUE
constexpr yarp::conf::vocab32_t VOCAB_TRQ
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS
constexpr yarp::conf::vocab32_t VOCAB_TRQS
constexpr yarp::conf::vocab32_t VOCAB_RANGE
constexpr yarp::conf::vocab32_t VOCAB_IMP_OFFSET
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_IMP_PARAM
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP
constexpr yarp::conf::vocab32_t VOCAB_RANGES
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_TORQUE_MODE
Interface for control boards implementing torque control.
virtual bool getTorqueRangeRaw(int j, double *min, double *max)=0
Get the full scale of the torque sensor of a given joint.
virtual bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t)
Set new torque reference for a subset of joints.
virtual bool setRefTorquesRaw(const double *t)=0
Set the reference value of the torque for all joints.
virtual bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params)
Set the motor parameters.
virtual ~ITorqueControlRaw()
Destructor.
virtual bool getAxes(int *ax)=0
Get the number of controlled axes.
virtual bool getRefTorquesRaw(double *t)=0
Get the reference value of the torque for all joints.
virtual bool getTorqueRaw(int j, double *t)=0
Get the value of the torque on a given joint (this is the feedback if you have a torque sensor).
virtual bool getRefTorqueRaw(int j, double *t)=0
Set the reference value of the torque for a given joint.
virtual bool setRefTorqueRaw(int j, double t)=0
Set the reference value of the torque for a given joint.
virtual bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params)
Get the motor parameters.
virtual bool getTorqueRangesRaw(double *min, double *max)=0
Get the full scale of the torque sensors of all joints.
virtual bool getTorquesRaw(double *t)=0
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
Interface for control boards implementing torque control.
virtual bool setRefTorque(int j, double t)=0
Set the reference value of the torque for a given joint.
virtual bool setRefTorques(const double *t)=0
Set the reference value of the torque for all joints.
virtual bool getRefTorques(double *t)=0
Get the reference value of the torque for all joints.
virtual bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params)
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
virtual bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params)
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
virtual bool getTorques(double *t)=0
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
virtual bool getAxes(int *ax)=0
Get the number of controlled axes.
virtual bool getTorqueRange(int j, double *min, double *max)=0
Get the full scale of the torque sensor of a given joint.
virtual ~ITorqueControl()
Destructor.
virtual bool getTorqueRanges(double *min, double *max)=0
Get the full scale of the torque sensors of all joints.
virtual bool getRefTorque(int j, double *t)=0
Get the reference value of the torque for a given joint.
virtual bool getTorque(int j, double *t)=0
Get the value of the torque on a given joint (this is the feedback if you have a torque sensor).
virtual bool setRefTorques(const int n_joint, const int *joints, const double *t)
Set new torque reference for a subset of joints.
std::int32_t vocab32_t
Definition: numeric.h:78
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition: Vocab.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18