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 0 |
Enable the longitudinal control. | |
#define | EN_REMOTE_CTRL 0 |
Enable 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 | IMP_DUR 100 |
Impulse duration (ms). | |
#define | IMP_AMP -10.0 |
Impulse amplitude (A). | |
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_LONG_CTRL 0 |
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 IMP_AMP -10.0 |
Impulse amplitude (A).
#define IMP_DUR 100 |
Impulse duration (ms).
#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 STEERVEL_RATIO (-36.0*1.25) |
Speed ratio of steer velocity.
Values from Simulink model.
#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).