Des70_10

Data Structures

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_DES_status_var
 DES data structure with all status variables, all variables are 16bits except Nb136 that is 32bits (double word). More...
struct  TYPE_msg_frame
 struct with message frame More...

Files

file  des70_10.h
 

des70_10.h file for this module. Includes, global vars, funtion prototypes, etc.


file  des70_10_functions.cpp
 

Auxiliary functions for this module. This is where private module functions are defined.


file  des70_10_init.cpp
 

file containing functions related with variables initialization like des data structures.


Defines

#define _DO_NOT_USE_OPENCV_   0
#define _DO_NOT_USE_CARMEN_   0

Enumerations

enum  ENUM_DES_SYS_PARAMS {
  BAUDRATE = 0, SYS_CONFIG = 1, CUR_REG_GAIN_P = 2, CUR_REG_GAIN_I = 3,
  MAX_CUR_OUTPUT = 4, SPEED_REG_GAIN_P = 5, SPEED_REG_GAIN_I = 6, INTERNAL_PARAM1 = 7,
  INTERNAL_PARAM2 = 8, INTERNAL_PARAM3 = 9, MAX_SPEED_ERROR = 10, SETTING_UNIT_GAIN = 11,
  SETTING_UNIT_OFFSET = 12, SETTING_UNIT_DELAY = 13, PEAK_CURRENT = 14, MAX_CONT_CURRENT = 15,
  THERM_CONST = 16, MAX_SPEED = 17, ACCELERATION = 18, SPEED_CONSTANT = 19,
  ENC_RESOLUTION = 20, POLE_PAIR_NUMBER = 21, INTERNAL_PARAM4 = 22, RPM_2QC_FACTOR = 23,
  INDEX_OFFSET = 24, PWM_PERIOD = 25, MAX_DUTY_CYCLE = 26, CUR_DET_PH_U_OFFSET = 27,
  CUR_DET_PH_V_OFFSET = 28, AD_CONV_OFFSET = 29, CAN_MODULE_ID = 30, CAN_SERVICE_ID = 31,
  CAN_RX_PDO_ID = 32, CAN_TX_PDO_ID = 33, CAN_BCR1 = 34, CAN_BCR2 = 35,
  CAN_OP_MODE = 36, CAN_RX_SDO_ID = 37, CAN_TX_SDO_ID = 38, CAN_RTR0_ID = 39,
  CAN_RTR1_ID = 40, CAN_CONFIG = 41, INTERNAL_PARAM5 = 42, ERROR_PROC = 43,
  MAX_SPEED_CURR = 44, HALL_ANGLE_OFFS = 45
}
 

enumerator connected with TYPE_des_sysparam and is used when comunication is required with DES servoamplifier

More...
enum  ENUM_DES_STATUS_VAR {
  SYS_OP_STATUS = 128, ACTUAL_MEAN_CUR_D = 129, ACTUAL_MEAN_CUR_Q = 130, CUR_SETTING_VAL = 131,
  REL_ROT_POS_REV = 132, SPEED_SETTING_VAL = 133, ACTUAL_MEAN_SPEED_VAL = 134, ABS_ROTOR_POS = 135,
  STANDARD_ERROR = 136, CAN_ERROR = 137, ACTUAL_CUR_Q = 138, ACTUAL_SPEED_VAL = 139,
  ERROR_HIST1 = 140, ERROR_HIST2 = 141, ENC_COUNTER = 142, ENC_COUNTER_LAST_IND = 143,
  HALL_SENS_PAT = 144
}
 

enumerator connected with DES status var typedefinition, and is used when communicating with DES servo amplifier

More...

Functions

int InitDES_communication (char *com_device, int *port, int baud, TYPE_executionflags *flg)
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
int write_msg_inbuf (const int port, unsigned char *data, int size)
 send to serial port a stream of bytes
