66 #ifndef QBMOVE_SERIALPORT_H_INCLUDED 67 #define QBMOVE_SERIALPORT_H_INCLUDED 69 #if (defined(_WIN32) || defined(_WIN64)) 72 #define INVALID_HANDLE_VALUE -1 75 #if !(defined(_WIN32) || defined(_WIN64)) && !(defined(__APPLE__)) //only for linux 79 #define BAUD_RATE_T_2000000 0 //< Define to identify 2M baudrate 80 #define BAUD_RATE_T_460800 1 //< Define to identify 460.8k baudrate 81 #define MAX_WATCHDOG_TIME 500 //< Maximum watchdog timer time 82 #define READ_TIMEOUT 4000 //< Timeout on readings 96 #if (defined(_WIN32) || defined(_WIN64)) 163 #if !(defined(_WIN32) || defined(_WIN64)) && !(defined(__APPLE__)) //only for linux 165 #elif !(defined(_WIN32) || defined(_WIN64)) && (defined(__APPLE__)) //only for mac 966 unsigned short num_of_values );
1013 void *values,
unsigned short value_size,
unsigned short num_of_values,
1153 long timevaldiff (
struct timeval *starttime,
struct timeval *finishtime);
1178 char checksum (
char * data_buffer,
int data_length );
int commGetCurrents(comm_settings *comm_settings_t, int id, short int currents[2])
This function gets currents from a qbMove or a qbHand connected to the serial port.
int commSetZeros(comm_settings *comm_settings_t, int id, void *values, unsigned short num_of_values)
This function sets the encoders's zero positon value that remains stored in the qbMove or qbHand memo...
void openRS485(comm_settings *comm_settings_t, const char *port_s, int BAUD_RATE=B2000000)
This function is used to open a serial port for using with the qbMove or the qbHand.
int RS485ListDevices(comm_settings *comm_settings_t, char list_of_ids[255])
This function is used to list the number of devices connected to the serial port and get their relati...
int commPing(comm_settings *comm_settings_t, int id)
This function is used to ping the qbMove or the qbHand.
void closeRS485(comm_settings *comm_settings_t)
This function is used to close a serial port being used with the qbMove or an qbHand.
char checksum(char *data_buffer, int data_length)
This functions returns an 8 bit LCR checksum over the lenght of a buffer.
int commGetParamList(comm_settings *comm_settings_t, int id, unsigned short index, void *values, unsigned short value_size, unsigned short num_of_values, uint8_t *buffer)
This function gets all the parameters that are stored in the qbMove or qbHand memory and sets one of ...
int commGetInfo(comm_settings *comm_settings_t, int id, short int info_type, char *info)
This function is used to ping the qbMove or the qbHand and get information about the device...
int commGetCurrAndMeas(comm_settings *comm_settings_t, int id, short int *values)
This function gets currents and position measurements from a qbMove or a qbHand connected to the seri...
void commSetWatchDog(comm_settings *comm_settings_t, int id, short int wdt)
This function sets watchdog timer of a qbMove or a qbHand.
int commGetVelocities(comm_settings *comm_settings_t, int id, short int measurements[])
This function gets velocities of the two motors and the shaft from a qbMove connected to a serial por...
int commGetEmg(comm_settings *comm_settings_t, int id, short int emg[2])
This function gets measurements from electomyographics sensors connected to the qbHand.
int commStoreDefaultParams(comm_settings *comm_settings_t, int id)
This function stores the factory default parameters.
void commSetCuffInputs(comm_settings *comm_settings_t, int id, int flag)
This function send reference inputs to a qbMove board connected to the serial port.
int commBootloader(comm_settings *comm_settings_t, int id)
This function sends the board in bootloader modality in order to update the firmware on the board...
int commStoreParams(comm_settings *comm_settings_t, int id)
This function stores all parameters that were set in the qbMove or the qbHand memory.
void commSetInputs(comm_settings *comm_settings_t, int id, short int inputs[])
This function send reference inputs to a qbMove or a qbHand connected to the serial port...
int commExtDrive(comm_settings *comm_settings_t, int id, char ext_input)
This function is used with the armslider device.
int commRestoreParams(comm_settings *comm_settings_t, int id)
This function restores the factory default parameters.
int commCalibrate(comm_settings *comm_settings_t, int id)
This function is used to calibrate the maximum stiffness value of the qbMove.
Definitions for qbMove or qbHand commands, parameters and packages.
void commSetBaudRate(comm_settings *comm_settings_t, int id, short int baudrate)
This function sets the baudrate of communication.
int commInitMem(comm_settings *comm_settings_t, int id)
This function initialize the EEPROM memory of the board by loading the default factory parameters...
int commGetCounters(comm_settings *comm_settings_t, int id, short unsigned int counters[20])
This function gets counters values from a qbMove connected to the serial port.
void commSetPosStiff(comm_settings *comm_settings_t, int id, short int inputs[])
This function send reference inputs to a qbMove connected to the serial port.
int RS485listPorts(char list_of_ports[10][255])
This function is used to return a list of available serial ports.
int commGetActivate(comm_settings *comm_settings_t, int id, char *activate)
This function gets the activation status of a qbMove or a qbHand connected to the serial port...
int RS485read(comm_settings *comm_settings_t, int id, char *package)
This function is used to read a package from the device.
int commGetAccelerations(comm_settings *comm_settings_t, int id, short int measurements[])
This function gets the acceleration of the qbHand motor.
int commGetJoystick(comm_settings *comm_settings_t, int id, short int joystick[2])
This function gets joystick measurementes from a softhand connected to the serial port...
long timevaldiff(struct timeval *starttime, struct timeval *finishtime)
This functions returns a difference between two timeval structures in order to obtain time elapsed be...
void RS485GetInfo(comm_settings *comm_settings_t, char *buffer)
This function is used to ping the serial port for a qbMove or a qbHand and to get information about t...
int commGetMeasurements(comm_settings *comm_settings_t, int id, short int measurements[3])
This function gets position measurements from a qbMove or a qbHand connected to the serial port...
int commSetInputsAck(comm_settings *comm_settings_t, int id, short int inputs[])
This function send reference inputs to a qbMove or a qbHand connected to the serial port and expects ...
int commHandCalibrate(comm_settings *comm_settings_t, int id, short int speed, short int repetitions)
This function is used to make a series of opening and closures of the qbHand.
int commGetInputs(comm_settings *comm_settings_t, int id, short int inputs[2])
This function gets input references from a qbMove or a qbHand connected to the serial port...
void commActivate(comm_settings *comm_settings_t, int id, char activate)
This function activates or deactivates a qbMove or a qbHand connected to the serial port...