The openpilot cloud and connectivity layer enables remote device management, data telemetry, and live interaction between the vehicle and the comma cloud infrastructure. This system is designed to operate over various network conditions, prioritizing critical data and maintaining security through authenticated communication channels.
The connectivity stack is composed of three primary daemons that handle different aspects of the device's relationship with the cloud:
athenad: A WebSocket daemon that maintains a persistent connection to comma's servers for remote management and JSON-RPC command execution openpilot/system/athena/athenad.py43-44uploader.py: A background process responsible for delivering drive logs and camera segments to cloud storage.webrtcd: A high-performance streaming daemon used for low-latency video and audio transmission, typically for remote teleoperation or live views.The following diagram illustrates the relationship between the primary connectivity processes and the external cloud entities they interact with, specifically highlighting the JSON-RPC dispatcher used in athenad.
Sources: openpilot/system/athena/athenad.py31-44 openpilot/system/athena/rpc.py20-28 openpilot/common/params_keys.h16
athenad acts as the primary gateway for remote interaction. It maintains a persistent WebSocket connection to ATHENA_HOST openpilot/system/athena/athenad.py43
Key responsibilities include:
echo openpilot/system/athena/athenad.py128 and startLocalProxy for SSH tunneling openpilot/system/athena/athenad.py208Params class to manage persistent state like AthenadUploadQueue openpilot/system/athena/athenad.py158-170 and AthenadRecentlyViewedRoutes openpilot/common/params_keys.h16-17PriorityQueue of UploadItem objects to manage data delivery, with support for priority levels where lower numbers indicate higher priority openpilot/system/athena/athenad.py100-125 openpilot/system/athena/athenad.py131For details, see Athena Remote Management.
The logging system ensures that driving data is safely offloaded from the device to prevent storage exhaustion while providing developers with data for model training and debugging.
user.upload) to track upload status across reboots openpilot/system/athena/athenad.py47-48UPLOAD_TOS (0x20) for low-priority background traffic openpilot/system/athena/athenad.py63-77cloudlog openpilot/system/athena/athenad.py37 openpilot/system/athena/athenad.py163Offroad_ConnectivityNeeded or Offroad_UnregisteredHardware openpilot/selfdrive/selfdrived/alerts_offroad.json6-27For details, see Log Upload and Data Pipeline.
The webrtcd daemon provides a low-latency pipeline for streaming video and bidirectional messaging. This is used for remote vehicle monitoring and the "Body" robot platform.
roadCameraState, driverCameraState, and wideRoadCameraState for remote inspection openpilot/system/camerad/snapshot.py10-14VisionIpcClient allows the connectivity layer to grab real-time images from the camera pipeline openpilot/system/camerad/snapshot.py47-67For details, see WebRTC and Body Teleop.
Many connectivity features rely on the Params system for cross-process state management and the Api class for authenticated requests.
| Entity | Role | File Reference |
|---|---|---|
Params | Persistent storage for upload queues and DongleId | openpilot/common/params_keys.h16-35 |
Api | Handles RSA key pair retrieval for device authentication | openpilot/system/athena/athenad.py31 |
UploadItem | Dataclass representing a file pending cloud delivery | openpilot/system/athena/athenad.py100-115 |
dispatcher | JSON-RPC method registry for remote commands | openpilot/system/athena/rpc.py20-28 |
Sources: openpilot/system/athena/athenad.py153-174 openpilot/system/athena/rpc.py90-117
Sources:
openpilot/system/athena/athenad.pyopenpilot/system/athena/rpc.pyopenpilot/common/params_keys.hopenpilot/selfdrive/selfdrived/alerts_offroad.jsonopenpilot/system/camerad/snapshot.py