How pcgomesp/aeb-swt2-final-project works
Project type and purpose
• This is an embedded control‐system project written in C for a POSIX-compliant environment.
• Purpose: an Automotive Emergency Braking (AEB) system that reads sensor inputs, computes time-to-collision (TTC), issues alarms, and triggers braking.
File structure
• Top‐level directories:
• src/ – C source modules (sensors, controller, actuators, logging, main loop)
• inc/ – Public headers (constants.h, dbc.h, file_reader.h, mq_utils.h, log_utils.h, sensors_input.h, ttc_control.h)
• test/ – Unit tests using Unity
• docs/, Doxyfile – Requirements, traceability, Doxygen config
• bin/, obj/, cov/, log/ – Build artifacts, coverage, logs
• tcs/ – Test scenario data (cenario.txt)
• Build & CI:
• Makefile orchestrates compilation, testing, coverage, docs
• .github/workflows for linting, coverage measurement, test CI
README for insights
• Modules:
• Sensors Module ⇒ reads environment data via POSIX message queues
• AEB Controller ⇒ computes TTC, applies thresholds
• Actuators Module ⇒ locks seatbelts, sounds alarm, engages brakes
• Logging ⇒ records events in log/
• POSIX-mq is the IPC mechanism.
• DBC (database of communication matrix) suggests CAN-bus data modeling.
a. Main components:
1. Sensors Module
2. Message Queue (POSIX mq)
3. AEB Controller
4. File Reader / Scenario Loader
5. DBC Parser (dbc.c)
6. TTC Computation Unit
7. Actuators Module
8. Logger
9. External Entities: Vehicle Braking System, Driver Dashboard (alarms)
b. Relationships & interactions:
• Sensors ⇒ push raw distance/speed data into a POSIX message queue
• File Reader ⇒ reads tcs/cenario.txt & posts simulated data to the queue
• AEB Controller ⇒ reads from the message queue, invokes DBC Parser (for signal definitions) and TTC Computation, decides alarm/brake commands
• Actuators Module ⇒ receives commands from Controller, issues seatbelt lock, alarm signal, and brake actuator command to Vehicle Braking System
• Logger ⇒ subscribes to Controller and Actuators events; writes structured entries to log/
c. Architectural patterns & principles:
• Modular separation: I/O (sensors, file_reader), control logic (ttc_control), and side-effects (actuators, logging)
• POSIX message queue for decoupling modules
• Single responsibility in each C module (e.g., dbc.c only parses DBC messages)
d. Key technologies/libraries:
• POSIX mq_* APIs (mq_utils.c/h)
• Standard C libraries (stdio, math)
• Unity test framework for unit tests
• Doxygen for documentation, LCOV for coverage
Detailed capture of essential elements
• Test harness as an external client calling public APIs (unity tests)