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
12namespace yarp::dev {
13class ITorqueControlRaw;
14class ITorqueControl;
15class MotorTorqueParameters;
16}
17
19{
20 public:
21 double bemf;
22 double bemf_scale;
23 double ktau;
24 double ktau_scale;
25 double viscousPos;
26 double viscousNeg;
27 double coulombPos;
28 double coulombNeg;
29 MotorTorqueParameters() : bemf(0), bemf_scale(0), ktau(0), ktau_scale(0), viscousPos(0), viscousNeg(0), coulombPos(0), coulombNeg(0) {};
30};
31
38{
39public:
43 virtual ~ITorqueControl() {}
44
50 virtual bool getAxes(int *ax) = 0;
51
57 virtual bool getRefTorques(double *t)=0;
58
65 virtual bool getRefTorque(int j, double *t)=0;
66
71 virtual bool setRefTorques(const double *t)=0;
72
78 virtual bool setRefTorque(int j, double t)=0;
79
85 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
86
92 virtual bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
93
99 virtual bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
100
107 virtual bool getTorque(int j, double *t)=0;
108
114 virtual bool getTorques(double *t)=0;
115
122 virtual bool getTorqueRange(int j, double *min, double *max)=0;
123
129 virtual bool getTorqueRanges(double *min, double *max)=0;
130};
131
138{
139public:
144
151 virtual bool getAxes(int *ax) = 0;
152
159 virtual bool getTorqueRaw(int j, double *t)=0;
160
166 virtual bool getTorquesRaw(double *t)=0;
167
174 virtual bool getTorqueRangeRaw(int j, double *min, double *max)=0;
175
181 virtual bool getTorqueRangesRaw(double *min, double *max)=0;
182
187 virtual bool setRefTorquesRaw(const double *t)=0;
188
194 virtual bool setRefTorqueRaw(int j, double t)=0;
195
201 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
202
208 virtual bool getRefTorquesRaw(double *t)=0;
209
216 virtual bool getRefTorqueRaw(int j, double *t)=0;
217
223 virtual bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) {return false;}
224
230 virtual bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) {return false;}
231};
232
243constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS = yarp::os::createVocab32('d', 't', 'q', 's'); //This implements the setRefTorques for the whole part
244constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT = yarp::os::createVocab32('d', 't', 'q'); //This implements the setRefTorque for a single joint
245constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP = yarp::os::createVocab32('d', 't', 'q', 'g'); //This implements the setRefTorques with joint list
246
247#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
For streams capable of holding different kinds of content, check what they actually have.
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:27
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18