QBSOFTHAND RESEARCH USER MANUAL —
37
•
•
•
•
•
•
•
•
•
6.3.2 qbdevice C++ API v6
Installation
To install all the requirements for your specific operating system, please refer to
To compile the C/C++ API library:
open a terminal (for Linux and macOS users), or the command prompt (for Windows users);
navigate to the
"src"
directory inside the downloaded package;
execute the
"make"
command.
Under
"lib_unix"
or
"lib_win"
directory you will find the newly created static
library
"libqbmove_comm.a"
that can be linked in your own application.
Basic functions
In most cases these are all the necessary functions to integrate the qb
SoftHand within
your system.
int RS485ListPorts(char **serial_ports)
: retrieves all the serial ports connected to the
system, returns their number, and fills the given argument with the connected serial port names;
void openRS485(comm_settings *file_descriptor, const char *serial_port)
: opens the
serial communication by acquiring the serial port resource and sets the given file descriptor
accordingly;
void closeRS485(comm_settings *file_descriptor)
: closes the serial communication and
frees the serial resource;
void commActivate(comm_settings *file_descriptor, int device_id, char activate)
:
activates (or deactivates) the motor on the qb SoftHand with the given id, respectively if
"activate"
is
"0x03"
(or
"0x00"
);
int commGetActivate(comm_settings *file_descriptor, int device_id, char
*activate)
: fills
"activate"
with the activation status of the motor on the qb SoftHand with the
given id, and returns 0 on success;
int commGetMeasurements(comm_settings *file_descriptor, int device_id, short int
measurements[3])
: fills
"measurements"
with the position of the motor on the qb SoftHand with
the given id, and returns 0 on success; only the first value is meaningful and it is expressed in motor
ticks which lay in range
"0, 19000"
.
NOTE:
Do not forget to include the
"qbmove_communications.h"
when linking the API library in
your project.