SendTritium Task#
The SendTritium task currently houses our velocity control code. It utilizes a FSM to coordinate what messages should be sent to the motor controller depending on a certain set of input variables. This FSM depends on data from across the system, such as: - The Pedals - The switches - The CAN messages from BPS (indicates whether we can regen brake or not)
- group SendTritium
Defines
-
MOTOR_MSG_PERIOD 100#
-
FSM_PERIOD 100#
-
DEBOUNCE_PERIOD 2#
-
MOTOR_MSG_COUNTER_THRESHOLD (MOTOR_MSG_PERIOD)/(FSM_PERIOD)#
-
FOREACH_Gear(GEAR)
GEAR(FORWARD_GEAR), \
GEAR(NEUTRAL_GEAR), \
GEAR(REVERSE_GEAR), \
#
Enums
Functions
-
float mapToPercent(uint8_t input, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max)#
Linearly map range of integers to another range of integers, and provide the pecentage result. in_min to in_max is mapped to out_min to out_max.
- Parameters:
input – input integer value
in_min – minimum value of input range
in_max – maximum value of input range
out_min – minimum value of output range
out_max – maximum value of output range
- Returns:
float value from (out_min / 100.0) to (out_max / 100.0)
-
struct TritiumState#
-
MOTOR_MSG_PERIOD 100#