YARP
Yet Another Robot Platform
IPWMControl.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_IPWMCONTROL_H
10 #define YARP_DEV_IPWMCONTROL_H
11 
12 #include <yarp/dev/api.h>
13 #include <yarp/os/Vocab.h>
14 
15 namespace yarp {
16  namespace dev {
17  class IPWMControlRaw;
18  class IPWMControl;
19  }
20 }
21 
28 {
29 public:
30  virtual ~IPWMControl(){}
31 
37  virtual bool getNumberOfMotors(int *number) = 0;
38 
45  virtual bool setRefDutyCycle(int m, double ref) = 0;
46 
52  virtual bool setRefDutyCycles(const double *refs) = 0;
53 
60  virtual bool getRefDutyCycle(int m, double *ref) = 0;
61 
67  virtual bool getRefDutyCycles(double *refs) = 0;
68 
74  virtual bool getDutyCycle(int m, double *val) = 0;
75 
80  virtual bool getDutyCycles(double *vals) = 0;
81 };
82 
88 {
89 public:
90  virtual ~IPWMControlRaw(){}
91 
97  virtual bool getNumberOfMotorsRaw(int *number) = 0;
98 
105  virtual bool setRefDutyCycleRaw(int m, double ref) = 0;
106 
112  virtual bool setRefDutyCyclesRaw(const double *refs) = 0;
113 
120  virtual bool getRefDutyCycleRaw(int m, double *ref) = 0;
121 
127  virtual bool getRefDutyCyclesRaw(double *refs) = 0;
128 
134  virtual bool getDutyCycleRaw(int m, double *val) = 0;
135 
140  virtual bool getDutyCyclesRaw(double *vals) = 0;
141 };
142 
143 // Interface name
145 // methods names
150 
151 #endif // YARP_DEV_IPWMCONTROL_H
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::IPWMControl::getNumberOfMotors
virtual bool getNumberOfMotors(int *number)=0
Retrieves the number of controlled motors from the current physical interface.
yarp::dev::IPWMControlRaw::~IPWMControlRaw
virtual ~IPWMControlRaw()
Definition: IPWMControl.h:90
VOCAB_PWMCONTROL_REF_PWMS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWMS
Definition: IPWMControl.h:147
yarp::dev::IPWMControlRaw::getRefDutyCyclesRaw
virtual bool getRefDutyCyclesRaw(double *refs)=0
Gets the last reference sent using the setRefDutyCyclesRaw function.
yarp::dev::IPWMControlRaw
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Definition: IPWMControl.h:88
yarp::dev::IPWMControlRaw::getDutyCyclesRaw
virtual bool getDutyCyclesRaw(double *vals)=0
Gets the current dutycycle of the output of the amplifier (i.e.
yarp::dev::IPWMControlRaw::getNumberOfMotorsRaw
virtual bool getNumberOfMotorsRaw(int *number)=0
Retrieves the number of controlled motors from the current physical interface.
yarp::dev::IPWMControl::getDutyCycle
virtual bool getDutyCycle(int m, double *val)=0
Gets the current dutycycle of the output of the amplifier (i.e.
yarp::dev::IPWMControl::getRefDutyCycle
virtual bool getRefDutyCycle(int m, double *ref)=0
Gets the last reference sent using the setRefDutyCycle function.
yarp::dev::IPWMControl::getDutyCycles
virtual bool getDutyCycles(double *vals)=0
Gets the current dutycycle of the output of the amplifier (i.e.
yarp::dev::IPWMControl::setRefDutyCycles
virtual bool setRefDutyCycles(const double *refs)=0
Sets the reference dutycycle for all the motors.
yarp::dev::IPWMControlRaw::getRefDutyCycleRaw
virtual bool getRefDutyCycleRaw(int m, double *ref)=0
Gets the last reference sent using the setRefDutyCycleRaw function.
yarp::dev::IPWMControl::~IPWMControl
virtual ~IPWMControl()
Definition: IPWMControl.h:30
yarp::dev::IPWMControlRaw::setRefDutyCycleRaw
virtual bool setRefDutyCycleRaw(int m, double ref)=0
Sets the reference dutycycle of a single motor.
yarp::dev::IPWMControlRaw::getDutyCycleRaw
virtual bool getDutyCycleRaw(int m, double *val)=0
Gets the current dutycycle of the output of the amplifier (i.e.
yarp::dev::IPWMControl
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Definition: IPWMControl.h:28
VOCAB_PWMCONTROL_PWM_OUTPUT
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUT
Definition: IPWMControl.h:148
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IPWMControl::getRefDutyCycles
virtual bool getRefDutyCycles(double *refs)=0
Gets the last reference sent using the setRefDutyCycles function.
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::IPWMControlRaw::setRefDutyCyclesRaw
virtual bool setRefDutyCyclesRaw(const double *refs)=0
Sets the reference dutycycle for all motors.
yarp::dev::IPWMControl::setRefDutyCycle
virtual bool setRefDutyCycle(int m, double ref)=0
Sets the reference dutycycle to a single motor.
api.h
VOCAB_PWMCONTROL_REF_PWM
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWM
Definition: IPWMControl.h:146
VOCAB_PWMCONTROL_PWM_OUTPUTS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUTS
Definition: IPWMControl.h:149
VOCAB_PWMCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_INTERFACE
Definition: IPWMControl.h:144