33 if (config.
check(
"help") ==
true) {
35 yCInfo(
SERIALSERVOBOARD,
" -board NAME, where name is one of ssc32, minissc, pontech_sv203x, mondotronic_smi, parallax, pololu_usb_16servo, picopic");
77 conf.
put(
"device",
"serialport");
79 conf.
put(
"baudrate", baudrate);
80 conf.
put(
"rcvenb", 1);
81 conf.
put(
"stopbits", 2);
82 conf.
put(
"databits", 8);
83 conf.
put(
"paritymode",
"none");
140 return ReturnValue::return_code::return_value_error_method_failed;
146 for (
int k = 0;
k < 32;
k++) {
164 for (
int k = 0;
k < 32;
k++) {
198 for (
int k = 0;
k < 32;
k++) {
208 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
214 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
228 for (
int k = 0;
k < 32;
k++) {
238 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
244 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
250 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
256 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
261 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
265 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
269 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
273 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
277 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
281 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
285 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
289 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
294 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
299 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
304 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
309 int pos = 1500 +
round(positions[j] * 11.11);
313 if (
FABS(speeds[j]) < 0.1) {
314 std::snprintf(str, 80,
"#%dP%d\r", j, pos);
316 int speed =
round(speeds[j] * 11.11);
318 std::snprintf(str, 80,
"#%dP%dS%d\r", j, pos, speed);
333 auto pos = (
unsigned char)((
int)(positions[j] * 1.411) + 127);
339 cmd[1] = (
unsigned char)j;
342 serial->
send(cmd, 3);
350 auto pos = (
unsigned char)((
int)(positions[j] * 1.411) + 127);
354 std::snprintf(str, 80,
"BD1SV%dM%d", j + 1, pos);
366 auto pos = (
unsigned char)((
int)(positions[j] * 1.411) + 127);
372 cmd[1] = (
unsigned char)j;
375 serial->
send(cmd, 3);
383 int pos = 1500 +
round(positions[j] * 11.11);
391 cmd[3] = (
unsigned char)j;
393 cmd[4] = (
unsigned char)(pos >> 8);
394 cmd[5] = (
unsigned char)pos;
396 serial->
send(cmd, 6);
404 int pos = 1500 +
round(positions[j] * 11.11);
408 cmd[0] = (
int)(j / 20) + 1;
411 cmd[2] = (
unsigned char)(pos >> 8);
412 cmd[3] = (
unsigned char)pos;
414 if (
FABS(speeds[j]) < 0.1) {
417 auto speed = (
unsigned char)((
int)(speeds[j] * 1.411) + 127);
422 serial->
send(cmd, 5);
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)
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)
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.
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.
bool view(T *&x)
Get an interface to the device driver.
A generic interface to serial port devices.
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A simple collection of objects that can be described and transmitted in a portable way.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A mini-server for performing network communication in the background.
A class for storing options and configuration information.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.