Versions Compared

Key

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

...

The motor controllers (MC) are a third-party board with a custom CAN communication protocol. The MC must send and receive messages to the driver controls (DC), however because the MC protocol is strict and thorough it requires abstraction from the rest of the system. The motor controller interface (MCI) handles this abstraction.

...

MCI will receive updates on measurements of voltage and current, these will be transmitted to DC.

(Try to see if it’s possible to use can.h to control two can controllers simultaneously, if not, use mcp2515 needs to be migrated to fwxv)

Driver Controls (DC)

MCI will receive can msgs from DC requesting to set the car’s drive state. MCI then sends the message to MC.

MCI will transmit voltage and current updates to DC.the main CAN line.

Can

There will be two tasks

  • one talking to MC
    receives notifications from DC, using notify_wait to wait for an event or 200ms between MC transmissions.

  • one talking to DC

...

are two can lines, one communicates only to MC referred to as MC-CAN, the other communicate to the rest of the car referred to as CAN.

Task

  1. CAN rx, MC-CAN rx

  2. process msgs sent by CAN rx, update any states

  3. process msgs sent by MC-CAN, update any states

  4. build messages for MC-CAN and CAN

  5. CAN tx, MC-CAN tx

Can Messages

WaveSculptor’s broadcast messages can be found TritiumWaveSculptor22_Manual.pdf (tritiumcharging.com) section 18.4

WaveScultpor drive command message can be found in section 18.2

Drive commands to the MCI:

Code Block
languageyaml
id: 

MCI status messages, groups by motor controller:

Code Block
id: 
target:
data:
  velocity: uint8_t (m/s) ?
  rpm: uint16_t or uint32_t depending on motor max rpm
  bus_voltage_v: uint32_t
  bus_current_a: uint32_t
  mc_limit_bitset: uint8_t
  mc_error_bitset: uint8_t
  motor_temp_c: int8_t ?
  heatsink_temp_c: int8_t ?
  dsp_temp_c: int8_t ?

FSM

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

...

FSM starts in the off state