Tetrapod Project
config_motor_driver.h
Go to the documentation of this file.
1 #ifndef motor_driver_config_h
2 #define motor_driver_config_h
3 
4 #include "Arduino.h"
5 
6 #define SERIAL_PRINT false
7 
8 #define FRONT_LEGS true
9 #define REAR_LEGS false
10 
11 const double k_p_pos = 30.0;
12 const double k_i_pos = 15.0;
13 const double k_p_vel = 50.0;
14 const double k_i_vel = 25.0;
15 const double k_p_tor = 100.0;
16 const double k_i_tor = 50.0;
17 
18 // Set the PID gains for the motors
25 
26 
27 // Calculate offsets based on legs
28 
29 // An offset of -30 degrees is added to each actuator to compensate for the encoder zero position
30 
31 #if (FRONT_LEGS)
32  #define position_offset_motor_1 M_PI/4.0 // 45 degrees
33  #define position_offset_motor_2 0.0
34  #define position_offset_motor_3 0.0
35  #define position_offset_motor_4 -M_PI/4.0 // -45 degrees
36  #define position_offset_motor_5 0.0
37  #define position_offset_motor_6 0.0
38 #elif(REAR_LEGS)
39  #define position_offset_motor_1 M_PI*3.0/4.0
40  #define position_offset_motor_2 0.0
41  #define position_offset_motor_3 0.0
42  #define position_offset_motor_4 -M_PI*3.0/4.0
43  #define position_offset_motor_5 0.0
44  #define position_offset_motor_6 0.0
45 #else
46  #define position_offset_motor_1 0.0
47  #define position_offset_motor_2 0.0
48  #define position_offset_motor_3 0.0
49  #define position_offset_motor_4 0.0
50  #define position_offset_motor_5 0.0
51  #define position_offset_motor_6 0.0
52 #endif
53 
54 static double POSITION_OFFSET[6] =
55 {
62 };
63 
64 static int INITIAL_NUMBER_OF_MOTOR_ROTATIONS[6] = {0, 0, 0, 0, 0, 0};
65 
66 #endif
const double k_p_tor
static int INITIAL_NUMBER_OF_MOTOR_ROTATIONS[6]
#define position_offset_motor_3
static double POSITION_OFFSET[6]
const double k_i_tor
static int K_I_VEL[6]
static int K_I_POS[6]
#define position_offset_motor_1
const double k_i_vel
static int K_P_POS[6]
#define position_offset_motor_4
const double k_p_vel
#define position_offset_motor_6
static int K_P_TOR[6]
static int K_I_TOR[6]
const double k_i_pos
#define position_offset_motor_2
#define position_offset_motor_5
const double k_p_pos
static int K_P_VEL[6]