Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Drive commands to the MCI:

Code Block
languageyaml
id: // drive state from center console
data:
  state: enum(off, drive, reverse, cruise)
  target_vel: float m/s

// pedal state from pedal
data:
  throttle: float (0.0 - 1.0)
  brake: float (0.0 - 1.0)

Also takes CAN messages from pedal board to determine motor current percent (torque). This only happend when MCI is in the drive/reverse state

...

Code Block
id: 
target:
data:
// these are updated every 200ms
  velocity: uint8_t (m/s)float
  rpm: int16_t (-32,766 - 32,767)float
  bus_voltage_v: uint16_tfloat
  bus_current_a: uint16_tfloat
  mc_limit_bitset: uint8_t
  mc_error_bitset: uint8_t

// these are updated every second
  motor_temp_c: int8_tfloat
?   heatsink_temp_c: int8_t ?float
  dsp_temp_c: int8_t ?float

Messages to center console

Code Block
1:
- velocity left: uint16 int16 (m/s * 100)
- velocity right: uint16 int16 (m/s * 100)
2:
- voltage left: uint16 (v * 100)
- current left: uint16 (A * 100)
- voltage right: uint16 (v * 100)
- current right: uint16 (A * 100)
3:
- limit_bitset left: uint8_t
- error_bitset left: uint8_t
- limit_bitset right: uint8_t
- error_bitset right: uint8_t
- board_fault bitset: uint8_t
- overtemp bitset: uint8_t
4:
- motor_temp left: uint16_t (C * 100)
- heatsink_temp left: uint16_t (C * 100)
- motor_temp right: uint16_t (C * 100)
- heatsink_temp right: uint16_t (C * 100)
5:
- dsp_temp left: uint32_t (C * 100)
- dsp_temp right: uint32_t

FSM

There will be fsm to make sure state transitions are valid, valid transitions are

...

FSM starts in the off state

off → drive, reverse

drive → cruise (only when speed is within a CRUISE_SPEED_MIN and CRUISE_SPEED_MAX), off, reverse (only when speed is 0)

cruise → off, drive

...

 (C * 100)