Des70-10 Communication library header. More...
#include <termios.h>#include <sys/ioctl.h>#include <unistd.h>#include <termio.h>#include <fcntl.h>#include <string.h>#include <stdio.h>#include <atlasmv_base/crc.h>#include <atlasmv_base/timer.h>

Go to the source code of this file.
Classes | |
| struct | TYPE_DES_status_var |
| DES data structure with all status variables, all variables are 16bits except Nb136 that is 32bits (double word) More... | |
| struct | TYPE_des_sysparam |
| data struct with all DES System Parameters definition, all fields have a length of 16bits but the variable range can change normally [0, 32767] More... | |
| struct | TYPE_msg_frame |
| struct with message frame More... | |
Functions | |
| int | calc_crc_16 (TYPE_msg_frame *msg) |
| function used to get the message crc for 16bits data, the crc is obtained using first the higher byte of the WORD More... | |
| int | check_msg_aceptance (const int port, float wait_time, unsigned char *msg) |
| verify if there is some by in RX serial buffer More... | |
| int | DES_MF_read_velocity_is_must (const int port, int vel_type, int *velocity, int *requested_vel, char flg) |
| Read the effective and requested velocity of the motor. This is a Monitor Function (MF) More... | |
| int | DES_set_new_baud (int *port, int baud, char flg) |
| int | DES_SF_set_current (const int port, int newCurrent, char flg) |
| Set a new current of the motor. This function is only available in current mode regulation mode. please garantee that SysConfig field inside DES_SysParam struct. SF is a setting function. More... | |
| int | DES_SF_set_velocity (const int port, int newVelocity, char flg) |
| Set a new velocity of the motor. This function is only available in speed mode regulation mode. please garantee that SysConfig field inside DES_SysParam struct. SF is a setting function. More... | |
| int | DES_SF_stop_motion (const int port, char flg) |
| This command changes the stopping state. if the motor is already stopped it will be released. Only available in speed regulation mode. SF is a setting function. More... | |
| int | DES_SPF_read_all_temp_param (const int port, TYPE_des_sysparam *sysparam, char flg) |
| Read all temporary system parameters. DES answer the structure described by TYPE_des_sysparam. SPF is a System Parameter Functions. More... | |
| int | DES_SPF_read_temp_param (const int port, int paramNb, int dataFormat, int *response, char flg) |
| Read the requested temporary system parameter from DES-RAM. SPF is a System Parameter Functions. More... | |
| int | DES_SPF_set_temp_param (const int port, int paramNb, int dataFormat, int *newValue, char flg) |
| Write a new value to a temporary system parameter. Refer to the section about system parameters to find the desired system parameter numbers. SPF is a System Parameter Functions. More... | |
| int | DES_ST_clear_errors (const int port, char flg) |
| Clear all DES system errors. More... | |
| int | DES_ST_enable (const int port, int *newState, char flg) |
| Set the system to enabled or disabled state. The DES has to be configured for a software setting of enable. If the hardware enabled is activated this command has no effect. More... | |
| int | DES_ST_read_error (const int port, int *errors, char flg) |
| execute the rs232 command ReadError (OpCode 0x02) More... | |
| int | DES_ST_read_sys_status (const int port, int *sys_status, char flg) |
| execute the DES RS232 command 'ReadSysStatus' (OpCode=0x01). The system status is a 16bits value containing different flags. More... | |
| int | DES_ST_reset (const int port, char flg) |
| RS232 command that reset the des system by restarting the software. More... | |
| int | InitDES (const int port, TYPE_des_sysparam *newSysParam, char, char, char flg) |
| Function that initializes DES servoamplifier with a start configuration. also enables the servoamplifier to be used by software and garantees that the electric brake is not active. More... | |
| int | InitDES_communication (std::string com_device, int *port) |
| function to open serial port and set some params for servoamplifier More... | |
| int | read_buffer (const int port, TYPE_msg_frame *msg, char flg) |
| function to read the buffer into a msg frame More... | |
| int | send_data (const int port, TYPE_msg_frame *msg, char flg) |
| int | send_msg_frame (const int port, TYPE_msg_frame *msg, char flg) |
| send by rs232 all the data frame inclusively crc value. CRC value is obtained were before send message More... | |
| int | send_OpCode (const int port, unsigned char tries, unsigned char OpCode, char flg) |
| function just to send OpCode and verify if command was understood More... | |
| int | stopDES (const int port, char flg) |
| int | write_msg_inbuf (const int port, unsigned char *data, int size) |
| send to serial port a stream of bytes More... | |
Des70-10 Communication library header.
Definition in file des70_10.h.
| enum ENUM_DES_STATUS_VAR |
enumerator connected with DES status var typedefinition, and is used when communicating with DES servo amplifier
Definition at line 237 of file des70_10.h.
| enum ENUM_DES_SYS_PARAMS |
enumerator connected with TYPE_des_sysparam and is used when comunication is required with DES servoamplifier
Definition at line 144 of file des70_10.h.
| int calc_crc_16 | ( | TYPE_msg_frame * | msg | ) |
function used to get the message crc for 16bits data, the crc is obtained using first the higher byte of the WORD
| msg | - TYPE_msg_frame must be specified previously, were is updated the crc field |
Definition at line 79 of file des70_10.cpp.
| int check_msg_aceptance | ( | const int | port, |
| float | wait_time, | ||
| unsigned char * | msg | ||
| ) |
verify if there is some by in RX serial buffer
| port | - device port |
| wait_time | - maximum delay to receive the acknowledge from DES servoamplifier in seconds |
| msg | - the return byte if the result is 1 |
Definition at line 146 of file des70_10.cpp.
| int DES_MF_read_velocity_is_must | ( | const int | port, |
| int | vel_type, | ||
| int * | velocity, | ||
| int * | requested_vel, | ||
| char | flg | ||
| ) |
Read the effective and requested velocity of the motor. This is a Monitor Function (MF)
| port | - serial port connection |
| vel_type | - (0)required mean value (1)realtime values |
| velocity | - velocity is the actual velocity depending on vel_type value. |
| requested_vel | - requested velocity to the servoamplifier |
| flg | - (1) to print debug info |
Definition at line 1100 of file des70_10.cpp.
| int DES_set_new_baud | ( | int * | port, |
| int | baud, | ||
| char | flg | ||
| ) |
Definition at line 1314 of file des70_10.cpp.
| int DES_SF_set_current | ( | const int | port, |
| int | newCurrent, | ||
| char | flg | ||
| ) |
Set a new current of the motor. This function is only available in current mode regulation mode. please garantee that SysConfig field inside DES_SysParam struct. SF is a setting function.
| port | - serial port device |
| newCurrent | - new current in mA {positive value rotor turns counter clockwise, negative value rotor turns in clockwise} |
| flg | - (1) to print debug info |
Definition at line 1034 of file des70_10.cpp.
| int DES_SF_set_velocity | ( | const int | port, |
| int | newVelocity, | ||
| char | flg | ||
| ) |
Set a new velocity of the motor. This function is only available in speed mode regulation mode. please garantee that SysConfig field inside DES_SysParam struct. SF is a setting function.
| port | - serial port device |
| newVelocity | - new velocity in rpm {positive value rotor turns in counter clockwise, negative value rotor turns in clockwise} |
| flg | - (1) to print debug info |
Definition at line 1001 of file des70_10.cpp.
| int DES_SF_stop_motion | ( | const int | port, |
| char | flg | ||
| ) |
This command changes the stopping state. if the motor is already stopped it will be released. Only available in speed regulation mode. SF is a setting function.
| port | - serial port connection |
| flg | - (1) to print debug info |
Definition at line 1066 of file des70_10.cpp.
| int DES_SPF_read_all_temp_param | ( | const int | port, |
| TYPE_des_sysparam * | sysparam, | ||
| char | flg | ||
| ) |
Read all temporary system parameters. DES answer the structure described by TYPE_des_sysparam. SPF is a System Parameter Functions.
| port | - serial port device |
| sysparam | - struct with all des system parameters |
| flg | - if is required to print data |
Definition at line 769 of file des70_10.cpp.
| int DES_SPF_read_temp_param | ( | const int | port, |
| int | paramNb, | ||
| int | dataFormat, | ||
| int * | response, | ||
| char | flg | ||
| ) |
Read the requested temporary system parameter from DES-RAM. SPF is a System Parameter Functions.
| port | - device port |
| paramNb | - Parameter Number according table DES System Parameters and DES Status Variables. check TYPE_DES_sysparam and TYPE_DES_status_var |
| dataFormat | - (0)answer will be a WORD (1) answer will be a LWORD |
| response | - pointer to a WORD |
| flg | - (1) to print debug info |
Definition at line 675 of file des70_10.cpp.
| int DES_SPF_set_temp_param | ( | const int | port, |
| int | paramNb, | ||
| int | dataFormat, | ||
| int * | newValue, | ||
| char | flg | ||
| ) |
Write a new value to a temporary system parameter. Refer to the section about system parameters to find the desired system parameter numbers. SPF is a System Parameter Functions.
| port | - serial device number |
| paramNb | - Parameter Number according table DES System Parameters and DES Status Variables. check TYPE_DES_sysparam and TYPE_DES_status_var |
| dataFormat | - (0)answer will be a WORD (1) answer will be a LWORD |
| newValue | - pointer to a WORD |
| flg | - (1) to print debug info |
Definition at line 718 of file des70_10.cpp.
| int DES_ST_clear_errors | ( | const int | port, |
| char | flg | ||
| ) |
Clear all DES system errors.
| port | - device for serial port connection |
| flg | - (1) to print debug info |
Definition at line 579 of file des70_10.cpp.
| int DES_ST_enable | ( | const int | port, |
| int * | newState, | ||
| char | flg | ||
| ) |
Set the system to enabled or disabled state. The DES has to be configured for a software setting of enable. If the hardware enabled is activated this command has no effect.
| port | - serial conection device port |
| newState | - (0) disable servoamplifier (1) enable servoamplifier |
| flg | - (1) to print debug info |
Definition at line 641 of file des70_10.cpp.
| int DES_ST_read_error | ( | const int | port, |
| int * | errors, | ||
| char | flg | ||
| ) |
execute the rs232 command ReadError (OpCode 0x02)
| port | - Device Port for serial connection |
| errors | - 16bits WORD containing all errors list |
| flg | - (1) to print debug info |
Definition at line 541 of file des70_10.cpp.
| int DES_ST_read_sys_status | ( | const int | port, |
| int * | sys_status, | ||
| char | flg | ||
| ) |
execute the DES RS232 command 'ReadSysStatus' (OpCode=0x01). The system status is a 16bits value containing different flags.
| port | - Device Port for serial connection |
| sys_status | - sys_status is a variable inside data structure DES_Status_Variables |
| flg | - (1) to print debug info |
Definition at line 498 of file des70_10.cpp.
| int DES_ST_reset | ( | const int | port, |
| char | flg | ||
| ) |
RS232 command that reset the des system by restarting the software.
| port | - serial device port |
| flg | - (1) to print debug info |
Definition at line 609 of file des70_10.cpp.
| int InitDES | ( | const int | port, |
| TYPE_des_sysparam * | newSysParam, | ||
| char | enable_des, | ||
| char | brake_des, | ||
| char | flg | ||
| ) |
Function that initializes DES servoamplifier with a start configuration. also enables the servoamplifier to be used by software and garantees that the electric brake is not active.
| port | - serial port conection |
| newSysParam | - DES start configuration, although there is 45 start configuration variable is just defined SYS_CONFIG, ENC_RESOLUTION, MAX_SPEED, MAX_CONT_CURRENT, PEAK_CURRENT, SPEED_REG_GAIN_P and SPEED_REG_GAIN_I |
| enable_des | - |
| brake_des | - |
| flg | - if is required to print out some infomration |
Definition at line 1142 of file des70_10.cpp.
| int InitDES_communication | ( | std::string | com_device, |
| int * | port | ||
| ) |
function to open serial port and set some params for servoamplifier
| com_device | - path to device |
| port | - device port identification (exit) |
Definition at line 41 of file des70_10.cpp.
| int read_buffer | ( | const int | port, |
| TYPE_msg_frame * | msg, | ||
| char | flg | ||
| ) |
function to read the buffer into a msg frame
| port | - device port |
| msg | - message frame type |
| flg | - (1) to print out debug info |
this define the time that at maximum time is necessary to wait for a msg with a lenght of 110bytes with a baud of 38400 near 23ms
Definition at line 330 of file des70_10.cpp.
| int send_data | ( | const int | port, |
| TYPE_msg_frame * | msg, | ||
| char | flg | ||
| ) |
| port | - serial port conection |
| msg | - message frame to be sent according DES frame struct (TYPE_msg_frame) |
| flg | - (1) to print out debug info |
Definition at line 264 of file des70_10.cpp.
| int send_msg_frame | ( | const int | port, |
| TYPE_msg_frame * | msg, | ||
| char | flg | ||
| ) |
send by rs232 all the data frame inclusively crc value. CRC value is obtained were before send message
| port | - device port |
| msg | - TYPE_msg_frame frame |
| flg | - (1) if required print debug data |
Definition at line 457 of file des70_10.cpp.
| int send_OpCode | ( | const int | port, |
| unsigned char | tries, | ||
| unsigned char | OpCode, | ||
| char | flg | ||
| ) |
function just to send OpCode and verify if command was understood
| port | - device port |
| tries | - max number of tries to receive msg |
| OpCode | - unsigned char with DES command, according to DES command reference |
| flg | - (1) will printf special info |
Definition at line 192 of file des70_10.cpp.
| int stopDES | ( | const int | port, |
| char | flg | ||
| ) |
Definition at line 1271 of file des70_10.cpp.
| int write_msg_inbuf | ( | const int | port, |
| unsigned char * | data, | ||
| int | size | ||
| ) |
send to serial port a stream of bytes
| port | - device port |
| data | - vector with streaming of data |
| size | - number of bytes to be sent |
Definition at line 119 of file des70_10.cpp.