int check_msg_aceptance (const int port, float wait_time, unsigned char *msg)
int send_OpCode (const int port, unsigned char tries, unsigned char OpCode, char flg)
int send_data (const int port, TYPE_msg_frame *msg, char flg)
int read_buffer (const int port, TYPE_msg_frame *msg, char flg)
int send_msg_frame (const int port, TYPE_msg_frame *msg, char flg)
int DES_ST_read_sys_status (const int port, int *sys_status, char flg)
int DES_ST_read_error (const int port, int *errors, char flg)
int DES_ST_clear_errors (const int port, char flg)
int DES_ST_reset (const int port, char flg)
int DES_ST_enable (const int port, int *newState, char flg)
int DES_SPF_read_temp_param (const int port, int paramNb, int dataFormat, int *response, char flg)
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.
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.
int DES_SF_set_velocity (const int port, int newVelocity, char flg)
int DES_SF_set_current (const int port, int newCurrent, char flg)
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.
int DES_MF_read_velocity_is_must (const int port, int vel_type, int *velocity, int *requested_vel, char flg)
int InitDES (const int port, TYPE_des_sysparam *newSysParam, 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.
int stopDES (const int port, char flg)
int DES_set_new_baud (int *port, int baud, char flg)

Define Documentation

#define _DO_NOT_USE_CARMEN_   0
#define _DO_NOT_USE_OPENCV_   0

Enumeration Type Documentation

enumerator connected with DES status var typedefinition, and is used when communicating with DES servo amplifier

Enumerator:
SYS_OP_STATUS 
ACTUAL_MEAN_CUR_D 
ACTUAL_MEAN_CUR_Q 
CUR_SETTING_VAL 
REL_ROT_POS_REV 
SPEED_SETTING_VAL 
ACTUAL_MEAN_SPEED_VAL 
ABS_ROTOR_POS 
STANDARD_ERROR 
CAN_ERROR 
ACTUAL_CUR_Q 
ACTUAL_SPEED_VAL 
ERROR_HIST1 
ERROR_HIST2 
ENC_COUNTER 
ENC_COUNTER_LAST_IND 
HALL_SENS_PAT 

enumerator connected with TYPE_des_sysparam and is used when comunication is required with DES servoamplifier

Enumerator:
BAUDRATE 
SYS_CONFIG 
CUR_REG_GAIN_P 
CUR_REG_GAIN_I 
MAX_CUR_OUTPUT 
SPEED_REG_GAIN_P 
SPEED_REG_GAIN_I 
INTERNAL_PARAM1 
INTERNAL_PARAM2 
INTERNAL_PARAM3 
MAX_SPEED_ERROR 
SETTING_UNIT_GAIN 
SETTING_UNIT_OFFSET 
SETTING_UNIT_DELAY 
PEAK_CURRENT 
MAX_CONT_CURRENT 
THERM_CONST 
MAX_SPEED 
ACCELERATION 
SPEED_CONSTANT 
ENC_RESOLUTION 
POLE_PAIR_NUMBER 
INTERNAL_PARAM4 
RPM_2QC_FACTOR 
INDEX_OFFSET 
PWM_PERIOD 
MAX_DUTY_CYCLE 
CUR_DET_PH_U_OFFSET 
CUR_DET_PH_V_OFFSET 
AD_CONV_OFFSET 
CAN_MODULE_ID 
CAN_SERVICE_ID 
CAN_RX_PDO_ID 
CAN_TX_PDO_ID 
CAN_BCR1 
CAN_BCR2 
CAN_OP_MODE 
CAN_RX_SDO_ID 
CAN_TX_SDO_ID 
CAN_RTR0_ID 
CAN_RTR1_ID 
CAN_CONFIG 
INTERNAL_PARAM5 
ERROR_PROC 
MAX_SPEED_CURR 
HALL_ANGLE_OFFS 

Function Documentation

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

Parameters:
msg - TYPE_msg_frame must be specified previously, were is updated the crc field
Returns:
- this function returns always 1 and crc field at msg structure

References TYPE_msg_frame::crc, TYPE_msg_frame::data, i, TYPE_msg_frame::OpCode, TYPE_msg_frame::size, and update_crc_ccitt().

Referenced by read_buffer(), and send_msg_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

int check_msg_aceptance ( const int  port,
float  wait_time,
unsigned char *  msg 
)

References c_timer::get_toc(), n, result, c_timer::tic(), and c_timer::toc().

Referenced by send_data(), and send_OpCode().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_MF_read_velocity_is_must ( const int  port,
int  vel_type,
int *  velocity,
int *  requested_vel,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, read_buffer(), result, and send_msg_frame().

Here is the call graph for this function:

int DES_set_new_baud ( int *  port,
int  baud,
char  flg 
)

References BAUDRATE, bzero, DES_SPF_set_temp_param(), result, and ret.

Here is the call graph for this function:

int DES_SF_set_current ( const int  port,
int  newCurrent,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Here is the call graph for this function:

int DES_SF_set_velocity ( const int  port,
int  newVelocity,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Referenced by stopDES().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Note:
WARNING: This is a toggle function, so is required to verify if the brake is disable or not. check TYPE_DES_status_var::sys_op_status.bits.bb13
Parameters:
port - serial port connection
flg - (1) to print debug info
Returns:
(0) error occurs during sending

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Referenced by InitDES(), and stopDES().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
port - serial port device
sysparam - struct with all des system parameters
flg - if is required to print data
Returns:
(0) if error occurs when requesting data

References TYPE_des_sysparam::acceleration, TYPE_des_sysparam::ad_conv_offset, TYPE_des_sysparam::baudrate, TYPE_des_sysparam::can_bcr1, TYPE_des_sysparam::can_bcr2, TYPE_des_sysparam::can_config, TYPE_des_sysparam::can_module_id, TYPE_des_sysparam::can_op_mode, TYPE_des_sysparam::can_rtr0_id, TYPE_des_sysparam::can_rtr1_id, TYPE_des_sysparam::can_rx_pdo_id, TYPE_des_sysparam::can_rx_sdo_id, TYPE_des_sysparam::can_service_id, TYPE_des_sysparam::can_tx_pdo_id, TYPE_des_sysparam::can_tx_sdo_id, TYPE_des_sysparam::cur_det_ph_u_offset, TYPE_des_sysparam::cur_det_ph_v_offset, TYPE_des_sysparam::cur_reg_gain_p, TYPE_msg_frame::data, TYPE_des_sysparam::enc_resolution, TYPE_des_sysparam::error_proc, TYPE_des_sysparam::hall_angle_offs, TYPE_des_sysparam::index_offset, TYPE_des_sysparam::internal_param1, TYPE_des_sysparam::internal_param2, TYPE_des_sysparam::internal_param3, TYPE_des_sysparam::internal_param4, TYPE_des_sysparam::internal_param5, TYPE_des_sysparam::max_cont_current, TYPE_des_sysparam::max_cur_output, TYPE_des_sysparam::max_duty_cycle, TYPE_des_sysparam::max_speed, TYPE_des_sysparam::max_speed_curr, TYPE_des_sysparam::max_speed_error, TYPE_msg_frame::OpCode, TYPE_des_sysparam::peak_current, TYPE_des_sysparam::pole_pair_number, TYPE_des_sysparam::pwm_period, read_buffer(), result, TYPE_des_sysparam::rpm2qc_factor, send_msg_frame(), TYPE_des_sysparam::setting_unit_delay, TYPE_des_sysparam::setting_unit_gain, TYPE_des_sysparam::setting_unit_offset, TYPE_des_sysparam::speed_constant, TYPE_des_sysparam::speed_reg_gain_i, TYPE_des_sysparam::speed_reg_gain_p, and TYPE_des_sysparam::sys_config.

Here is the call graph for this function:

int DES_SPF_read_temp_param ( const int  port,
int  paramNb,
int  dataFormat,
int *  response,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, read_buffer(), result, and send_msg_frame().

Referenced by InitDES().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
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
Returns:
(0) error occurs during sending

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Referenced by DES_set_new_baud(), handler_speed_gain(), and InitDES().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_ST_clear_errors ( const int  port,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Referenced by InitDES().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_ST_enable ( const int  port,
int *  newState,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Referenced by InitDES(), and stopDES().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_ST_read_error ( const int  port,
int *  errors,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, read_buffer(), result, send_msg_frame(), and TYPE_msg_frame::size.

Referenced by InitDES().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_ST_read_sys_status ( const int  port,
int *  sys_status,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, read_buffer(), result, and send_msg_frame().

Referenced by InitDES(), and stopDES().

Here is the call graph for this function:

Here is the caller graph for this function:

int DES_ST_reset ( const int  port,
char  flg 
)

References TYPE_msg_frame::data, TYPE_msg_frame::OpCode, result, and send_msg_frame().

Here is the call graph for this function:

int InitDES ( const int  port,
TYPE_des_sysparam newSysParam,
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.

Parameters:
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
flg - if is required to print out some infomration
Returns:
(-1) no errors, (0) brake not disabled or servoamplifier didn't not enabled, (1...) error according Standard Error Messages

References DES_SF_stop_motion(), DES_SPF_read_temp_param(), DES_SPF_set_temp_param(), DES_ST_clear_errors(), DES_ST_enable(), DES_ST_read_error(), DES_ST_read_sys_status(), TYPE_des_sysparam::enc_resolution, ENC_RESOLUTION, c_timer::get_toc(), TYPE_des_sysparam::max_cont_current, MAX_CONT_CURRENT, TYPE_des_sysparam::max_speed, MAX_SPEED, TYPE_des_sysparam::peak_current, PEAK_CURRENT, result, TYPE_des_sysparam::speed_reg_gain_i, SPEED_REG_GAIN_I, TYPE_des_sysparam::speed_reg_gain_p, SPEED_REG_GAIN_P, TYPE_des_sysparam::sys_config, SYS_CONFIG, TYPE_DES_status_var::sys_op_status, c_timer::tic(), and c_timer::toc().

Here is the call graph for this function:

int InitDES_communication ( char *  com_device,
int *  port,
int  baud,
TYPE_executionflags flg 
)
int read_buffer ( const int  port,
TYPE_msg_frame msg,
char  flg 
)
int send_data ( const int  port,
TYPE_msg_frame msg,
char  flg 
)

References check_msg_aceptance(), TYPE_msg_frame::crc, TYPE_msg_frame::data, err, result, TYPE_msg_frame::size, tmp, WAIT, and write_msg_inbuf().

Referenced by send_msg_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

int send_msg_frame ( const int  port,
TYPE_msg_frame msg,
char  flg 
)
int send_OpCode ( const int  port,
unsigned char  tries,
unsigned char  OpCode,
char  flg 
)

References check_msg_aceptance(), err, result, tmp, WAIT, and write_msg_inbuf().

Referenced by send_msg_frame().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
port - device port
data - vector with streaming of data
size - number of bytes to be sent
Returns:
this function will returns 0 if error occurs

References n, and result.

Referenced by read_buffer(), send_data(), and send_OpCode().

Here is the caller graph for this function:

Generated on Wed Jun 2 12:43:28 2010 for LAR Atlas by  doxygen 1.6.3