00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 __author__ = 'Cody Jorgensen, Antons Rebguns'
00037 __copyright__ = 'Copyright (c) 2010-2011 Cody Jorgensen, Antons Rebguns'
00038
00039 __license__ = 'BSD'
00040 __maintainer__ = 'Antons Rebguns'
00041 __email__ = 'anton@email.arizona.edu'
00042
00043
00044 """
00045 Dynamixel Constants
00046 """
00047
00048 DXL_MODEL_NUMBER_L = 0
00049 DXL_MODEL_NUMBER_H = 1
00050 DXL_VERSION = 2
00051 DXL_ID = 3
00052 DXL_BAUD_RATE = 4
00053 DXL_RETURN_DELAY_TIME = 5
00054 DXL_CW_ANGLE_LIMIT_L = 6
00055 DXL_CW_ANGLE_LIMIT_H = 7
00056 DXL_CCW_ANGLE_LIMIT_L = 8
00057 DXL_CCW_ANGLE_LIMIT_H = 9
00058 DXL_DRIVE_MODE = 10
00059 DXL_LIMIT_TEMPERATURE = 11
00060 DXL_DOWN_LIMIT_VOLTAGE = 12
00061 DXL_UP_LIMIT_VOLTAGE = 13
00062 DXL_MAX_TORQUE_L = 14
00063 DXL_MAX_TORQUE_H = 15
00064 DXL_RETURN_LEVEL = 16
00065 DXL_ALARM_LED = 17
00066 DXL_ALARM_SHUTDOWN = 18
00067 DXL_OPERATING_MODE = 19
00068 DXL_DOWN_CALIBRATION_L = 20
00069 DXL_DOWN_CALIBRATION_H = 21
00070 DXL_UP_CALIBRATION_L = 22
00071 DXL_UP_CALIBRATION_H = 23
00072 DXL_TORQUE_ENABLE = 24
00073 DXL_LED = 25
00074 DXL_CW_COMPLIANCE_MARGIN = 26
00075 DXL_CCW_COMPLIANCE_MARGIN = 27
00076 DXL_CW_COMPLIANCE_SLOPE = 28
00077 DXL_CCW_COMPLIANCE_SLOPE = 29
00078 DXL_D_GAIN = 26
00079 DXL_I_GAIN = 27
00080 DXL_P_GAIN = 28
00081 DXL_GOAL_POSITION_L = 30
00082 DXL_GOAL_POSITION_H = 31
00083 DXL_GOAL_SPEED_L = 32
00084 DXL_GOAL_SPEED_H = 33
00085 DXL_TORQUE_LIMIT_L = 34
00086 DXL_TORQUE_LIMIT_H = 35
00087 DXL_PRESENT_POSITION_L = 36
00088 DXL_PRESENT_POSITION_H = 37
00089 DXL_PRESENT_SPEED_L = 38
00090 DXL_PRESENT_SPEED_H = 39
00091 DXL_PRESENT_LOAD_L = 40
00092 DXL_PRESENT_LOAD_H = 41
00093 DXL_PRESENT_VOLTAGE = 42
00094 DXL_PRESENT_TEMPERATURE = 43
00095 DXL_REGISTERED_INSTRUCTION = 44
00096 DXL_PAUSE_TIME = 45
00097 DXL_MOVING = 46
00098 DXL_LOCK = 47
00099 DXL_PUNCH_L = 48
00100 DXL_PUNCH_H = 49
00101 DXL_SENSED_CURRENT_L = 56
00102 DXL_SENSED_CURRENT_H = 57
00103
00104
00105 DXL_RETURN_NONE = 0
00106 DXL_RETURN_READ = 1
00107 DXL_RETURN_ALL = 2
00108
00109
00110 DXL_PING = 1
00111 DXL_READ_DATA = 2
00112 DXL_WRITE_DATA = 3
00113 DXL_REG_WRITE = 4
00114 DXL_ACTION = 5
00115 DXL_RESET = 6
00116 DXL_SYNC_WRITE = 131
00117
00118
00119 DXL_BROADCAST = 254
00120
00121
00122 DXL_INSTRUCTION_ERROR = 64
00123 DXL_OVERLOAD_ERROR = 32
00124 DXL_CHECKSUM_ERROR = 16
00125 DXL_RANGE_ERROR = 8
00126 DXL_OVERHEATING_ERROR = 4
00127 DXL_ANGLE_LIMIT_ERROR = 2
00128 DXL_INPUT_VOLTAGE_ERROR = 1
00129 DXL_NO_ERROR = 0
00130
00131
00132 DXL_MIN_COMPLIANCE_MARGIN = 0
00133 DXL_MAX_COMPLIANCE_MARGIN = 255
00134
00135 DXL_MIN_COMPLIANCE_SLOPE = 1
00136 DXL_MAX_COMPLIANCE_SLOPE = 254
00137
00138
00139 DXL_MIN_PUNCH = 0
00140 DXL_MAX_PUNCH = 255
00141
00142 DXL_MAX_SPEED_TICK = 1023
00143 DXL_MAX_TORQUE_TICK = 1023
00144
00145 KGCM_TO_NM = 0.0980665
00146 RPM_TO_RADSEC = 0.104719755
00147
00148
00149
00150 DXL_MODEL_TO_PARAMS = \
00151 {
00152 113: { 'name': 'DX-113',
00153 'encoder_resolution': 1024,
00154 'range_degrees': 300.0,
00155 'torque_per_volt': 1.0 / 12.0,
00156 'velocity_per_volt': (54 * RPM_TO_RADSEC) / 12.0,
00157 },
00158 116: { 'name': 'DX-116',
00159 'encoder_resolution': 1024,
00160 'range_degrees': 300.0,
00161 'torque_per_volt': 2.1 / 12.0,
00162 'velocity_per_volt': (78 * RPM_TO_RADSEC) / 12.0,
00163 },
00164 117: { 'name': 'DX-117',
00165 'encoder_resolution': 1024,
00166 'range_degrees': 300.0,
00167 'torque_per_volt': 3.7 / 18.5,
00168 'velocity_per_volt': (85 * RPM_TO_RADSEC) / 18.5,
00169 },
00170 12: { 'name': 'AX-12',
00171 'encoder_resolution': 1024,
00172 'range_degrees': 300.0,
00173 'torque_per_volt': 1.5 / 12.0,
00174 'velocity_per_volt': (59 * RPM_TO_RADSEC) / 12.0,
00175 },
00176 18: { 'name': 'AX-18',
00177 'encoder_resolution': 1024,
00178 'range_degrees': 300.0,
00179 'torque_per_volt': 1.8 / 12.0,
00180 'velocity_per_volt': (97 * RPM_TO_RADSEC) / 12.0,
00181 },
00182 10: { 'name': 'RX-10',
00183 'encoder_resolution': 1024,
00184 'range_degrees': 300.0,
00185 'torque_per_volt': 1.3 / 12.0,
00186 'velocity_per_volt': (54 * RPM_TO_RADSEC) / 12.0,
00187 },
00188 24: { 'name': 'RX-24',
00189 'encoder_resolution': 1024,
00190 'range_degrees': 300.0,
00191 'torque_per_volt': 2.6 / 12.0,
00192 'velocity_per_volt': (126 * RPM_TO_RADSEC) / 12.0,
00193 },
00194 28: { 'name': 'RX-28',
00195 'encoder_resolution': 1024,
00196 'range_degrees': 300.0,
00197 'torque_per_volt': 3.7 / 18.5,
00198 'velocity_per_volt': (85 * RPM_TO_RADSEC) / 18.5,
00199 },
00200 64: { 'name': 'RX-64',
00201 'encoder_resolution': 1024,
00202 'range_degrees': 300.0,
00203 'torque_per_volt': 5.3 / 18.5,
00204 'velocity_per_volt': (64 * RPM_TO_RADSEC) / 18.5,
00205 },
00206 107: { 'name': 'EX-106',
00207 'encoder_resolution': 4096,
00208 'range_degrees': 250.92,
00209 'torque_per_volt': 10.9 / 18.5,
00210 'velocity_per_volt': (91 * RPM_TO_RADSEC) / 18.5,
00211 },
00212 29: { 'name': 'MX-28',
00213 'encoder_resolution': 4096,
00214 'range_degrees': 360.0,
00215 'torque_per_volt': 2.5 / 12.0,
00216 'velocity_per_volt': (55 * RPM_TO_RADSEC) / 12.0,
00217 },
00218 310: { 'name': 'MX-64',
00219 'encoder_resolution': 4096,
00220 'range_degrees': 360.0,
00221 'torque_per_volt': 6.0 / 12.0,
00222 'velocity_per_volt': (63 * RPM_TO_RADSEC) / 12.0,
00223 },
00224 320: { 'name': 'MX-106',
00225 'encoder_resolution': 4096,
00226 'range_degrees': 360.0,
00227 'torque_per_volt': 8.4 / 12.0,
00228 'velocity_per_volt': (45 * RPM_TO_RADSEC) / 12.0,
00229 },
00230 }
00231