YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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;
30 MotorTorqueParameters() : bemf(0), bemf_scale(0), ktau(0), ktau_scale(0), viscousPos(0), viscousNeg(0), coulombPos(0), coulombNeg(0), velocityThres(0){};
31};
32
39{
40public:
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{
140public:
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
244constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS = yarp::os::createVocab32('d', 't', 'q', 's'); //This implements the setRefTorques for the whole part
245constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT = yarp::os::createVocab32('d', 't', 'q'); //This implements the setRefTorque for a single joint
246constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP = yarp::os::createVocab32('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: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