How rakeshbb08/openpilot works
Main components
• Hardware Interface & Sensors:
– Components in the “system” folder such as system/camerad (camera data acquisition), system/hardware (hardware abstraction for both device and car platforms), and system/sensord (sensor reading and processing) stand out.
– The “panda” and “boardd” related directories handle CAN communication and safety. These modules interface directly with the car’s electrical and sensor systems.
• Perception and Processing Pipelines:
– The “common” library supports many functions (logging, conversions, parameters, and shared utilities) used across these modules.
• Car Interface & Safety:
– The “selfdrive/car” directory contains interface and controller code for various car makes and models. It implements the car-specific abstractions and safety rules.
– Additionally, “selfdrive/athena” and “selfdrive/boardd” include code for monitoring and safety-critical function.
• User Interface & Monitoring:
– “selfdrive/ui” contains both on‑road (real‑time driving display) and off‑road user interfaces built with QT/C++.
• Process Management and Infrastructure:
– “system/loggerd”, “system/logcatd”, “system/proclogd”, “system/qcomgpsd”, “system/ubloxd”, etc. show how lower level data logging, GPS handling, and inter‑process communications are organized.
– There is an orchestration of multiple processes (each presumably communicating via IPC or shared memory) that together provide a full pipeline from sensing to actuation.
Understand the relationships between components
– Sensors (cameras, CAN bus, IMU, etc.) are handled by low‑level system modules (camerad, sensord, hardware) and then their data is passed up to the processing pipelines.
– The “modeld” process ingests pre‑processed sensor data to perform deep learning inference for prediction and planning.
– The “controls” module takes inputs from modeld and/or sensor fusion modules (like locationd) to calculate actuator commands.
– The “car” components interface with specific vehicle hardware and safety layers to perform actuation.
– “loggerd” and “debug” modules collect execution and sensor data, sometimes providing data for monitoring, replay, or analysis (extensively supported by numerous tools in the “tools” directory).
– There are also external services (comma connect, data upload) that are part of the overall ecosystem even if not implemented as strictly “internal” modules.
Architectural patterns and design principles
– The system follows a modular, multi‑process design where each major functional block runs as an independent process communicating with others.
– Layers include a hardware abstraction/sensor layer, a perception/decision layer, and a control/actuation layer.
– Shared libraries ("common”) serve as the glue between components, while configuration, safety checks, and extensive testing (both unit and hardware‑in‑the‑loop tests) are integral parts of the design.
– The design accommodates multiple car makes/models via abstraction in “selfdrive/car” and the use of language bindings (e.g., Cython in some modules under “common” and “modeld”).
Elements
– Annotate interactions such as logging (to loggerd), safety data collection, and inter‑process communications among modules.
– Optionally, include “tools” and “third_party” libraries in a separate section to denote auxiliary functions (e.g., simulation, debugging, testing, and external libraries used to support various functionalities).