YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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
27using namespace yarp::os;
28using namespace yarp::dev;
29
30
31bool movessc32(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
32bool moveminissc(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
33bool movepontech(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
34bool movemondotronic(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
35bool movepololu(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
36bool movepicopic(int j, double ref, double* positions, double* speeds, ISerialDevice* serial);
37
44{
45public:
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 yarp::dev::ReturnValue getAxes(size_t& ax) override;
58 yarp::dev::ReturnValue positionMove(int j, double ref) override;
59 yarp::dev::ReturnValue positionMove(const double* refs) override;
60 yarp::dev::ReturnValue relativeMove(int j, double delta) override;
61 yarp::dev::ReturnValue relativeMove(const double* deltas) override;
62 yarp::dev::ReturnValue checkMotionDone(int j, bool& flag) override;
63 yarp::dev::ReturnValue checkMotionDone(bool& flag) override;
64 yarp::dev::ReturnValue setTrajSpeed(int j, double sp) override;
65 yarp::dev::ReturnValue setTrajSpeeds(const double* spds) override;
66 yarp::dev::ReturnValue setTrajAcceleration(int j, double acc) override;
67 yarp::dev::ReturnValue setTrajAccelerations(const double* accs) override;
68 yarp::dev::ReturnValue getTrajSpeed(int j, double* ref) override;
69 yarp::dev::ReturnValue getTrajSpeeds(double* spds) override;
70 yarp::dev::ReturnValue getTrajAcceleration(int j, double* acc) override;
71 yarp::dev::ReturnValue getTrajAccelerations(double* accs) override;
72 yarp::dev::ReturnValue stop(int j) override;
74 yarp::dev::ReturnValue positionMove(const int n_joint, const int* joints, const double* refs) override;
75 yarp::dev::ReturnValue relativeMove(const int n_joint, const int* joints, const double* deltas) override;
76 yarp::dev::ReturnValue checkMotionDone(const std::vector<int>& joints, bool& flag) override;
77 yarp::dev::ReturnValue setTrajSpeeds(const int n_joint, const int* joints, const double* spds) override;
78 yarp::dev::ReturnValue setTrajAccelerations(const int n_joint, const int* joints, const double* accs) override;
79 yarp::dev::ReturnValue getTrajSpeeds(const int n_joint, const int* joints, double* spds) override;
80 yarp::dev::ReturnValue getTrajAccelerations(const int n_joint, const int* joints, double* accs) override;
81 yarp::dev::ReturnValue stop(const int n_joint, const int* joints) override;
82 yarp::dev::ReturnValue getTargetPosition(const int,double *);
84 yarp::dev::ReturnValue getTargetPositions(const int,const int *,double *);
85
86 bool open(Searchable& config) override;
87 bool close() override;
88};
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
yarp::dev::ReturnValue setTrajAccelerations(const double *accs) override
Set reference acceleration on all joints.
bool(* move)(int j, double ref, double *positions, double *speeds, ISerialDevice *serial)
yarp::dev::ReturnValue getTrajSpeed(int j, double *ref) override
Get reference speed for a joint.
yarp::dev::ReturnValue stop() override
Stop motion, multiple joints.
yarp::dev::ReturnValue getTrajSpeeds(double *spds) override
Get reference speed of all joints.
yarp::dev::ReturnValue positionMove(int j, double ref) override
Set new reference point for a single axis.
yarp::dev::ReturnValue relativeMove(int j, double delta) override
Set relative position.
yarp::dev::ReturnValue setTrajSpeeds(const double *spds) override
Set reference speed on all joints.
ISerialDevice * serial
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getTrajAcceleration(int j, double *acc) override
Get reference acceleration for a joint.
yarp::dev::ReturnValue setTrajSpeed(int j, double sp) override
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
yarp::dev::ReturnValue getAxes(size_t &ax) override
Get the number of controlled axes.
yarp::dev::ReturnValue checkMotionDone(int j, bool &flag) override
Check if the current trajectory is terminated.
yarp::dev::ReturnValue getTrajAccelerations(double *accs) override
Get reference acceleration of all joints.
yarp::dev::ReturnValue getTargetPositions(double *)
Get the last position reference for all axes.
yarp::dev::ReturnValue setTrajAcceleration(int j, double acc) override
Set reference acceleration for a joint.
bool open(Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue getTargetPosition(const int, double *)
Get the last position reference for the specified axis.
Interface implemented by all device drivers.
Interface for a generic control board device implementing position control.
A generic interface to serial port devices.
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
Definition OSTestMsg.cpp:13