YARP
Yet Another Robot Platform
ITorqueControl.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_ITORQUECONTROL_H
10 #define YARP_DEV_ITORQUECONTROL_H
11 
12 #include <yarp/os/Vocab.h>
13 #include <yarp/dev/api.h>
14 
15 namespace yarp {
16  namespace dev {
17  class ITorqueControlRaw;
18  class ITorqueControl;
19  class MotorTorqueParameters;
20  }
21 }
22 
24 {
25  public:
26  double bemf;
27  double bemf_scale;
28  double ktau;
29  double ktau_scale;
30  MotorTorqueParameters() : bemf(0), bemf_scale(0), ktau(0), ktau_scale(0) {};
31 };
32 
39 {
40 public:
44  virtual ~ITorqueControl() {}
45 
51  virtual bool getAxes(int *ax) = 0;
52 
58  virtual bool getRefTorques(double *t)=0;
59 
66  virtual bool getRefTorque(int j, double *t)=0;
67 
72  virtual bool setRefTorques(const double *t)=0;
73 
79  virtual bool setRefTorque(int j, double t)=0;
80 
86  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
87 
93  virtual bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
94 
100  virtual bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
101 
108  virtual bool getTorque(int j, double *t)=0;
109 
115  virtual bool getTorques(double *t)=0;
116 
123  virtual bool getTorqueRange(int j, double *min, double *max)=0;
124 
130  virtual bool getTorqueRanges(double *min, double *max)=0;
131 };
132 
139 {
140 public:
144  virtual ~ITorqueControlRaw() {}
145 
152  virtual bool getAxes(int *ax) = 0;
153 
160  virtual bool getTorqueRaw(int j, double *t)=0;
161 
167  virtual bool getTorquesRaw(double *t)=0;
168 
175  virtual bool getTorqueRangeRaw(int j, double *min, double *max)=0;
176 
182  virtual bool getTorqueRangesRaw(double *min, double *max)=0;
183 
188  virtual bool setRefTorquesRaw(const double *t)=0;
189 
195  virtual bool setRefTorqueRaw(int j, double t)=0;
196 
202  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
203 
209  virtual bool getRefTorquesRaw(double *t)=0;
210 
217  virtual bool getRefTorqueRaw(int j, double *t)=0;
218 
224  virtual bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
225 
231  virtual bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
232 };
233 
244 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS = yarp::os::createVocab('d', 't', 'q', 's'); //This implements the setRefTorques for the whole part
245 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT = yarp::os::createVocab('d', 't', 'q'); //This implements the setRefTorque for a single joint
246 constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP = yarp::os::createVocab('d', 't', 'q', 'g'); //This implements the setRefTorques with joint list
247 
248 #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:52
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
The main, catch-all namespace for YARP.
Definition: environment.h:18
#define YARP_dev_API
Definition: api.h:19