openpilot is built as a collection of independent processes that communicate through a shared message bus. Each process owns a narrow responsibility — camera capture, neural network inference, planning, or actuation — and coordinates with others only through typed messages. This design makes the system easier to reason about, test in isolation, and extend without coupling unrelated subsystems.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/commaai/openpilot/llms.txt
Use this file to discover all available pages before exploring further.
Process overview
manager.py
The system supervisor. Starts, monitors, and restarts all other processes. Tracks ignition state and transitions processes between on-road and off-road modes.
selfdrived.py
The high-level state machine. Manages openpilot’s enabled/engaged states, evaluates safety events, and publishes alerts to the UI and other processes.
controlsd.py
The low-level control loop running at 100 Hz. Runs PID and torque-based lateral controllers alongside a longitudinal controller to produce actuator commands.
modeld.py
Neural network inference for the supercombo driving model. Consumes camera frames via VisionIPC and publishes trajectory predictions and model metadata.
dmonitoringmodeld.py
Driver monitoring inference. Runs a separate neural network on the driver-facing camera to detect distraction and drowsiness.
plannerd.py
Longitudinal planning. Consumes model outputs and radar data to produce a longitudinal plan, and monitors for lane departure warnings.
pandad
CAN bus communication. Reads vehicle state from the panda hardware device and sends actuator commands back to the car via CAN frames.
camerad
Camera capture. Reads raw frames from the road-facing, wide-angle, and driver-facing cameras and publishes them over VisionIPC for model consumers.
loggerd
Route and telemetry logging. Records all cereal messages to disk for review, debugging, and upload as training data.
Process startup sequence
manager.py is the entry point for the entire system. It handles registration, parameter initialization, and supervised process lifecycle management.
manager initializes
manager.py runs manager_init(): clears stale parameters, creates shared memory paths, registers the device, and prepares all managed processes for launch.off-road processes start
Processes that run regardless of ignition — including
athenad, uploader, and updated — are started immediately.ignition detected
The manager polls
pandaStates over the message bus. When ignition is detected, it transitions to on-road mode and clears the relevant parameter flags.on-road processes start
camerad, modeld, dmonitoringmodeld, selfdrived, controlsd, plannerd, pandad, and loggerd are all started as on-road processes.selfdrived waits for CarParams
selfdrived.py blocks on CarParams being written to the params store, which happens after pandad fingerprints the connected vehicle.Inter-process communication
All processes communicate through cereal — comma’s messaging library built on Cap’n Proto schemas serialized over either ZMQ (socket-based) or msgq (shared-memory, lower latency). Each message type is defined in the cereal schema and has a single publisher. Subscribers declare which topics they consume at startup usingSubMaster, and publishers use PubMaster. This pub/sub model means processes never call each other directly — they only read and write to the message bus.
Camera frames are too large for the cereal message bus and instead travel through VisionIPC, a separate shared-memory transport.
modeld and dmonitoringmodeld subscribe to camera streams through a VisionIpcClient.| Topic | Publisher | Consumers |
|---|---|---|
carState | pandad | selfdrived, controlsd, plannerd |
modelV2 | modeld | plannerd, controlsd, selfdrived |
selfdriveState | selfdrived | controlsd, UI |
longitudinalPlan | plannerd | controlsd |
carControl | controlsd | pandad, plannerd |
driverMonitoringState | dmonitoringmodeld | selfdrived |
managerState | manager | UI, logging |
Data flow: cameras to car
The full pipeline from sensor input to actuator output follows this path:- camerad captures frames from road-facing and wide-angle cameras and publishes them to VisionIPC streams.
- modeld reads camera frames, runs the supercombo model, and publishes
modelV2— which includes predicted trajectories, velocity, and desired curvature. - plannerd subscribes to
modelV2andradarStateto build alongitudinalPlan, resolving the desired acceleration profile. - controlsd subscribes to
longitudinalPlan,modelV2, andselfdriveStateto compute lateral and longitudinal actuator commands, publishingcarControl. - pandad reads
carControland translates the actuator values into CAN frames sent to the vehicle over the panda hardware interface.
driverMonitoringState, which selfdrived uses to determine whether to issue distraction or drowsiness alerts.
Controller types
controlsd.py selects a lateral controller at startup based on the car’s CarParams:
- LatControlTorque — torque-based control, used on most supported vehicles
- LatControlPID — PID controller for lateral position
- LatControlAngle — direct steering angle control for steer-by-wire vehicles
LongControl, which computes the required acceleration and deceleration to follow the plan from plannerd.
System and selfdrive directories
The codebase is split between two top-level directories:system/— infrastructure:manager,camerad,loggerd,athena,hardwareabstraction, and update managementselfdrive/— driving logic:controls,modeld,selfdrived,locationd,monitoring, and car interfaces
