Tetrapod Project
motor_constants.h
Go to the documentation of this file.
1 #ifndef motor_constants_h
2 #define motor_constants_h
3 
4 // Gear ratio between the inner DC motor and output shaft
5 const double GEAR_REDUCTION = 6.0;
6 
7 // Angle in degrees traveled by the output shaft per revolution of the inner DC motor
8 const double ROTATION_DISTANCE = 60.0;
9 
10 // Baudrate used by the motors
11 const int MOTOR_BAUD_RATE = 1000000;
12 
13 // Number of encoder values for one revolution of the inner motor
14 const int MAX_ENCODER_VALUE = 65535; // 16 bit encoders are used in the motors 2^16 -> [0, 65536]
15 
16 // Maximum possible torque current
17 const int MAX_TORQUE_CURRENT = 1200;
18 
19 // Torque corresponding to maximum torque current
20 const double MAX_TORQUE = 26.88;
21 
22 // The address of a motor with ID = n is given by: address of motor n = MOTOR_ADDRESS_OFFSET + n
23 #define MOTOR_ADDRESS_OFFSET 0x140
24 
25 // The initial multi turn angle is either in the interval [0, 60] or >> 60
26 const double MULTI_TURN_THRESHOLD = 60.0; //
27 
28 // A list of the different motor command ids defined in the motor
29 #define MOTOR_COMMAND_READ_PID_PARAMETERS 0x30
30 #define MOTOR_COMMAND_WRITE_PID_PARAMETERS_TO_RAM 0x31
31 #define MOTOR_COMMAND_WRITE_PID_PARAMETERS_TO_ROM 0x32
32 #define MOTOR_COMMAND_READ_ACCELERATION 0x33
33 #define MOTOR_COMMAND_WRITE_ACCELERATION_TO_RAM 0x34
34 #define MOTOR_COMMAND_READ_ENCODER_POSITION 0x90
35 #define MOTOR_COMMAND_WRITE_ENCODER_POSITION_OFFSET 0x91
36 #define MOTOR_COMMAND_WRITE_CURRENT_POSITION_TO_ROM 0x19
37 #define MOTOR_COMMAND_READ_MULTI_TURN_ANGLE 0x92
38 #define MOTOR_COMMAND_READ_SINGLE_CIRCLE_COMMAND 0x94
39 #define MOTOR_COMMAND_READ_MOTOR_STATUS_1_AND_ERROR_FLAG 0x9A
40 #define MOTOR_COMMAND_CLEAR_MOTOR_ERROR_FLAG 0x9B
41 #define MOTOR_COMMAND_READ_MOTOR_STATUS_2 0x9C
42 #define MOTOR_COMMAND_READ_MOTOR_STATUS_3 0x9D
43 #define MOTOR_COMMAND_MOTOR_OFF 0x80
44 #define MOTOR_COMMAND_MOTOR_STOP 0x81
45 #define MOTOR_COMMAND_MOTOR_RUNNING 0x88
46 #define MOTOR_COMMAND_TORQUE_CLOSED_LOOP 0xA1
47 #define MOTOR_COMMAND_SPEED_CLOSED_LOOP 0xA2
48 #define MOTOR_COMMAND_POSITION_CLOSED_LOOP_1 0xA3
49 #define MOTOR_COMMAND_POSITION_CLOSED_LOOP_2 0xA4
50 #define MOTOR_COMMAND_POSITION_CLOSED_LOOP_3 0xA5
51 #define MOTOR_COMMAND_POSITION_CLOSED_LOOP_4 0xA6
52 
53 #endif
const int MAX_ENCODER_VALUE
const double MAX_TORQUE
const double MULTI_TURN_THRESHOLD
const int MAX_TORQUE_CURRENT
const int MOTOR_BAUD_RATE
const double GEAR_REDUCTION
const double ROTATION_DISTANCE