DETI-Dynamixel Interface
1
Main Page
Related Pages
Data Structures
Files
File List
Globals
dynamixelDefines.h
1
#ifndef _DYNAMIXEL_DEFINES
2
#define _DYNAMIXEL_DEFINES
3
4
/******************************************************************************************/
5
/************************************ MACROS **********************************************/
6
/******************************************************************************************/
7
8
#define MAX_DYNAMIXEL 253
9
#define BROADCAST_ID 254
10
11
#define AX_SERIES 0
12
#define RX_SERIES 1
13
#define MX_SERIES 2
15
#define AX12 0x0c
16
#define AXS1 0x0d
17
#define IMU6AXIS 0x430a
18
#define AX18 0x12
19
#define RX28 0x1c
20
#define RX64 0x40
21
#define MX106 0x0140
22
23
// Instruction code
24
#define INST_PING 0x01 // Ping instruction
25
#define INST_READ 0x02 // Read instruction
26
#define INST_WRITE 0x03 // Write instruction
27
#define INST_REG_WRITE 0x04 // Reg_write instruction
28
#define INST_ACTION 0x05 // Action instruction
29
#define INST_RESET 0x06 // Reset instruction
30
#define INST_SYNC_WRITE 0x83 // Sync_write instruction
31
32
// Address of control table
33
//-------------------------- [EEPROM] area -------------------------------------
34
#define P_MODEL_NUMBER_L 0x00 // Model number lower byte address
35
#define P_MODEL_NUMBER_H 0x01 // Model number higher byte address
36
#define P_VERSION 0x02 // Firmware version address
37
#define P_ID 0x03 // Dynamixel ID address
38
#define P_BAUD_RATE 0x04 // Dynamixel baudrate address
39
#define P_RETURN_DELAY_TIME 0x05 // Return delay time address
40
#define P_LIMIT_TEMPERATURE 0x0b // Limited temperature address
41
#define P_DOWN_LIMIT_VOLTAGE 0x0c // Down limited voltage address
42
#define P_UP_LIMIT_VOLTAGE 0x0d // Up limited voltage address
43
#define P_RETURN_LEVEL 0x10 // Status return level address
44
45
//<<<<<<<<< Motors only >>>>>>>>>>>>
46
#define P_CW_ANGLE_LIMIT_L 0x06 // CW limited angle lower byte address
47
#define P_CW_ANGLE_LIMIT_H 0x07 // CW limited angle higher byte address
48
#define P_CCW_ANGLE_LIMIT_L 0x08 // CCW limited angle lower byte address
49
#define P_CCW_ANGLE_LIMIT_H 0x09 // CCW limited angle higher byte address
50
#define P_MAX_TORQUE_L 0x0e // Max torque lower byte address
51
#define P_MAX_TORQUE_H 0x0f // Max torque higher byte address
52
#define P_ALARM_LED 0x11 // Alarm LED address
53
#define P_ALARM_SHUTDOWN 0x12 // Alarm shutdown address
54
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
55
56
//<<<<<<<<< MX-106 only >>>>>>>>>>>
57
#define DRIVE_MODE 0x0a // MX-106 Dual Mode Setting
58
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
59
60
//<<<<<<<<< AX-S1 only >>>>>>>>>>>>>>>
61
#define P_EEPROM_IR_DETECT_COMPARE 0x14 // IR obstacle detection compare value address
62
#define P_EEPROM_LIGHT_DETECT_COMPARE 0x15 // Light detection compare value address
63
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
64
//-------------------------------------------------------------------------------
65
66
//------------------------------ [RAM] area -------------------------------------
67
#define P_PRESENT_VOLTAGE 0x2a // Present voltage address
68
#define P_PRESENT_TEMPERATURE 0x2b // Present temperature address
69
#define P_REGISTERED_INSTRUCTION 0x2c // Registered instruction address
70
#define P_LOCK 0x2f // EEPROM lock flag address
71
72
//<<<<<<<<< Motors only >>>>>>>>>>>>
73
#define P_TORQUE_ENABLE 0x18 // Torque enable flag address
74
#define P_LED 0x19 // LED on/off flag address
75
#define P_CW_COMPLIANCE_MARGIN 0x1a // CW compliance margin address
76
#define P_CCW_COMPLIANCE_MARGIN 0x1b // CCW compliance margin address
77
#define P_CW_COMPLIANCE_SLOPE 0x1c // CW compliance slope address
78
#define P_CCW_COMPLIANCE_SLOPE 0x1d // CCW compliance slope address
79
#define P_GOAL_POSITION_L 0x1e // Goal position lower byte address
80
#define P_GOAL_POSITION_H 0x1f // Goal position higher byte address
81
#define P_GOAL_SPEED_L 0x20 // Goal speed lower byte address
82
#define P_GOAL_SPEED_H 0x21 // Goal speed higher byte address
83
#define P_TORQUE_LIMIT_L 0x22 // Limited torque lower byte address
84
#define P_TORQUE_LIMIT_H 0x23 // Limited torque higher byte address
85
#define P_PRESENT_POSITION_L 0x24 // Present position lower byte address
86
#define P_PRESENT_POSITION_H 0x25 // Present position higher byte address
87
#define P_PRESENT_SPEED_L 0x26 // Present speed lower byte address
88
#define P_PRESENT_SPEED_H 0x27 // Present speed higher byte address
89
#define P_PRESENT_LOAD_L 0x28 // Present load lower byte address
90
#define P_PRESENT_LOAD_H 0x29 // Present load higher byte address
91
#define P_MOVING 0x2e // Moving state flag address
92
#define P_PUNCH_L 0x30 // Punch lower byte address
93
#define P_PUNCH_H 0x31 // Punch higher byte address
94
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
95
96
//<<<<<<<<< MX-106 only >>>>>>>>>>>
97
#define P_D_GAIN 0x1a // D component of PID control
98
#define P_I_GAIN 0x1b // I component of PID control
99
#define P_P_GAIN 0x1c // P component of PID control
100
#define P_CURRENT_L 0X44 // Lowest byte of Consuming Current
101
#define P_CURRENT_H 0X45 // Highest byte of Consuming Current
102
#define P_TORQUE_CONTROL_MODE 0X46 // Torque Control Mode Enable on/off
103
#define P_GOAL_TORQUE_L 0X47 // Lowest byte of goal torque value
104
#define P_GOAL_TORQUE_H 0X48 // Highest byte of goal torque value
105
#define P_GOAL_ACCELERATION 0X49 // Goal Acceleration
106
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
107
108
//<<<<<<<<< AX-S1 only >>>>>>>>>>>>>>>
109
#define P_IR_LEFT_FIRE_DATA 0x1a // Left IR detection value address
110
#define P_IR_CENTER_FIRE_DATA 0x1b // Center IR detection value address
111
#define P_IR_RIGHT_FIRE_DATA 0x1c // Right IR detection value address
112
#define P_LIGHT_LEFT_DATA 0x1d // Left light detection value address
113
#define P_LIGHT_CENTER_DATA 0x1e // Center light detection value address
114
#define P_LIGHT_RIGHT_DATA 0x1f // Right light detection value address
115
116
#define P_IR_OBSTACLE_DETECTED 0x20 // Left IR detection value address
117
#define P_LIGHT_DETECTED 0x21 // Center IR detection value address
118
#define P_SOUND_DATA 0x23 // Sound data address
119
#define P_SOUND_DATA_MAX_HOLD 0x24 // Sound data max hold value address
120
#define P_SOUND_DETECTED_COUNT 0x25 // Sound data detected count value address
121
#define P_SOUND_DETECTED_TIME_L 0x26 // Sound detected time value lower byte address
122
#define P_SOUND_DETECTED_TIME_H 0x27 // Sound detected time value higher byte address
123
#define P_BUZZER_DATA0 0x28 // Buzzer data0 address
124
#define P_BUZZER_DATA1 0x29 // Buzzer data1 address
125
#define P_REMOCON_ARRIVED 0x30 // IR remocon arrived flag address
126
#define P_REMOCON_RXDATA0 0x31 // IR remocon rx data lower byte address
127
#define P_REMOCON_RXDATA1 0x32 // IR remocon rx data higher byte address
128
#define P_REMOCON_TXDATA0 0x33 // IR remocon tx data lower byte address
129
#define P_REMOCON_TXDATA1 0x34 // IR remocon tx data higher byte address
130
#define P_IR_DETECT_COMPARE 0x35 // IR obstacle detection compare value address
131
#define P_LIGHT_DETECT_COMPARE 0x36 // Light detection compare value address
132
//<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
133
134
//<<<<<<<<< 6-AXIS-IMU only >>>>>>>>>>>>>>>
135
#define P_LED 0x19 // LED on/off flag address
136
#define P_SIDEWAYS_ACCEL_L 0x1a // Sideways acceleration lower byte address (XX)
137
#define P_SIDEWAYS_ACCEL_H 0x1b // Sideways acceleration higher byte address (XX)
138
#define P_FORWARDS_ACCEL_L 0x1c // Forward acceleration lower byte address (YY)
139
#define P_FORWARDS_ACCEL_H 0x1d // Forward acceleration higher byte address (YY)
140
#define P_VERTICAL_ACCEL_L 0x1e // Vertical acceleration lower byte address (ZZ)
141
#define P_VERTICAL_ACCEL_H 0x1f // Vertical acceleration higher byte address (ZZ)
142
#define P_PITCH_RATE_L 0x20 // Pitch angle lower byte address (YY)
143
#define P_PITCH_RATE_H 0x21 // Pitch angle higher byte address (YY)
144
#define P_ROLL_RATE_L 0x22 // Roll angle lower byte address (XX)
145
#define P_ROLL_RATE_H 0x23 // Roll angle higher byte address (XX)
146
#define P_YAW_RATE_L 0x24 // Yaw angle lower byte address (ZZ)
147
#define P_YAW_RATE_H 0x25 // Yaw angle higher byte address (ZZ)
148
149
//-------------------------------------------------------------------------------
150
151
// Error code bit of status packet
152
// #define ERROR_NONE 0x00 // All bit cleared
153
// #define ERROR_VOLTAGE 0x01 // 0th error bit '00000001' - Voltage error
154
// #define ERROR_ANGLE 0x02 // 1th error bit '00000010' - Limited angle error (Motor only)
155
// #define ERROR_OVERHEAT 0x04 // 2th error bit '00000100' - Overheatting error
156
// #define ERROR_RANGE 0x08 // 3th error bit '00001000' - Range error
157
// #define ERROR_CHECKSUM 0x10 // 4th error bit '00010000' - Packet's checksum error
158
// #define ERROR_OVERLOAD 0x20 // 5th error bit '00100000' - Overload error (Motor only)
159
// #define ERROR_INSTRUCTION 0x40 // 6th error bit '01000000' - Instruction code error
160
161
// Alarm LED bit of P_ALARM_LED (Motor only)
162
#define ALARM_NONE 0x00 // All bit cleared
163
#define ALARM_VOLTAGE 0x01 // 0th alram bit '00000001' - Voltage error alarm
164
#define ALARM_ANGLE 0x02 // 1th alram bit '00000010' - Limited angle error alarm
165
#define ALARM_OVERHEAT 0x04 // 2th alram bit '00000100' - Overheating error alarm
166
#define ALARM_RANGE 0x08 // 3th alram bit '00001000' - Range error alarm
167
#define ALARM_CHECKSUM 0x10 // 4th alram bit '00010000' - Packet's checksum error alarm
168
#define ALARM_OVERLOAD 0x20 // 5th alram bit '00100000' - Overload error alarm
169
#define ALARM_INSTRUCTION 0x40 // 6th alram bit '01000000' - Instruction code error alarm
170
171
// Alarm Shutdown bit of P_ALARM_SHUTDOWN (Motor only)
172
#define SHUTDOWN_NONE 0x00 // All bit cleared
173
#define SHUTDOWN_VOLTAGE 0x01 // 0th shutdown bit '00000001' - Voltage error shutdown
174
#define SHUTDOWN_ANGLE 0x02 // 1th shutdown bit '00000010' - Limited angle error shutdown
175
#define SHUTDOWN_OVERHEAT 0x04 // 2th shutdown bit '00000100' - Overheatting error shutdown
176
#define SHUTDOWN_RANGE 0x08 // 3th shutdown bit '00001000' - Range error shutdown
177
#define SHUTDOWN_CHECKSUM 0x10 // 4th shutdown bit '00010000' - Packet's checksum error shutdown
178
#define SHUTDOWN_OVERLOAD 0x20 // 5th shutdown bit '00100000' - Overload error shutdown
179
#define SHUTDOWN_INSTRUCTION 0x40 // 6th shutdown bit '01000000' - Instruction code error shutdown
180
181
// Value of P_ID
182
#define BROADCASTING_ID 0xfe // Broadcasting ID
183
184
// Value of P_RETURN_LEVEL
185
#define RETURN_NONE 0x00 // Return no status packet
186
#define RETURN_READ 0x01 // Return read instruction only
187
#define RETURN_ALL 0x02 // Return all instruction
188
189
// Macro of direction
190
#define CCW_DIRECTION 0x00 // CCW direction value
191
#define CW_DIRECTION 0x01 // CW direction value
192
193
// LED state of P_LED (Motor only)
194
#define LED_OFF 0x00 // Turn off LED
195
#define LED_ON 0x01 // Turn on LED
196
197
// Torque state P_TORQUE_ENABLE (Motor only)
198
#define TORQUE_OFF 0x00 // Turn off Torque
199
#define TORQUE_ON 0x01 // Turn on Torque
200
201
// Moving state of P_MOVING (Motor only)
202
#define NOT_MOVING 0x00 // Stop state
203
#define MOVING 0x01 // Moving state
204
205
// Miscellaneous
206
#define MAKE_WORD(a, b) ((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8))
207
#define HIGH_BYTE(w) ((BYTE) (((WORD) (w) >> 8) & 0xFF))
208
#define LOW_BYTE(w) ((BYTE) (w))
209
#define MAKE_VALUE(d, v) ((WORD) (((WORD) (v)) | (((WORD) (d)) << 10)))
210
#define DIRECTION(w) ((BYTE) ((((WORD) (w)) & 0x400) >> 10))
211
#define VALUE(w) ((WORD) (((WORD) (w)) & 0x3ff))
212
213
214
/******************************************************************************************/
215
/******************************************************************************************/
216
217
#endif
src
dynamixelDefines.h
Generated on Sat Jan 31 2015 12:14:26 for DETI-Dynamixel Interface by
1.8.6