Primary VCU.
More...
|
file | can.h |
| Application-specific parts of the CAN RX/TX tasks.
|
file | constants.h |
| Constants.
|
file | rtos.h |
| RTOS task config parameter macros.
|
file | state.h |
| Car state machine.
|
file | tractive.h |
| Torque vectoring and AMK control.
|
file | vnav.h |
| VectorNav IMU/GNSS task.
|
file | can.c |
| Application-specific parts of the CAN RX/TX tasks.
|
file | freertos_utils.c |
| FreeRTOS utility functions.
|
file | rtos.c |
| Application initialization and entry point.
|
file | state.c |
| Car state machine.
|
file | tractive.c |
| Torque vectoring and AMK control.
|
file | vnav.c |
| VectorNav IMU/GNSS task.
|
Primary VCU.
/ecu/safety
Project setup instructions are in the root directory README
RE: Jamie Pruett
+1 (312) 882-5212
pruet.nosp@m.t4@i.nosp@m.llino.nosp@m.is.e.nosp@m.du
@pruett4 (Mattermost/GitLab)
Please reach out with any questions :D
CLI Quick Reference
Build code
bazel build --config=safety //ecu/safety
Generate/host HTML Doxygen documentation
http://127.0.0.1:8000
# Build HTML docs (in `bazel-bin/`)
bazel clean --expunge && bazel build --config=safety //:docs
# Build HTML docs, host a local HTTP server, and open the documentation in the default browser.
# Docs are available at http://127.0.0.1:8000, ctrl+c with the terminal focused to exit
bazel run --config=safety //:launch_docs
Refresh compilation database
Do this after adding new files/modifying Bazel targets. Generates a database of compiler commands (~= the commands Bazel runs during a build) in compile_commands.json.
# (root dir)
bazel run //:refresh_cdb
# then, ctrl+shift+p --> 'clangd: Restart Language Server'
clangd is a language server that gives VSCode full-featured C support:
- Code linting and static analysis
- Source code formatting - ctrl+shift+i
- Context-aware autocomplete
- Jump-to-definition - ctrl+click any function, variable, etc.
- IEM code standard checks
- Identifier renaming - curs
Project Overview
Resources
Firmware Repo
Mattermost
Files (GitLab)
2024-2025 Season
Confluence
Original Repository (pre-monorepo)
Setup
State Diagrams and Flowcharts
Car State Machine
---
config:
flowchart:
defaultRenderer: elk
---
flowchart TD
LV_ON-- "precharge_cplt && hv_connected" -->PRECHARGED
PRECHARGED-- "!drive_en && brake_pressed" -->BRAKE_PRESSED
BRAKE_PRESSED-- "drive_en" -->RTDS
BRAKE_PRESSED-- "!brake_pressed" -->PRECHARGED
RTDS-- "rtds_timer_cplt" -->ZOOM
ZOOM-- "apps || btsf" -->SOFT_FAULT
SOFT_FAULT-- "!(apps || btsf)" -->ZOOM
HARD_FAULT-- "!drive_en && !hf_active" -->LV_ON
PRECHARGED-- "!hv_connected" -->LV_ON
BRAKE_PRESSED-- "!hv_connected" -->LV_ON
RTDS-- "!hv_connected" -->LV_ON
ZOOM-- "!hv_connected" -->LV_ON
SOFT_FAULT-- "!hv_connected" -->LV_ON
LV_ON-- "bms || imd || bspd" -->HARD_FAULT
PRECHARGED-- "bms || imd || bspd" -->HARD_FAULT
BRAKE_PRESSED-- "bms || imd || bspd" -->HARD_FAULT
RTDS-- "bms || imd || bspd" -->HARD_FAULT
ZOOM-- "bms || imd || bspd" -->HARD_FAULT
SOFT_FAULT-- "bms || imd || bspd" -->HARD_FAULT
RTDS-- "!drive_en" -->PRECHARGED
ZOOM-- "!drive_en" -->PRECHARGED
SOFT_FAULT-- "!drive_en" -->PRECHARGED
AMK State Machine
stateDiagram-v2
AMK_INACTIVE
AMK_HV_ENABLE
AMK_INVERTER_ENABLE
AMK_ZOOM
AMK_ERROR
[*] --> AMK_INACTIVE: timeout
AMK_INACTIVE --> AMK_HV_ENABLE: ready && !timeout && !error && car_state in (PRECHARGED, BRAKE_PRESSED, RTDS, ZOOM, SOFT_FAULT)
AMK_HV_ENABLE --> AMK_INVERTER_ENABLE: hv_en_ack && car_state in (RTDS, ZOOM, SOFT_FAULT)
AMK_INVERTER_ENABLE --> AMK_ZOOM: inv_en_ack && car_state in (ZOOM, SOFT_FAULT)
AMK_HV_ENABLE --> AMK_ERROR: error
AMK_INVERTER_ENABLE --> AMK_ERROR: error
AMK_ZOOM --> AMK_ERROR: error
AMK_ERROR --> AMK_INACTIVE: !error
note left of AMK_INACTIVE
Return to this state whenever a timeout occurs (arrows omitted for clarity)
end note