openRS485(&file_descriptor, serial_ports[0]);
rts
if
(file_descriptor.file_handle
std::cout <<
"ERROR: \tfails while opening the serial resource (sets errno ["
ror(errno) <<
"])."
<< std::endl;
return
-1;
}
std::cout <<
"INFO: \tconnected to qb device..."
// Start using qbmove
int
device_id = 1;
commActivate(&file_descriptor, device_id, TRUE);
#ifdef
_WIN32
Sleep(1000);
#else
usleep(1000000);
#endif
char
status;
int
result = commGetActivate(&file_descriptor, device_id, &status);
if
(result != 0) {
std::cout <<
"ERROR: \tfails while activating motor"
return
-1;
}
short int
currents[2];
short int
positions[3];
if
(commGetMeasurements(&file_descriptor, device_id, positions) < 0) {
std::cout <<
"ERROR: \tfails while retrieving motor position"
return
-1;
}
std::cout <<
"INFO: \tshaft position is "
if
(commGetCurrents(&file_descriptor, device_id, currents) < 0) {
std::cout <<
"ERROR: \tfails while retrieving motor current"
== INVALID_HANDLE_VALUE) {
// currents of each of two motors
// data from encoder motor 1, motor 2 and shaft respectively
<< positions[2] << std::endl;
// use one of the values from RS485listPo
<< std::endl;
//activate motor
<< std::endl;
<< std::endl;
<< std::endl;
<<
strer
74
28 aprile 2021
Need help?
Do you have a question about the qbmove Advanced Kit and is the answer not in the manual?
Questions and answers