Commit ada1ee49 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Changed the names of some registers.

Added the registers for the new XC,XM and XH families.
parent 7ebe214e
This diff is collapsed.
......@@ -2,6 +2,7 @@
#define _DYNAMIXEL_MOTOR_H
#include "dynamixelserver.h"
#include "dynamixel_registers.h"
#include "threadserver.h"
#include "eventserver.h"
#include "ftdimodule.h"
......@@ -30,6 +31,7 @@ typedef struct
unsigned int gear_ratio;
unsigned int encoder_resolution;
bool pid_control;
bool multi_turn;
double max_angle;
double center_angle;
double max_speed;
......@@ -59,7 +61,7 @@ typedef struct
double max_temperature;
double max_voltage;
double min_voltage;
double max_torque;
double max_pwm;
unsigned short int punch;
}TDynamixel_config;
......@@ -112,7 +114,7 @@ class CDynamixelMotor
* \brief
*
*/
unsigned short int *registers;
TDynReg *registers;
protected:
/**
* \brief
......@@ -237,22 +239,22 @@ class CDynamixelMotor
* \brief
*
*/
double get_max_torque(void);
double get_max_pwm(void);
/**
* \brief
*
*/
double get_limit_torque(void);
double get_pwm_limit(void);
/**
* \brief
*
*/
void set_max_torque(double torque_ratio);
void set_max_pwm(double torque_ratio);
/**
* \brief
*
*/
void set_limit_torque(double torque_ratio);
void set_pwm_limit(double torque_ratio);
/**
* \brief
*
......
This diff is collapsed.
......@@ -66,7 +66,7 @@ class CDynamixelMotorGroup
* \brief
*
*/
std::vector<unsigned short int *>registers;
std::vector<TDynReg *>registers;
protected:
/**
* \brief
......@@ -142,7 +142,7 @@ class CDynamixelMotorGroup
* \brief
*
*/
void set_max_torque(unsigned int index,double torque_ratio);
void set_max_pwm(unsigned int index,double torque_ratio);
/**
* \brief
*
......@@ -152,7 +152,7 @@ class CDynamixelMotorGroup
* \brief
*
*/
double get_max_torque(unsigned int index);
double get_max_pwm(unsigned int index);
/**
* \brief
*
......
#include "dynamixel_registers.h"
unsigned short int std_compl_reg[39]={std_model_number,
std_firmware_version,
std_id,
std_baudrate,
std_return_delay_time,
std_cw_angle_limit,
std_ccw_angle_limit,
(unsigned short int)-1,
std_temp_limit,
std_low_voltage_limit,
std_high_voltage_limit,
std_max_torque,
std_return_level,
std_alarm_led,
std_alarm_shtdwn,
std_down_cal,
std_up_cal,
std_torque_en,
std_led,
(unsigned short int)-1,
(unsigned short int)-1,
(unsigned short int)-1,
std_cw_comp_margin,
std_ccw_comp_margin,
std_cw_comp_slope,
std_ccw_comp_slope,
std_goal_pos,
std_goal_speed,
std_torque_limit,
std_current_pos,
std_current_speed,
std_current_load,
std_current_voltage,
std_current_temp,
std_reg_inst,
(unsigned short int)-1,
std_moving,
std_lock,
std_punch};
TDynReg ax_reg[NUM_REG]={// Info
{0x0000,2,true},
{0xFFFF,0,false},
{0x0002,1,true},
{0x0003,1,true},
{0x0004,1,true},
{0x0005,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0010,1,true},
// Configuration
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0006,2,true},
{0x0008,2,true},
{0x000B,1,true},
{0x000C,1,true},
{0x000D,1,true},
{0x000E,2,true},
{0x0022,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
// Status
{0x0011,1,true},
{0x0012,1,true},
{0x0019,1,false},
{0xFFFF,0,false},
{0x002E,1,false},
{0xFFFF,0,false},
{0x002F,1,false},
{0x002C,1,false},
{0xFFFF,0,false},
// Control
{0x0018,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x001A,1,false},
{0x001B,1,false},
{0x001C,1,false},
{0x001D,1,false},
{0x0030,2,false},
// Set point
{0x001E,2,false},
{0x0020,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
// Feedback
{0x0024,2,false},
{0x0026,2,false},
{0x0028,2,false},
{0x002A,1,false},
{0x002B,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false}};
unsigned short int std_pid_reg[39]={std_model_number,
std_firmware_version,
std_id,
std_baudrate,
std_return_delay_time,
std_cw_angle_limit,
std_ccw_angle_limit,
(unsigned short int)-1,
std_temp_limit,
std_low_voltage_limit,
std_high_voltage_limit,
std_max_torque,
std_return_level,
std_alarm_led,
std_alarm_shtdwn,
std_down_cal,
std_up_cal,
std_torque_en,
std_led,
std_pid_p,
std_pid_i,
std_pid_d,
(unsigned short int)-1,
(unsigned short int)-1,
(unsigned short int)-1,
(unsigned short int)-1,
std_goal_pos,
std_goal_speed,
std_torque_limit,
std_current_pos,
std_current_speed,
std_current_load,
std_current_voltage,
std_current_temp,
std_reg_inst,
(unsigned short int)-1,
std_moving,
std_lock,
std_punch};
TDynReg mx_1_0_reg[NUM_REG]={// Info
{0x0000,2,true},
{0xFFFF,0,false},
{0x0002,1,true},
{0x0003,1,true},
{0x0004,1,true},
{0x0005,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0010,1,true},
// Configuration
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0006,2,true},
{0x0008,2,true},
{0x000B,1,true},
{0x000C,1,true},
{0x000D,1,true},
{0x000E,2,true},
{0x0022,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0014,2,true},
{0x0016,1,true},
// Status
{0x0011,1,true},
{0x0012,1,true},
{0x0019,1,false},
{0xFFFF,0,false},
{0x002E,1,false},
{0xFFFF,0,false},
{0x002F,1,false},
{0x002C,1,false},
{0xFFFF,0,false},
// Control
{0x0018,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x001C,1,false},
{0x001B,1,false},
{0x001A,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0030,2,false},
// Set point
{0x001E,2,false},
{0x0020,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0049,1,false},
{0xFFFF,0,false},
// Feedback
{0x0024,2,false},
{0x0026,2,false},
{0x0028,2,false},
{0x002A,1,false},
{0x002B,1,false},
{0xFFFF,0,false},
{0x0032,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false}};
unsigned short int xl_reg[39]={xl_model_number,
xl_firmware_version,
xl_id,
xl_baudrate,
xl_return_delay_time,
xl_cw_angle_limit,
xl_ccw_angle_limit,
xl_control_mode,
xl_temp_limit,
xl_low_voltage_limit,
xl_high_voltage_limit,
xl_max_torque,
xl_return_level,
xl_alarm_shtdwn,
xl_alarm_shtdwn,
xl_down_cal,
xl_up_cal,
xl_torque_en,
xl_led,
xl_pid_p,
xl_pid_i,
xl_pid_d,
(unsigned short int)-1,
(unsigned short int)-1,
(unsigned short int)-1,
(unsigned short int)-1,
xl_goal_pos,
xl_goal_speed,
xl_goal_torque,
xl_current_pos,
xl_current_speed,
xl_current_load,
xl_current_voltage,
xl_current_temp,
xl_reg_inst,
xl_moving,
(unsigned short int)-1,
xl_hardware_error,
xl_punch};
TDynReg mx_106_1_0_reg[NUM_REG]={// Info
{0x0000,2,true},
{0xFFFF,0,false},
{0x0002,1,true},
{0x0003,1,true},
{0x0004,1,true},
{0x0005,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0010,1,true},
// Configuration
{0x000A,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0006,2,true},
{0x0008,2,true},
{0x000B,1,true},
{0x000C,1,true},
{0x000D,1,true},
{0x000E,2,true},
{0x0022,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0014,2,true},
{0x0016,1,true},
// Status
{0x0011,1,true},
{0x0012,1,true},
{0x0019,1,false},
{0xFFFF,0,false},
{0x002E,1,false},
{0xFFFF,0,false},
{0x002F,1,false},
{0x002C,1,false},
{0xFFFF,0,false},
// Control
{0x0018,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x001C,1,false},
{0x001B,1,false},
{0x001A,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0030,2,false},
// Set point
{0x001E,2,false},
{0x0020,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0049,1,false},
{0xFFFF,0,false},
// Feedback
{0x0024,2,false},
{0x0026,2,false},
{0x0028,2,false},
{0x002A,1,false},
{0x002B,1,false},
{0xFFFF,0,false},
{0x0032,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false}};
TDynReg xl_reg[NUM_REG]={// Info
{0x0000,2,true},
{0xFFFF,0,false},
{0x0002,1,true},
{0x0003,1,true},
{0x0004,1,true},
{0x0005,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0011,1,true},
// Configuration
{0xFFFF,0,false},
{0x000B,1,true},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0006,2,true},
{0x0008,2,true},
{0x000C,1,true},
{0x000D,1,true},
{0x000E,1,true},
{0x000F,2,true},
{0x0023,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
// Status
{0x0012,1,true},
{0x0012,1,true},
{0x0019,1,false},
{0xFFFF,0,false},
{0x0031,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x002F,1,false},
{0x0032,1,false},
// Control
{0x0018,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x001D,1,false},
{0x001C,1,false},
{0x001B,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0033,2,false},
// Set point
{0x001E,2,false},
{0x0020,2,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0x0049,1,false},
{0xFFFF,0,false},
// Feedback
{0x0025,2,false},
{0x0027,2,false},
{0x0029,2,false},
{0x002D,1,false},
{0x002E,1,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false},
{0xFFFF,0,false}};
#ifndef _DYNAMIXEL_REGISTERS_H
#define _DYNAMIXEL_REGISTERS_H
extern unsigned short int std_compl_reg[39];
extern unsigned short int std_pid_reg[39];
extern unsigned short int xl_reg[39];
#define NUM_REG 62
typedef struct{
unsigned short int address;
unsigned char size;
bool eeprom;
}TDynReg;
extern TDynReg ax_reg[NUM_REG];
extern TDynReg mx_1_0_reg[NUM_REG];
extern TDynReg mx_106_1_0_reg[NUM_REG];
extern TDynReg xl_reg[NUM_REG];
typedef enum {
// [Access] [Description]
// EEPROM Area
model_number=0, // (R) Model Number
// Info
model_number=0, // (R) Model Number
model_info, // (R)
firmware_version, // (R) Version of the Firmware
id, // (RW) ID of Dynamixel
baudrate, // (RW) Baud Rate of Dynamixel
return_delay_time, // (RW) Return Delay Time
cw_angle_limit, // (RW) Clockwise Angle Limit
ccw_angle_limit, // (RW) Counterclockwise Angle Limit
dyn_control_mode, // (RW) Joint or wheel mode
temp_limit, // (RW) Internal Temperature Limit
low_voltage_limit, // (RW) Lowest Voltage Limit
high_voltage_limit, // (RW) Highest Voltage Limit
max_torque, // (RW) Maximum Torque
second_id, // (RW)
protocol, // (RW)
return_level, // (RW) Status Return Level
// Configuration
drive_mode, // (RW) Drive mode
op_mode, // (RW) Joint or wheel mode
homming_offset, // (RW)
moving_threshold, // (RW)
min_angle_limit, // (RW) Clockwise Angle Limit
max_angle_limit, // (RW) Counterclockwise Angle Limit
temp_limit, // (RW) Internal Temperature Limit
min_voltage_limit, // (RW) Lowest Voltage Limit
max_voltage_limit, // (RW) Highest Voltage Limit
pwm_limit, // (RW) Maximum Torque
max_pwm, // (RW) Maximum Torque
current_limit, // (RW)
max_current, // (RW)
velocity_limit, // (RW)
multi_turn_off, // (RW) Multi turn offset position
resolution_div, // (RW) Resolution divider
// Status
alarm_led, // (RW) LED for Alarm
alarm_shtdwn, // (RW) Shutdown for Alarm
down_cal, // (RW)
up_cal, // (RW)
// RAM Area
torque_en, // (RW) Torque On/Off
led, // (RW) LED On/Off
pid_p, // (RW)
pid_i, // (RW)
pid_d, // (RW)
bus_watchdog, // (RW)
moving, // (R) Means if there is any movement
moving_status, // (R)
lock, // (RW) Locking EEPROM
reg_inst, // (RW) Means if Instruction is registered
hardware_error, // (R) Means if there is any movement
// control
torque_en, // (RW) Torque On/Off
vel_pid_i, // (RW)
vel_pid_p, // (RW)
pos_pid_p, // (RW)
pos_pid_i, // (RW)
pos_pid_d, // (RW)
feedfwd_gain_2, // (RW)
feedfwd_gain_1, // (RW)
cw_comp_margin, // (RW) CW Compliance Margin
ccw_comp_margin, // (RW) CCW Compliance Margin
cw_comp_slope, // (RW) CW Compliance Slope
ccw_comp_slope, // (RW) CCW Compliance Slope
punch, // (RW) Punch
// Set point
goal_pos, // (RW) Goal Position
goal_speed, // (RW) Moving Speed
torque_limit, // (RW) Torque Limit
goal_pwn, // (RW)
goal_current, // (RW)
profile_accel, // (RW)
profile_vel, // (RW)
// Feedback
current_pos, // (R) Current Position
current_speed, // (R) Current Speed
current_load, // (R) Current Load
current_voltage, // (R) Current Voltage
current_temp, // (RW) Current Temperature
reg_inst, // (RW) Means if Instruction is registered
moving, // (R) Means if there is any movement
lock, // (RW) Locking EEPROM
hardware_error, // (R) Means if there is any movement
punch // (RW) Punch
current_temp, // (R) Current Temperature
current_pwm, // (R)
realtime_tick, // (R) Realtime tick
velocity_traj, // (R)
pos_traj // (R)
} reg_id;
typedef enum {
// [Access] [Description]
// EEPROM Area
std_model_number=0x00, // (R) Model Number
std_firmware_version=0x02, // (R) Version of the Firmware
std_id=0x03, // (RW) ID of Dynamixel
std_baudrate=0x04, // (RW) Baud Rate of Dynamixel