YARP
Yet Another Robot Platform
SerialServoBoard.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2008 Giacomo Spigler
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
8 #include <yarp/dev/Drivers.h>
10 #include <yarp/dev/PolyDriver.h>
11 
12 #include <cstdio>
13 #include <cstdlib>
14 #include <cstring>
15 
16 #define round(x) ((x) >= 0 ? (int)((x) + 0.5) : (int)((x)-0.5))
17 #define FABS(x) (x >= 0 ? x : -x)
18 
19 #define SSC32 1
20 #define MINISSC 2
21 #define PONTECHSV203X 3
22 #define MONDOTRONICSMI 4
23 #define POLOLUUSB16 6
24 #define PICOPIC 7
25 
26 
27 using namespace yarp::os;
28 using namespace yarp::dev;
29 
30 
31 bool movessc32(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
32 bool moveminissc(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
33 bool movepontech(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
34 bool movemondotronic(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
35 bool movepololu(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
36 bool movepicopic(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
37 
44 {
45 public:
47 
49 
51 
52  bool (*move)(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
53 
54  double* positions;
55  double* speeds;
56 
57  bool getAxes(int* ax) override;
58  bool positionMove(int j, double ref) override;
59  bool positionMove(const double* refs) override;
60  bool relativeMove(int j, double delta) override;
61  bool relativeMove(const double* deltas) override;
62  bool checkMotionDone(int j, bool* flag) override;
63  bool checkMotionDone(bool* flag) override;
64  bool setRefSpeed(int j, double sp) override;
65  bool setRefSpeeds(const double* spds) override;
66  bool setRefAcceleration(int j, double acc) override;
67  bool setRefAccelerations(const double* accs) override;
68  bool getRefSpeed(int j, double* ref) override;
69  bool getRefSpeeds(double* spds) override;
70  bool getRefAcceleration(int j, double* acc) override;
71  bool getRefAccelerations(double* accs) override;
72  bool stop(int j) override;
73  bool stop() override;
74  bool positionMove(const int n_joint, const int* joints, const double* refs) override;
75  bool relativeMove(const int n_joint, const int* joints, const double* deltas) override;
76  bool checkMotionDone(const int n_joint, const int* joints, bool* flags) override;
77  bool setRefSpeeds(const int n_joint, const int* joints, const double* spds) override;
78  bool setRefAccelerations(const int n_joint, const int* joints, const double* accs) override;
79  bool getRefSpeeds(const int n_joint, const int* joints, double* spds) override;
80  bool getRefAccelerations(const int n_joint, const int* joints, double* accs) override;
81  bool stop(const int n_joint, const int* joints) override;
82 
83  bool open(Searchable& config) override;
84  bool close() override;
85 };
define control board standard interfaces
bool movemondotronic(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
bool movepontech(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
bool movepicopic(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
bool movepololu(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
bool movessc32(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
bool moveminissc(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
SerialServoBoard: Documentation to be added
ISerialDevice * serial
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
Interface for a generic control board device implementing position control.
A generic interface to serial port devices.
Definition: ISerialDevice.h:25
A container for a device driver.
Definition: PolyDriver.h:24
A base class for nested structures that can be searched.
Definition: Searchable.h:66
An interface for the device drivers.
An interface to the operating system, including Port based communication.