YARP
Yet Another Robot Platform
IMotorEncoders.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_IMOTORENCODERS_H
10 #define YARP_DEV_IMOTORENCODERS_H
11 
12 #include <yarp/os/Vocab.h>
13 #include <yarp/dev/api.h>
14 
15 namespace yarp {
16  namespace dev {
17  class IMotorEncodersRaw;
18  class IMotorEncoders;
19  }
20 }
21 
28 {
29 public:
33  virtual ~IMotorEncodersRaw() {}
34 
40  virtual bool getNumberOfMotorEncodersRaw(int *num) = 0;
41 
47  virtual bool resetMotorEncoderRaw(int m)=0;
48 
53  virtual bool resetMotorEncodersRaw()=0;
54 
61  virtual bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr)=0;
62 
69  virtual bool getMotorEncoderCountsPerRevolutionRaw(int m, double *cpr)=0;
70 
77  virtual bool setMotorEncoderRaw(int m, const double val)=0;
78 
84  virtual bool setMotorEncodersRaw(const double *vals)=0;
85 
92  virtual bool getMotorEncoderRaw(int m, double *v)=0;
93 
99  virtual bool getMotorEncodersRaw(double *encs)=0;
100 
107  virtual bool getMotorEncodersTimedRaw(double *encs, double *stamps)=0;
108 
116  virtual bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp)=0;
117 
124  virtual bool getMotorEncoderSpeedRaw(int m, double *sp)=0;
125 
131  virtual bool getMotorEncoderSpeedsRaw(double *spds)=0;
132 
139  virtual bool getMotorEncoderAccelerationRaw(int m, double *spds)=0;
140 
146  virtual bool getMotorEncoderAccelerationsRaw(double *accs)=0;
147 };
148 
155 {
156 public:
160  virtual ~IMotorEncoders() {}
161 
167  virtual bool getNumberOfMotorEncoders(int *num) = 0;
168 
174  virtual bool resetMotorEncoder(int m)=0;
175 
180  virtual bool resetMotorEncoders()=0;
181 
188  virtual bool setMotorEncoderCountsPerRevolution(int m, const double cpr)=0;
189 
196  virtual bool getMotorEncoderCountsPerRevolution(int m, double *cpr)=0;
197 
204  virtual bool setMotorEncoder(int m, const double val)=0;
205 
211  virtual bool setMotorEncoders(const double *vals)=0;
212 
219  virtual bool getMotorEncoder(int m, double *v)=0;
220 
226  virtual bool getMotorEncoders(double *encs)=0;
227 
234  virtual bool getMotorEncodersTimed(double *encs, double *time)=0;
235 
243  virtual bool getMotorEncoderTimed(int m, double *encs, double *time)=0;
244 
251  virtual bool getMotorEncoderSpeed(int m, double *sp)=0;
252 
258  virtual bool getMotorEncoderSpeeds(double *spds)=0;
259 
266  virtual bool getMotorEncoderAcceleration(int m, double *acc)=0;
267 
273  virtual bool getMotorEncoderAccelerations(double *accs)=0;
274 };
275 
276 // interface IMotorEncoders sets
282 
283 // interface IMotorEncoders gets
289 
290 #endif // YARP_DEV_IMOTORENCODERS_H
yarp::dev::IMotorEncodersRaw
Control board, encoder interface.
Definition: IMotorEncoders.h:28
yarp::dev::IMotorEncodersRaw::setMotorEncoderCountsPerRevolutionRaw
virtual bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr)=0
Sets number of counts per revolution for motor encoder m.
yarp::dev::IMotorEncodersRaw::setMotorEncodersRaw
virtual bool setMotorEncodersRaw(const double *vals)=0
Set the value of all motor encoders.
VOCAB_MOTOR_ENCODERS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODERS
Definition: IMotorEncoders.h:280
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::IMotorEncodersRaw::getMotorEncoderSpeedRaw
virtual bool getMotorEncoderSpeedRaw(int m, double *sp)=0
Read the istantaneous speed of a motor encoder.
yarp::dev::IMotorEncoders::setMotorEncoderCountsPerRevolution
virtual bool setMotorEncoderCountsPerRevolution(int m, const double cpr)=0
Sets number of counts per revolution for motor encoder m.
yarp::dev::IMotorEncoders::resetMotorEncoder
virtual bool resetMotorEncoder(int m)=0
Reset motor encoder, single motor.
VOCAB_MOTOR_ENCODER_SPEED
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEED
Definition: IMotorEncoders.h:285
yarp::dev::IMotorEncodersRaw::~IMotorEncodersRaw
virtual ~IMotorEncodersRaw()
Destructor.
Definition: IMotorEncoders.h:33
yarp::dev::IMotorEncodersRaw::getMotorEncoderTimedRaw
virtual bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp)=0
Read the instantaneous position of a motor encoder.
yarp::dev::IMotorEncodersRaw::getMotorEncoderRaw
virtual bool getMotorEncoderRaw(int m, double *v)=0
Read the value of a motor encoder.
VOCAB_MOTOR_ENCODER_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_ACCELERATIONS
Definition: IMotorEncoders.h:288
yarp::dev::IMotorEncoders::getMotorEncoder
virtual bool getMotorEncoder(int m, double *v)=0
Read the value of a motor encoder.
yarp::dev::IMotorEncoders::getMotorEncoderAccelerations
virtual bool getMotorEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all motor encoders.
yarp::dev::IMotorEncoders::~IMotorEncoders
virtual ~IMotorEncoders()
Destructor.
Definition: IMotorEncoders.h:160
VOCAB_MOTOR_ENCODER_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_ACCELERATION
Definition: IMotorEncoders.h:287
yarp::dev::IMotorEncoders::getMotorEncoders
virtual bool getMotorEncoders(double *encs)=0
Read the position of all motor encoders.
yarp::dev::IMotorEncodersRaw::getMotorEncodersRaw
virtual bool getMotorEncodersRaw(double *encs)=0
Read the position of all motor encoders.
yarp::dev::IMotorEncodersRaw::getMotorEncoderAccelerationRaw
virtual bool getMotorEncoderAccelerationRaw(int m, double *spds)=0
Read the instantaneous acceleration of a motor encoder.
VOCAB_MOTOR_ENCODER_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_NUMBER
Definition: IMotorEncoders.h:284
VOCAB_MOTOR_ENCODER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER
Definition: IMotorEncoders.h:279
yarp::dev::IMotorEncodersRaw::getMotorEncoderSpeedsRaw
virtual bool getMotorEncoderSpeedsRaw(double *spds)=0
Read the instantaneous speed of all motor encoders.
yarp::dev::IMotorEncoders::getMotorEncoderTimed
virtual bool getMotorEncoderTimed(int m, double *encs, double *time)=0
Read the instantaneous position of a motor encoder.
yarp::dev::IMotorEncoders::getMotorEncoderSpeeds
virtual bool getMotorEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all motor encoders.
VOCAB_MOTOR_ENCODER_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEEDS
Definition: IMotorEncoders.h:286
yarp::dev::IMotorEncodersRaw::resetMotorEncoderRaw
virtual bool resetMotorEncoderRaw(int m)=0
Reset motor encoder, single motor.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IMotorEncoders
Control board, encoder interface.
Definition: IMotorEncoders.h:155
yarp::dev::IMotorEncoders::resetMotorEncoders
virtual bool resetMotorEncoders()=0
Reset motor encoders.
yarp::dev::IMotorEncoders::getNumberOfMotorEncoders
virtual bool getNumberOfMotorEncoders(int *num)=0
Get the number of available motor encoders.
VOCAB_MOTOR_CPR
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_CPR
Definition: IMotorEncoders.h:281
yarp::dev::IMotorEncodersRaw::getMotorEncodersTimedRaw
virtual bool getMotorEncodersTimedRaw(double *encs, double *stamps)=0
Read the instantaneous position of all motor encoders.
yarp::dev::IMotorEncodersRaw::getMotorEncoderCountsPerRevolutionRaw
virtual bool getMotorEncoderCountsPerRevolutionRaw(int m, double *cpr)=0
Gets number of counts per revolution for motor encoder m.
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::IMotorEncoders::getMotorEncoderAcceleration
virtual bool getMotorEncoderAcceleration(int m, double *acc)=0
Read the instantaneous acceleration of a motor encoder.
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
VOCAB_MOTOR_E_RESETS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESETS
Definition: IMotorEncoders.h:278
VOCAB_MOTOR_E_RESET
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESET
Definition: IMotorEncoders.h:277
yarp::dev::IMotorEncoders::setMotorEncoder
virtual bool setMotorEncoder(int m, const double val)=0
Set the value of the motor encoder for a given motor.
yarp::dev::IMotorEncodersRaw::setMotorEncoderRaw
virtual bool setMotorEncoderRaw(int m, const double val)=0
Set the value of the motor encoder for a given motor.
yarp::dev::IMotorEncoders::getMotorEncoderCountsPerRevolution
virtual bool getMotorEncoderCountsPerRevolution(int m, double *cpr)=0
Gets number of counts per revolution for motor encoder m.
yarp::dev::IMotorEncodersRaw::getNumberOfMotorEncodersRaw
virtual bool getNumberOfMotorEncodersRaw(int *num)=0
Get the number of available motor encoders.
api.h
yarp::dev::IMotorEncoders::setMotorEncoders
virtual bool setMotorEncoders(const double *vals)=0
Set the value of all motor encoders.
yarp::dev::IMotorEncodersRaw::getMotorEncoderAccelerationsRaw
virtual bool getMotorEncoderAccelerationsRaw(double *accs)=0
Read the instantaneous acceleration of all motor encoders.
yarp::dev::IMotorEncoders::getMotorEncodersTimed
virtual bool getMotorEncodersTimed(double *encs, double *time)=0
Read the instantaneous position of all motor encoders.
yarp::dev::IMotorEncoders::getMotorEncoderSpeed
virtual bool getMotorEncoderSpeed(int m, double *sp)=0
Read the istantaneous speed of a motor encoder.
yarp::dev::IMotorEncodersRaw::resetMotorEncodersRaw
virtual bool resetMotorEncodersRaw()=0
Reset motor encoders.