SOFTCLAW —
28
•
•
•
•
•
•
measurements[1]:
measure from motor 2 encoder;
measurements[2]:
measure from shaft encoder;
int commGetCurrents(comm_settings *file_descriptor, int device_id, short int
currents[2])
: fills
"currents"
with the currents of the motors on the qb SoftClaw with the given
id, and returns 0 on success; the filled array contains:
currents[0]:
motor 1 current expressed in milliamperes;
currents[1]:
motor 2 current expressed in milliamperes.
void commSetPosStiff(comm_settings *file_descriptor, int device_id, short int
inputs[2])
: sends a reference grasp strength command to the qb SoftClaw with the given id; only
the first value is meaningful while the second must be always
0.
inputs[0]
is expressed in motor
ticks which lay in range
"-2200, 4200"
. Larger or smaller values result in a gripper behaviour
different than the datasheet description.
6.2.3 Usage example
#include <iostream>
#include <string.h>
#include <unistd.h>
#include "include/qbmove_communications.h"
#define TRUE 1
#define FALSE 0
int
main (
int
argc,
char
** argv) {
char
serial_ports[10][255];
int
serial_ports_count = RS485listPorts(serial_ports);
if
(serial_ports_count <= 0) {
std::cout <<
"ERROR: \tno serial port found"
<< std::endl;
return
-1;
}
for
(
int
i=0; i<serial_ports_count; i++) {
std::cout <<
"INFO: \tserial port "
<< serial_ports[i] <<
" found."
<< std::endl;
}
comm_settings file_descriptor;
This last command (
commSetPosStiff
) is very important to control qb SoftClaw. You have to
use it as specified in the previous description, i.e.
with
inputs[2]
= {desired_strenght,
0}.
The second input has to be setted to 0 since the
behavior of
the claw is guaranteed with
this paramenter. A second input different from 0 vary the qb SoftClaw grasp strength.
These commands are meant to be used by expert users only.