MBot Software Library  v1.0
An API documentation to mbot_firmware repository
mbot_params.h
1 #ifndef MBOT_PARAM_DEFS_H
2 #define MBOT_PARAM_DEFS_H
3 
4 #define MBOT_ERROR -1
5 #define MBOT_OK 0
6 #define COMMS_ERROR 0
7 #define COMMS_OK 1
8 #define MBOT_TIMEOUT_US 1000000
9 
10 
11 #define SYS_CLOCK 125000 //system clock in kHz
12 #define PWM_FREQ 10000
13 #define MAIN_LOOP_HZ 25.0 // Hz of control loop
14 #define MAIN_LOOP_PERIOD (1.0f / MAIN_LOOP_HZ)
15 
16 
17 // Hardware Parameters
18 #define GEAR_RATIO 78.0
19 #define ENCODER_RES 40.0 // 40.0 for ROB103 encoders
20 
21 #define DIFFERENTIAL_DRIVE 1
22 #define OMNI_120_DRIVE 2 // 3 omni wheels spaced 120deg
23 #define ACKERMAN_DRIVE 3
24 
25 // MBot Classic Parameters
26 #define DIFF_WHEEL_DIAMETER 0.0837
27 #define DIFF_WHEEL_RADIUS 0.04183
28 #define DIFF_BASE_RADIUS 0.07786
29 #define DIFF_MOTOR_LEFT_SLOT 0 // Left motor using M0 slot
30 #define DIFF_MOTOR_RIGHT_SLOT 1 // Right motor using M1 slot
31 #define UNUSED_DIFF_MOTOR_SLOT 2 // defined for mbot classic, 2 means M2 slot
32 
33 // MBot Omni Parameters
34 // #define OMNI_OLD_BASE_RADIUS 0.094 // radius of wheel centers (old bot)
35 #define OMNI_BASE_RADIUS 0.10843 // Radius of base, from center of base to middle of omni wheels
36  // Base radius to outer surface on wheel is 0.1227
37 #define OMNI_WHEEL_RADIUS 0.048 // 0.050 for old wheels
38 //#define OMNI_MOTOR_ANGLE_LFT (-M_PI / 3.0f) // Left wheel rotation axis (-60 degrees)
39 //#define OMNI_MOTOR_ANGLE_BCK (M_PI) // Back wheel rotation axis (180 degrees)
40 //#define OMNI_MOTOR_ANGLE_RGT (M_PI / 3.0f) // Right wheel rotation axis (60 degrees)
41 #define OMNI_MOTOR_ANGLE_LFT (-M_PI / 6.0f) // Left wheel velocity angle (-30 degrees)
42 #define OMNI_MOTOR_ANGLE_BCK (M_PI / 2.0f) // Back wheel velocity angle (90 degrees)
43 #define OMNI_MOTOR_ANGLE_RGT (-5.0 * M_PI / 6.0f) // Right wheel velocity angle (-150 degrees)
44 #define INV_SQRT3 5.7735026918962575E-1
45 #define SQRT3 1.732050807568877
46 
47 typedef struct mbot_params_t{
48  int robot_type;
49  float wheel_radius;
50  float wheel_base_radius;
51  float gear_ratio;
52  float encoder_resolution;
53  int mot_left;
54  int mot_right;
55  int mot_back;
56  int motor_polarity[3];
57  int encoder_polarity[3];
58  float slope_pos[3];
59  float itrcpt_pos[3];
60  float slope_neg[3];
61  float itrcpt_neg[3];
63 
64 
65 
66 #endif
Definition: mbot_params.h:47