Eecs 4314 Conceptual Architecture Report
Eecs 4314 Conceptual Architecture Report
Eecs 4314 Conceptual Architecture Report
Authors:
Student No. Name of the author Author’s email
Abstract:
This conceptual architecture report provides a thorough overview of openpilot.
Openpilot is a powerful open-source driver assistance system. The report gives a
high-level overview of the system’s structure, functionality, and interactions among its
parts. The report examines openpilot’s essential components and the overall
functionality of the system. We look into how the different subsystems of the system
including hardware and software interact and communicate with each other to provide
the functionality offered by the system. To facilitate a newcomer’s understanding of
openpilot, the report includes a sequence diagram to show the interaction between
processes during one of its main use cases. The sequence diagrams give a visual
picture of the system’s interactions and processes, which makes it simpler to
understand its functionality. The report also includes a state diagram to provide an
insight into one of the salient features of openpilot that ensure the driver is attentive at
all times to take over the vehicle if need be. We finish off by analyzing how the
architecture of the system affects how work is distributed among developers which is of
utmost importance here since this is an open source project and anyone can contribute
to making it better.
Furthermore, openpilot offers various features from adaptive cruise control to automated
lane centering. The massive software is built on various technologies such as machine
learning, computer vision, and automotive engineering. Additionally, the massive
open-source project codebase is built on the foundation of various design patterns and
a well-defined architectural style. At the core, openpilot embraces effective means to
enhance scalability, maintainability, and modularity.
openpilot requires either a comma device or a PC running Linux or Windows to run the
software, it also requires a car harness to allow the software to interact with the car's
CAN buses [1] [2] [3] [4]. All the hardware required is sold separately by comma and
supported for 1 year after the next generation is sold [5]. The software is marketed as a
driver assistant rather than fully automatic driving, requiring driver attention at all times
[1]. A camera is located within the comma device and uses machine learning to monitor
the driver and ensure their attention is maintained at all times [1].
3
Comma stores a list of cars with known functionality with openpilot as a tab on their
main website and under a repository named OpenDBC and tools to add cars not on the
list [6] [7]. Comma generally recommends using newer generations of Toyota and
Hyundai cars as the majority of cars they have confirmed connectivity with belong to
those brands [6]. The Hyundai brand encompasses Hyundai, Kia, and Genesis totaling
89 cars with confirmed support while the Toyota brand encompasses Toyota and Lexus
totaling 66 more cars [6] [8].
openpilots' main functionality stems from the communication between their hardware or
a client's personal computer if they choose, the open-source software, and a car's
built-in hardware. Openpilot offers features such as adaptive cruise control and
automated lane centering with the communication between the software and a car's
CAN buses. The CAN buses on modern cars allow for commands to control electronic
steering and the pedals openpilot takes full advantage of to offer its assistance [1].
This paper will delve deeper into the conceptual design of openpilot’s development.
Focusing on key elements which is the high-level architecture, each subsystem, the
derivation of its architectural style, integration of design patterns, and other various
topics. It will explore the abstract foundation that empowers openpilot’s advanced driver
assistance system; providing insights into the collaborative efforts that developed the
system.
High-Level Architecture:
Openpilot, developed by comma.ai, represents a forefront integration of hardware and
software components designed to augment the driving experience through advanced
automation features. This system, conceptualized to enhance vehicle safety and
operational efficiency, embodies a complex interplay of services that seamlessly interact
to execute its functionalities.
Before diving into the intricacies of how all the different components interact with each
other to provide safe autonomous driving assistance we can understand how software
for autonomous driving can work. We should be able to read data from sensors, make a
decision about what to do given the data collected, and then act upon the decision using
actuators like accelerators or steering.
4
Description of subsystems -
The system has four main components/subsystems: Sensors and Actuators,
Localization and Calibration, Neural network runner, and Controls. Here is an overview
of each of these:
1. Sensors and Actuators: The sensors and actuators component sets up the first
link with the surroundings and gathers important information for later use. At the
heart of openpilot's ecosystem is the boardd service, which acts as the primary
liaison between the main device and the panda, an interface device facilitating
communication with the car's peripherals. The peripherals, including the GNSS
module for global positioning, infrared LEDs for driver monitoring under low light
conditions, and the vehicle's electronic systems, are crucial for the holistic
operation of openpilot. Through boardd, data from these peripherals is funneled
into the system, serving as a foundational input for subsequent processing
and decision-making. The camerad service is pivotal in managing the visual
aspects of openpilot's operation. It handles the acquisition of visual data from
multiple cameras aimed at the road ahead and the driver, ensuring optimal image
quality through autofocus and auto-exposure techniques. This visual data is
essential for both navigation and monitoring driver attentiveness. The integration
with visionipc allows for efficient distribution of image data across the system,
minimizing latency and overhead in data handling. Sensory input extends
beyond visual cues, with the sensord service dedicated to configuring and
reading data from gyroscopes, accelerometers, magnetometers, and light
sensors. This multi-dimensional sensory input provides a comprehensive
understanding of the vehicle's dynamics and environmental conditions,
enhancing the system's decision-making capabilities.
5
The flowchart below visualizes the openpilot system's architecture, illustrating how
data flows from hardware inputs through various components, leading to the
execution of control commands in the car. Starting with boardd, which interfaces with
the car and its peripherals, data flows through camera and sensor management
modules (camerad and sensord), into the neural network processing for driving
decisions and driver monitoring (modeld and dmonitoringmodeld). Localization and
calibration services (ubloxd/locationd and calibrationd/paramsd) refine the system's
understanding of the vehicle's position and orientation, allowing plannerd to plan the
path. Finally, controlsd translates these plans into specific control signals,
executing commands in the car. This end-to-end process encapsulates the intricate
orchestration of data and decisions within openpilot, enabling advanced driver
assistance functionalities.
6
Referring to the figure above, the bottom layer consists of sensors that are installed in
the car that send messages to CAN that are relayed over the comma3 device by a
hardware component called Panda. The openpilot software runs multiple software
processes that communicate with others and exhibit different architectural styles and
design patterns that are discussed later. These software modules also work
independently and interact with others using specified interfaces and protocols. All
messages to and from the panda are managed by the boardd background process.
boardd publishes these messages for other processes to use. The processes also
include radard, plannerd, and controlsd which play an important role in monitoring radar
messages, planning the car’s path, and converting plans to CAN messages. These
processes use our Neural Network Runners that provide real-time feedback to our
system. These runners are critical in terms of performance since they need to respond
instantaneously to navigate the car depending on the situation. The neural models also
need to be accurate and consistent and they are optimized and trained in parallel using
the driving data from drivers using openpilot’s system. The layered architectural
approach makes sure that each component has its own domain and can be developed
and enhanced independently of each other as long the interfaces remain the same. This
promotes high cohesion with clearly defined roles for each module, ensuring modularity
and efficiency in enhancing the overall driving experience.
the subscribers that receive notifications about the event and updates the display to
reflect the changes
Design Pattern -
One of the main design patterns that can be observed in the system is Facade design
in the software processes. The comma3 device acts as a client in this example and
does not interact with any of the sub-modules running or is aware of how they are
implemented. The device only sends data to the boardd module and that publishes
them to all the sub-modules that interact with each other and return CAN messages that
can be sent to the car by boardd via Panda.
Concurrency -
openpilot uses continuous integration to automatically test code changes, ensuring
safety, stability, and reliability as it evolves with new features and fixes. For instance,
before implementing parallel CI tests, openpilot required 35 minutes to complete its test
suite, significantly slowing development. By adopting parallelization, testing time was
reduced to just 3 minutes on CI servers and 10 minutes on local machines. This change
has dramatically increased the speed of the development cycle, providing quicker
feedback to developers and enhancing the project's agility and efficiency. Another
instance is openpilot's machine learning models, crucial for interpreting sensor data and
9
making driving decisions, being trained and executed in parallel to respond in real-time
when sensory inputs come in for a decision.
Use Cases:
UC 1 - Adaptive Cruise Control (ACC) -
Scenario: A user traveling at a high speed on the highway wants AI to handle the car
and maintain the speed accordingly. The user is willing to trust the openpilot system to
handle the speed and steering while they sit back and enjoy the ride.
Solution: The user can engage openpilot's Adaptive Cruise Control (ACC) feature,
which allows them to relax while maintaining a safe distance from the vehicle in front
(lead car distance) and adjusts the vehicle’s speed accordingly.
Using a combination of sensors, including stock sensors and comma sensors, along
with sophisticated software components like boardd, radard, plannerd, and controlsd,
ACC processes real-time data to maintain a safe distance from the vehicle ahead,
adjusts speed accordingly, and navigates traffic flow with precision. The communication
between openpilot and your car is facilitated by the CAN bus and Panda interface,
ensuring accurate translation of commands for optimal performance.
UC 2 - Driver Monitoring -
Scenario: A user wants to go on a long road trip from one city to another. The road trip
comprises multiple stops and long hours of driving on the highway. The user is excited
to embark on this journey but also a little worried as it is their first time driving this far
and of all the challenges that the road trip poses, like fatigue and distractions.
Solution: The user can activate the openpilot system in their car, which includes a
robust feature of driver monitoring. The system utilizes sensors and cameras to monitor
the behavior and attentiveness of the driver while the driver is on the road.
Through facial recognition and tracking algorithms, the system can detect the driver’s
head positions, eye movements, head positions, etc. These measures are fed into a
neural network model that has been trained over a large dataset of drive behavior. The
model then classifies the user into different categories such as attentive or distracted
and issues alerts to prompt the driver to regain attentiveness. Since the model is
designed to adapt to various driving conditions, the user can adjust the sensitivity of the
system based on road complexity, traffic density, etc.
Using the driver monitoring feature, the user can travel smoothly without any worries.
11
As seen in Figure 6, the project currently has 198 issues, and 92 Pull requests
(explained in the next paragraph). This is one of the implications of division of
responsibilities and collaboration.
In addition, under the Pull requests tab, we can see other developers' branches that
contain extra code and functionalities. If the branch passes the code review check, it
can be merged into the main (or an upper-level) branch. This also shows developers
can collaborate and add new specifications to the main project.
Furthermore, a set of rules for written communication among the developers can be
found in the repository within a file named CONTRIBUTING.md. [13] These rules and
definitions make collaborations, feature requests, bug report readings, and code
reviews easier. In addition, you can fork the project on Github from the original
repository to your copy on your profile. When you fork a project, you make a duplicate of
that project in your GitHub profile, which always references the main project. [14]
As seen in Figure 7, this project is forked ~84000 times, meaning that many developers
made duplicates of the project to make different versions and specifications of their
own.
In addition, GitHub has a feature that shows a list of all developers (contributors) on
the main page of the project repository. This is the most explicit sign of collaboration
and division of responsibilities on a Version Control system like GitHub.
13
Conclusions:
In conclusion, openpilot’s conceptual architecture offers a strong framework for
understanding the idea that drives the success of this automated driving assistance
system. As we look to the future, openpilot will continue to improve due to its ongoing
development in developer resources and community collaboration. Moreover, with
continuous improvements in neural network models that are being optimized as more
and more data comes from drivers using the system, openpilot’s popularity will keep
growing. This report acts as a guide for both novices and experts looking to understand
the architecture of an automated driving assistance system. The fundamental building
blocks and procedures that support openpilot have been demonstrated through this
report. Moreover, this report has provided new information on how openpilot works,
develops, subsystems, deals with concurrency, and the division of responsibilities
among developers. The following is a summary of our key findings:
1. Compatibility: The architecture of openpilot is built to accommodate more and
more cars and be compatible with different models of different cars. It is
openpilot’s compatibility that demonstrates the relevance it will continue to have
in the future as new upcoming models can be supported with minor changes.
2. Utilizing sequence diagrams to visualize interactions among systems: Sequence
diagrams have been crucial in giving a visual picture of the interactions between
openpilot's components during particular processes. They provide useful
perceptions of the operation of the system.
Lessons Learned:
The choice of framework to power openpilot’s machine learning is not based on
completeness of features or being the most well-known. The founder of comma.ai
George Hotz is also the founder of tinygrad, the framework used in openpilot, being the
founder of both it could be possible to create a framework that is specifically designed to
work between his projects. Tinygrad on its own has the intention of being simple to
implement and highly expandable with accelerators which allows the machine learning
of the vehicles running openpilot to be tuned to run faster for specific tasks. The
emphasis on using a data flow pattern is interesting as while the architecture of the
modules is mostly following layered there is a sequence upon startup that requires CAN
information to be passed through multiple components. The process flowing from
OpenDBC, through Cabana, to Panda, and finally to Cereal is lengthy but is most likely
important for code rigor and safety as Panda upholds the safety standards while Cereal
controls the vehicle's functions. The use of implicit invocation makes the most sense for
14
the vehicle controls as there are many sensors with multiple different functions, which
allows for straightforward packets from the controller to be sent to the sensors that
subscribe to each specific type of packet.
1. PC Personal Computer
4. UI User Interface
5. CI Continuous Integration
References:
[1] Openpilot - Open source advanced driver assistance system. comma.ai - make
driving chill. (n.d.). https://www.comma.ai/openpilot
[2] Getting started with openpilot. comma.ai blog. (2023, August 2).
https://blog.comma.ai/gettingstarted/
[8] Bartlett, J. S. (n.d.). Who owns which car brands? Consumer Reports.
https://www.consumerreports.org/cars/who-owns-which-car-brands-a5925868661/
[10] How does openpilot work?. comma.ai blog. (2017, June 26).
https://blog.comma.ai/how-does-openpilot-work/
[11] From vision to architecture: How to use openpilot and live. From Vision To
Architecture: How to use openpilot and live - DESOSA 2020. (2020, March 11).
https://desosa.nl/projects/openpilot/2020/03/11/from-vision-to-architecture
[12] How openpilot works in 2021. comma.ai blog. (2021, October 12).
https://blog.comma.ai/openpilot-in-2021/
[14] Science, T. C. for O. (n.d.). Fork a project (OSF projects). OSF Support.
https://bit.ly/3SOG198