-
Notifications
You must be signed in to change notification settings - Fork 0
Localisation Board
BL-CZY edited this page Sep 8, 2026
·
2 revisions
- Board used: STM32F767ZI
-
Function: Real-time localisation using sensor fusion (Keyence stripe counters, optical flow, and accelerometers) to compute pod displacement, velocity, and acceleration. The computed data is broadcast via CAN to other boards. Additionally, the firmware implements end-of-track braking logic: when the navigation system is armed, it sends a
EndOfTrackBrakeCAN message once the pod reaches half the track length.
To read more about how it uses the kalman filter to predict the pod's movement data, see Kalman Filter
| Sensor | Pins | Address | Wiring photo | Type |
|---|---|---|---|---|
| Keyence 1 | PC13 (digital input, pull-down) | N/A | - | GPIO |
| Keyence 2 | PC14 (digital input, pull-down) | N/A | - | GPIO |
| Optical Flow | SPI1: PB3(SCK), PB5(MOSI), PB4(MISO), PA4(CS) | N/A | - | SPI |
| Accelerometers | I2C1: PB8(SDA), PB9(SCL) + MUX reset PB15 | Depends on mux | - | I2C |
| CAN | PD0 (RX), PD1 (TX) | N/A | - | CAN |
| Event | Action |
|---|---|
StartPropulsionAccelerationCommand |
Arms navigation: sets NAVIGATION_ARMED = true and resets END_OF_TRACK_BRAKE_SENT flag. |
StartPropulsionBrakingCommand |
Disarms navigation (NAVIGATION_ARMED = false) and spawns send_stopped_status after 2 s. |
EndOfTrackBrakeCommand |
Disarms navigation (NAVIGATION_ARMED = false) and spawns send_stopped_status after 2 s. |
(internal) displacement ≥ ½ track length and NAVIGATION_ARMED
|
Sends CanMessage::EndOfTrackBrake once (atomic guard). |
| Task name | Description | Sensors used | EHW Compliance |
|---|---|---|---|
main (async) |
Main entry point. Initialises board, sets up CAN, SPI, I2C, spawns all sensor and comms tasks, runs the localisation loop (every 100 ms). | Keyence, Optical Flow, Accelerometers | TBC |
can_receiver |
Receives CAN messages and forwards them to the event bus. | CAN (Rx) | TBC |
can_sender |
Sends CAN messages from a queue (including measurement readings and brake commands). | CAN (Tx) | TBC |
send_heartbeat |
Periodically sends a heartbeat CAN message to indicate board health. | None (only CAN) | TBC |
navigation_command_task |
Listens for events (StartPropulsionAccelerationCommand, StartPropulsionBrakingCommand, EndOfTrackBrakeCommand) and updates state flags accordingly. | None (event bus) | TBC |
read_optical_flow |
Reads optical flow data from SPI and publishes to OPTICAL_FLOW_DATA watch. |
Optical Flow (SPI) | TBC |
read_keyence (×2) |
Polls a Keyence input pin and publishes stripe count to respective watch (KEYENCE_1_STRIPE_COUNT, KEYENCE_2_STRIPE_COUNT). |
Keyence (GPIO) | TBC |
read_accelerometers_from_mux |
Reads all accelerometers via I2C multiplexer and publishes raw data to ACCELEROMETERS_DATA watch. |
Accelerometers (I2C) | TBC |
send_stopped_status |
Waits 2 seconds, then sends a PropulsionStatus CAN message with zero values (indicating pod stopped). |
None (only CAN) | TBC |