Versions Compared

Key

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

...

  • listens on the CAN network for mci data. (interrupt driven)

  • sends it on the car’s internal CAN network. (can happen when the interrupt goes off)

relay_rx - not needed by mc_interface

  • sets gpio state

  • will have a guard (precharge status can be used here)

    • Need to successfully disable

  • reads from it

  • acks message

  • will be a library

drive_rx

  • receive messages (only drive state) and keep a global state, also raise events

  • calls fsm directly with the event to change state

  • if already in drive and is set to drive, just return ok

...

  • receives cruise messages: on, off, increase, decrease

  • raises event

mci_output

...

output

  • soft timer output behaviour is defined as follows for the drive state

...

  • from the table, the key values are:

    • brake_threshold: currently unknown

    • throttle/regen_threshold: currently_unknown

    • MAX_REGEN: 1.0f

    • MAX_REGEN_IN_THROTTLE: currently unknown

    • MAX_CURRENT: 1.0f

drive_output_fsm

  • has a can rx handler that processes an event directly upon drive state message

    • acks the message upon transitioning

    • allows repeat state commands (i.e. being set to drive while in drive is fine)

  • has another rx handler that processes fault messages

    • goes to neutral

    • acks the message

  • states:

    • off

      • off → drive: drive event gets raised from a drive state message.

      • off → reverse: reverse event gets raised from drive state message.

    • drive

      • drive → off: must happen immediately, can happen using a method and calling fsm_process_event explicitly.

      • drive → reverse: reverse event gets raised from drive state message. (filtered at center console)

      • drive → cruise: cruise control ON message gets received.

    • reverse

      • reverse → drive: trivial (filtered at center console)

    • cruise:

      • cruise → cruise:

        • increase/decrease target speed

      • cruise → drive:

        • cancellation: through brake/throttle press

architecture:

  • have a repeating soft_timer for outputting to the motor controller.

  • body of soft_timer will be as follows:

    • if internal state is drive/reverse, make drive/reverse commands.

    • if internal state is cruise, make cruise commands and handle cruise logic (checking pedals)

  • soft_timer is cancelled when we’re in off.

  • uses heartbeat_rx library

storage:

  • precharge_status

  • drive_state

Incoming CAN Messages

Message ID

Parameters

CAR_DRIVE_STATE

u_8 drive_staet

BEGIN_PRECHARGE

THROTTLE_OUTPUT

SET_RELAY_STATES

BRAKE_PRESSED

CRUISE_CONTROL_COMMAND

POWERTRAIN_HEARTBEAT

...