27
—
SOFTWARE
19
https://www.qbrobotics.com
GENERAL MANUAL — MAR 18, 2022 — RELEASE: V1.0.0
•
•
•
•
•
•
•
•
•
•
In any case, thank you for using
6.2 C API library
6.2.1 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.
6.2.2 Basic functions
In most cases these are all the necessary functions to integrate the qb SoftClaw 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 motors on the qb SoftClaw 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 motors on the qb SoftClaw 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 SoftClaw with
the given id, and returns 0 on success; the filled array has the following informations:
measurements[0]:
measure from motor 1 encoder;
Do not forget to include the
"qbmove_communications.h"
when linking the API library in
your project.