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_GOAL_POSITION_L = 30
00079 DXL_GOAL_POSITION_H = 31
00080 DXL_GOAL_SPEED_L = 32
00081 DXL_GOAL_SPEED_H = 33
00082 DXL_TORQUE_LIMIT_L = 34
00083 DXL_TORQUE_LIMIT_H = 35
00084 DXL_PRESENT_POSITION_L = 36
00085 DXL_PRESENT_POSITION_H = 37
00086 DXL_PRESENT_SPEED_L = 38
00087 DXL_PRESENT_SPEED_H = 39
00088 DXL_PRESENT_LOAD_L = 40
00089 DXL_PRESENT_LOAD_H = 41
00090 DXL_PRESENT_VOLTAGE = 42
00091 DXL_PRESENT_TEMPERATURE = 43
00092 DXL_REGISTERED_INSTRUCTION = 44
00093 DXL_PAUSE_TIME = 45
00094 DXL_MOVING = 46
00095 DXL_LOCK = 47
00096 DXL_PUNCH_L = 48
00097 DXL_PUNCH_H = 49
00098 DXL_SENSED_CURRENT_L = 56
00099 DXL_SENSED_CURRENT_H = 57
00100
00101
00102 DXL_RETURN_NONE = 0
00103 DXL_RETURN_READ = 1
00104 DXL_RETURN_ALL = 2
00105
00106
00107 DXL_PING = 1
00108 DXL_READ_DATA = 2
00109 DXL_WRITE_DATA = 3
00110 DXL_REG_WRITE = 4
00111 DXL_ACTION = 5
00112 DXL_RESET = 6
00113 DXL_SYNC_WRITE = 131
00114
00115
00116 DXL_BROADCAST = 254
00117
00118
00119 DXL_INSTRUCTION_ERROR = 64
00120 DXL_OVERLOAD_ERROR = 32
00121 DXL_CHECKSUM_ERROR = 16
00122 DXL_RANGE_ERROR = 8
00123 DXL_OVERHEATING_ERROR = 4
00124 DXL_ANGLE_LIMIT_ERROR = 2
00125 DXL_INPUT_VOLTAGE_ERROR = 1
00126 DXL_NO_ERROR = 0
00127
00128
00129 DXL_MIN_COMPLIANCE_MARGIN = 0
00130 DXL_MAX_COMPLIANCE_MARGIN = 255
00131
00132 DXL_MIN_COMPLIANCE_SLOPE = 0
00133 DXL_MAX_COMPLIANCE_SLOPE = 254
00134
00135
00136 DXL_MIN_PUNCH = 0
00137 DXL_MAX_PUNCH = 255
00138
00139 DXL_MODEL_TO_NAME = \
00140 {
00141 113: 'DX-113',
00142 116: 'DX-116',
00143 117: 'DX-117',
00144 12: 'AX-12+',
00145 18: 'AX-18F',
00146 10: 'RX-10',
00147 24: 'RX-24F',
00148 28: 'RX-28',
00149 64: 'RX-64',
00150 107: 'EX-106+',
00151 29: 'MX-28',
00152 }
00153
00154 KGCM_TO_NM = 0.0980665
00155 DXL_MAX_TORQUE_TICK = 1023
00156 DXL_MODEL_TO_TORQUE = \
00157 {
00158 113: ( 10 * KGCM_TO_NM) / 12.0,
00159 116: ( 21 * KGCM_TO_NM) / 12.0,
00160 117: ( 37 * KGCM_TO_NM) / 18.5,
00161 12: ( 15 * KGCM_TO_NM) / 12.0,
00162 18: ( 18 * KGCM_TO_NM) / 12.0,
00163 10: ( 13 * KGCM_TO_NM) / 12.0,
00164 24: ( 26 * KGCM_TO_NM) / 12.0,
00165 28: ( 37 * KGCM_TO_NM) / 18.5,
00166 64: ( 52 * KGCM_TO_NM) / 18.5,
00167 107: (107 * KGCM_TO_NM) / 18.5,
00168 29: ( 24 * KGCM_TO_NM) / 12.0,
00169 }
00170
00171 RPM_TO_RADSEC = 0.104719755
00172 DXL_MAX_SPEED_TICK = 1023
00173 DXL_MODEL_TO_MAX_VELOCITY = \
00174 {
00175 113: ( 54 * RPM_TO_RADSEC) / 12.0,
00176 116: ( 78 * RPM_TO_RADSEC) / 12.0,
00177 117: ( 85 * RPM_TO_RADSEC) / 18.5,
00178 12: ( 59 * RPM_TO_RADSEC) / 12.0,
00179 18: ( 97 * RPM_TO_RADSEC) / 12.0,
00180 10: ( 54 * RPM_TO_RADSEC) / 12.0,
00181 24: (126 * RPM_TO_RADSEC) / 12.0,
00182 28: ( 85 * RPM_TO_RADSEC) / 18.5,
00183 64: ( 64 * RPM_TO_RADSEC) / 18.5,
00184 107: ( 91 * RPM_TO_RADSEC) / 18.5,
00185 29: ( 54 * RPM_TO_RADSEC) / 12.0,
00186 }
00187