|
SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
|
User-defined parameters. More...
Macros | |
| #define | CPU_FREQ 600e6 |
| CPU clock speed (Hz). /warning Maximum value is 816e6 without cooling. | |
| #define | MTR_CTRL_MODE 1 |
| Control mode of steer motor (0=PWM or 1=DAC). | |
| #define | EN_LONG_CTRL 1 |
| Enable the longitudinal control. | |
| #define | EN_REMOTE_CTRL 0 |
| Enable the remote controller. | |
| #define | EN_BRAKE_CTRL 0 |
| Enable the brake control. | |
| #define | TEST_THROTTLE 0 |
| Test the throttle using the remote controller. | |
| #define | CW LOW |
| Digital pin state for clockwise torque. | |
| #define | NUM_ZERO_SAMPLES 500 |
| Samples used to perform the zero of sensors. | |
| #define | STEERVEL_RATIO (-36.0*1.25) |
| Speed ratio of steer velocity. | |
| #define | FULLEXT_FORKDISP 0 |
| Fork displacement at full extended suspension (in mm). | |
| #define | NAN_VAL 0xFFC00000 |
| NaN value used for invalid data. | |
| #define | YINCL_MCUBOX 1.3426 |
| Pitch iinclination of MCU box (in rad). | |
| #define | SBB_SPEED 2.5F |
| Cruise speed (m/s) | |
| #define | SBB_ROLL 0.1F |
| Turn roll angle (rad) | |
| #define | SBB_T_CRUISE 2.0F |
| Cruise time (s) | |
| #define | SBB_T_TURN 6.0F |
| Cornering time (s) | |
Variables | |
| const float | imu_rotMat [3][3] |
| Rotation matrix from IMU frame to SAE body-fixed frame. | |
| const float | mag_rotMat [3][3] |
| Rotation matrix from MAG frame to SAE body-fixed frame. | |
User-defined parameters.
Definition of the user-defined paramters and other miscellanous constants.
| #define CPU_FREQ 600e6 |
CPU clock speed (Hz). /warning Maximum value is 816e6 without cooling.
| #define CW LOW |
Digital pin state for clockwise torque.
| #define EN_BRAKE_CTRL 0 |
Enable the brake control.
| #define EN_LONG_CTRL 1 |
Enable the longitudinal control.
| #define EN_REMOTE_CTRL 0 |
Enable the remote controller.
| #define FULLEXT_FORKDISP 0 |
Fork displacement at full extended suspension (in mm).
| #define MTR_CTRL_MODE 1 |
Control mode of steer motor (0=PWM or 1=DAC).
| #define NAN_VAL 0xFFC00000 |
NaN value used for invalid data.
| #define NUM_ZERO_SAMPLES 500 |
Samples used to perform the zero of sensors.
| #define SBB_ROLL 0.1F |
Turn roll angle (rad)
| #define SBB_SPEED 2.5F |
Cruise speed (m/s)
| #define SBB_T_CRUISE 2.0F |
Cruise time (s)
| #define SBB_T_TURN 6.0F |
Cornering time (s)
| #define STEERVEL_RATIO (-36.0*1.25) |
Speed ratio of steer velocity.
Values from Simulink model.
| #define TEST_THROTTLE 0 |
Test the throttle using the remote controller.
| #define YINCL_MCUBOX 1.3426 |
Pitch iinclination of MCU box (in rad).
Value of 76.928deg, found from a static calibration with the IMU.
| const float imu_rotMat[3][3] |
Rotation matrix from IMU frame to SAE body-fixed frame.
This is the result of Rz(90deg)*Rx(180deg)*Ry(YINCL_MCUBOX).
| const float mag_rotMat[3][3] |
Rotation matrix from MAG frame to SAE body-fixed frame.
This is the result of Ry(180deg)*Ry(YINCL_MCUBOX).