SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
Loading...
Searching...
No Matches
User paramters

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.
 

Detailed Description

User-defined parameters.

Definition of the user-defined paramters and other miscellanous constants.

Macro Definition Documentation

◆ CPU_FREQ

#define CPU_FREQ   600e6

CPU clock speed (Hz). /warning Maximum value is 816e6 without cooling.

See also
https://www.pjrc.com/store/teensy40.html

◆ CW

#define CW   LOW

Digital pin state for clockwise torque.

◆ EN_LONG_CTRL

#define EN_LONG_CTRL   0

Enable the longitudinal control.

◆ EN_REMOTE_CTRL

#define EN_REMOTE_CTRL   0

Enable the remote controller.

◆ FULLEXT_FORKDISP

#define FULLEXT_FORKDISP   0

Fork displacement at full extended suspension (in mm).

◆ IMP_AMP

#define IMP_AMP   -10.0

Impulse amplitude (A).

See also
IMP_TEST

◆ IMP_DUR

#define IMP_DUR   100

Impulse duration (ms).

See also
IMP_TEST

◆ MTR_CTRL_MODE

#define MTR_CTRL_MODE   1

Control mode of steer motor (0=PWM or 1=DAC).

Warning
This setting must be consistent with ESCON Studio.

◆ NAN_VAL

#define NAN_VAL   0xFFC00000

NaN value used for invalid data.

◆ NUM_ZERO_SAMPLES

#define NUM_ZERO_SAMPLES   500

Samples used to perform the zero of sensors.

◆ STEERVEL_RATIO

#define STEERVEL_RATIO   (-36.0*1.25)

Speed ratio of steer velocity.

Values from Simulink model.

◆ YINCL_MCUBOX

#define YINCL_MCUBOX   1.3426

Pitch iinclination of MCU box (in rad).

Value of 76.928deg, found from a static calibration with the IMU.

Variable Documentation

◆ imu_rotMat

const float imu_rotMat[3][3]
Initial value:
= { {0, -cosf(YINCL_MCUBOX), -sinf(YINCL_MCUBOX)},
{-1, 0, 0},
{0, sinf(YINCL_MCUBOX), -cosf(YINCL_MCUBOX)} }
#define YINCL_MCUBOX
Pitch iinclination of MCU box (in rad).
Definition config.h:344

Rotation matrix from IMU frame to SAE body-fixed frame.

This is the result of Rz(90deg)*Rx(180deg)*Ry(YINCL_MCUBOX).

See also
YINCL_MCUBOX

◆ mag_rotMat

const float mag_rotMat[3][3]
Initial value:
= { {cosf(YINCL_MCUBOX), 0, sinf(YINCL_MCUBOX)},
{0, -1, 0},
{-sinf(YINCL_MCUBOX), 0, cosf(YINCL_MCUBOX)} }

Rotation matrix from MAG frame to SAE body-fixed frame.

This is the result of Ry(180deg)*Ry(YINCL_MCUBOX).

See also
YINCL_MCUBOX