YARP
Yet Another Robot Platform
IMotor.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_IMOTOR_H
10 #define YARP_DEV_IMOTOR_H
11 
12 #include <yarp/os/Vocab.h>
13 #include <yarp/os/Log.h>
14 #include <yarp/dev/api.h>
15 
16 namespace yarp {
17  namespace dev {
18  class IMotorRaw;
19  class IMotor;
20  }
21 }
22 
29 {
30 public:
34  virtual ~IMotorRaw() {}
35 
41  virtual bool getNumberOfMotorsRaw(int *num) = 0;
42 
49  virtual bool getTemperatureRaw(int m, double* val)=0;
50 
56  virtual bool getTemperaturesRaw(double *vals)=0;
57 
65  virtual bool getTemperatureLimitRaw(int m, double *temp)=0;
66 
74  virtual bool setTemperatureLimitRaw(int m, const double temp)=0;
75 
82  virtual bool getGearboxRatioRaw(int m, double *val) { yWarning("getGearboxRatioRaw() not implemented"); return false; };
83 
90  virtual bool setGearboxRatioRaw(int m, const double val) { yWarning("setGearboxRatioRaw() not implemented"); return false; };
91 };
92 
99 {
100 public:
104  virtual ~IMotor() {}
105 
111  virtual bool getNumberOfMotors(int *num) = 0;
112 
119  virtual bool getTemperature(int m, double *val)=0;
120 
126  virtual bool getTemperatures(double *vals)=0;
127 
135  virtual bool getTemperatureLimit(int m, double *temp)=0;
136 
144  virtual bool setTemperatureLimit(int m, const double temp)=0;
145 
152  virtual bool getGearboxRatio(int m, double *val) { yError("getGearboxRatioRaw() not implemented"); return false; };
153 
160  virtual bool setGearboxRatio(int m, const double val) { yError("setGearboxRatio() not implemented"); return false; };
161 };
162 
163 // interface IMotorEncoders gets
169 
170 
171 #endif // YARP_DEV_IMOTOR_H
VOCAB_TEMPERATURE
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE
Definition: IMotor.h:165
VOCAB_TEMPERATURES
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURES
Definition: IMotor.h:167
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
yarp::dev::IMotor::getTemperatures
virtual bool getTemperatures(double *vals)=0
Get temperature of all the motors.
VOCAB_TEMPERATURE_LIMIT
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE_LIMIT
Definition: IMotor.h:168
yarp::dev::IMotor::getGearboxRatio
virtual bool getGearboxRatio(int m, double *val)
Get the gearbox ratio for a specific motor.
Definition: IMotor.h:152
yarp::dev::IMotorRaw::~IMotorRaw
virtual ~IMotorRaw()
Destructor.
Definition: IMotor.h:34
yarp::dev::IMotorRaw
Control board, encoder interface.
Definition: IMotor.h:29
yError
#define yError(...)
Definition: Log.h:282
Log.h
yarp::dev::IMotorRaw::setTemperatureLimitRaw
virtual bool setTemperatureLimitRaw(int m, const double temp)=0
Set the temperature limit for a specific motor.
yarp::dev::IMotorRaw::getNumberOfMotorsRaw
virtual bool getNumberOfMotorsRaw(int *num)=0
Get the number of available motors.
VOCAB_GEARBOX_RATIO
constexpr yarp::conf::vocab32_t VOCAB_GEARBOX_RATIO
Definition: IMotor.h:166
yWarning
#define yWarning(...)
Definition: Log.h:271
yarp::dev::IMotorRaw::setGearboxRatioRaw
virtual bool setGearboxRatioRaw(int m, const double val)
Set the gearbox ratio for a specific motor.
Definition: IMotor.h:90
yarp::dev::IMotorRaw::getGearboxRatioRaw
virtual bool getGearboxRatioRaw(int m, double *val)
Get the gearbox ratio for a specific motor.
Definition: IMotor.h:82
yarp::dev::IMotorRaw::getTemperatureLimitRaw
virtual bool getTemperatureLimitRaw(int m, double *temp)=0
Retreives the current temperature limit for a specific motor.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IMotor
Control board, encoder interface.
Definition: IMotor.h:99
yarp::dev::IMotor::~IMotor
virtual ~IMotor()
Destructor.
Definition: IMotor.h:104
yarp::dev::IMotor::setTemperatureLimit
virtual bool setTemperatureLimit(int m, const double temp)=0
Set the temperature limit for a specific motor.
yarp::dev::IMotor::getTemperature
virtual bool getTemperature(int m, double *val)=0
Get temperature of a motor.
yarp::dev::IMotorRaw::getTemperatureRaw
virtual bool getTemperatureRaw(int m, double *val)=0
Get temperature of a motor.
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
yarp::dev::IMotor::getNumberOfMotors
virtual bool getNumberOfMotors(int *num)=0
Get the number of available motors.
yarp::dev::IMotorRaw::getTemperaturesRaw
virtual bool getTemperaturesRaw(double *vals)=0
Get temperature of all the motors.
yarp::dev::IMotor::getTemperatureLimit
virtual bool getTemperatureLimit(int m, double *temp)=0
Retreives the current temperature limit for a specific motor.
VOCAB_MOTORS_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_MOTORS_NUMBER
Definition: IMotor.h:164
api.h
yarp::dev::IMotor::setGearboxRatio
virtual bool setGearboxRatio(int m, const double val)
Set the gearbox ratio for a specific motor.
Definition: IMotor.h:160