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