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 
47 {
48 public:
50 
52 
54 
55  bool (*move)(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
56 
57  double* positions;
58  double* speeds;
59 
60  bool getAxes(int* ax) override;
61  bool positionMove(int j, double ref) override;
62  bool positionMove(const double* refs) override;
63  bool relativeMove(int j, double delta) override;
64  bool relativeMove(const double* deltas) override;
65  bool checkMotionDone(int j, bool* flag) override;
66  bool checkMotionDone(bool* flag) override;
67  bool setRefSpeed(int j, double sp) override;
68  bool setRefSpeeds(const double* spds) override;
69  bool setRefAcceleration(int j, double acc) override;
70  bool setRefAccelerations(const double* accs) override;
71  bool getRefSpeed(int j, double* ref) override;
72  bool getRefSpeeds(double* spds) override;
73  bool getRefAcceleration(int j, double* acc) override;
74  bool getRefAccelerations(double* accs) override;
75  bool stop(int j) override;
76  bool stop() override;
77  bool positionMove(const int n_joint, const int* joints, const double* refs) override;
78  bool relativeMove(const int n_joint, const int* joints, const double* deltas) override;
79  bool checkMotionDone(const int n_joint, const int* joints, bool* flags) override;
80  bool setRefSpeeds(const int n_joint, const int* joints, const double* spds) override;
81  bool setRefAccelerations(const int n_joint, const int* joints, const double* accs) override;
82  bool getRefSpeeds(const int n_joint, const int* joints, double* spds) override;
83  bool getRefAccelerations(const int n_joint, const int* joints, double* accs) override;
84  bool stop(const int n_joint, const int* joints) override;
85 
86  bool open(Searchable& config) override;
87  bool close() override;
88 };
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
Drivers.h
SerialServoBoard::positions
double * positions
Definition: SerialServoBoard.h:57
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
SerialServoBoard
SerialServoBoard: Documentation to be added
Definition: SerialServoBoard.h:47
yarp::dev::ISerialDevice
A generic interface to serial port devices.
Definition: ISerialDevice.h:28
ControlBoardInterfaces.h
define control board standard interfaces
movessc32
bool movessc32(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:294
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
moveminissc
bool moveminissc(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:318
PolyDriver.h
movepololu
bool movepololu(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:368
yarp::dev::PolyDriver
A container for a device driver.
Definition: PolyDriver.h:27
SerialServoBoard::serial
ISerialDevice * serial
Definition: SerialServoBoard.h:51
SerialServoBoard::dd
PolyDriver dd
Definition: SerialServoBoard.h:53
ISerialDevice.h
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
movepicopic
bool movepicopic(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:389
movemondotronic
bool movemondotronic(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:351
yarp::dev::IPositionControl
Interface for a generic control board device implementing position control.
Definition: IPositionControl.h:257
SerialServoBoard::speeds
double * speeds
Definition: SerialServoBoard.h:58
movepontech
bool movepontech(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
Definition: SerialServoBoard.cpp:335
SerialServoBoard::servoboard
int servoboard
Definition: SerialServoBoard.h:49