Shane Smiskol 20d823d18a controlsState: add override state with grey border (#24030)
* Squashed commit of the following:

commit f0cf822666fb8f78a486d721fe474e8f37da6970
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Apr 4 17:24:00 2022 -0700

    clean up

commit 4364bdb79b1b055daa7542267eb3f37740723fd4
Merge: d448664cf e85f82af3
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Apr 4 17:21:41 2022 -0700

    Merge remote-tracking branch 'upstream/master' into override-alert-type

commit d448664cfdacbdfd3c99f8e12d96f2ba7b24abb5
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Apr 4 17:20:44 2022 -0700

    revert tests changes

commit 40ab8c2d912ccbeb12286ca272e3737656388ac8
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 19:03:39 2022 -0700

    sort

commit 5abd4448b420e91eda57e3c4edb6794893dab42f
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 19:02:59 2022 -0700

    bump cereal

commit fcffc42082b1460676554924461c63c881c31501
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 19:02:25 2022 -0700

    pass in CI

commit f47dd63bc597e18c05d2d9365eb996c13ec70c17
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 12:06:00 2022 -0700

    update refs

commit f1c54e16ccfa37f770b422ad77e2fc940f8ea7f2
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 11:51:04 2022 -0700

    move to tuple

commit bebafc6ed223a67e59daa7c2105f8cb28c4f9c5f
Merge: b0578dc54 0e983562d
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 11:45:19 2022 -0700

    Merge remote-tracking branch 'upstream/master' into override-alert-type

commit b0578dc54f9d943e0ab2182b0b79d076129468a7
Author: Shane Smiskol <shane@smiskol.com>
Date:   Fri Apr 1 11:44:37 2022 -0700

    make global variables of states in controlsd

    make global variables of states in controlsd

commit 32b7e293e88f001ef44c9197dfc68b7240ae129e
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 23:41:41 2022 -0700

    test individual event types

    fix

commit 1fbf66fc8ba7e5a0a25d34a1f30a2cb3ccb86a02
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 23:03:09 2022 -0700

    clean up

    test state machine

    test state machine

commit 33856bef69b1c2e637e58032b1358f275a6cd6bb
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 22:59:05 2022 -0700

    clean up

commit d64cd664980edd6cff0038379a5c3965409ebda0
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 22:40:25 2022 -0700

    test few more things

commit 72a3e57a9a8813b348a8ae9648e283983f7ba56b
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 22:17:22 2022 -0700

    default transitions

commit ce0051fde8296dab6417d9ef175fdf039d09a8f3
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 22:05:21 2022 -0700

    remove

commit 56de4f8a87e9b96dd99739772da1dddaa873ceb1
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 22:05:15 2022 -0700

    this way we can test any combo of event types

commit bdfd47738e5a3c0e22817047cc2d804ca0fe2785
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 21:36:33 2022 -0700

    add some state machine tests

commit 81a72d1773b204cc984fb0631ac30fb00555962d
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 17:43:03 2022 -0700

    update refs

commit 00018708714b156c29f963011a6193fa9028b308
Merge: fa97ffa67 fa934d846
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 17:31:51 2022 -0700

    Merge remote-tracking branch 'upstream/master' into override-alert-type

commit fa97ffa67eec1556b2b255ee68bdf46fc101596e
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 31 17:30:23 2022 -0700

    revert todo

commit b0dcd49b0b0254a4754ddc5ea61618246686327d
Author: Shane Smiskol <shane@smiskol.com>
Date:   Wed Mar 30 00:07:11 2022 -0700

    move back

commit ef12853ceed8c8aa37b16af406e510d172269226
Author: Shane Smiskol <shane@smiskol.com>
Date:   Tue Mar 29 23:09:05 2022 -0700

    bump cereal

commit 2658f557e2fac79563b74385b8676a659f31f7dc
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Mar 28 20:54:48 2022 -0700

    fix

commit ed2db85acd34cd78017c6bae0db5df3356c2c19c
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Mar 28 20:47:18 2022 -0700

    add alert to pass unit tests

commit dc970f55f5f69ecbca7095099bd50ff21ba02610
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Mar 28 20:26:18 2022 -0700

    bump

commit e9a3c73d61590120cc5e5c16a3d1a0bbbd51e19d
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Mar 28 20:25:33 2022 -0700

    normal

commit 4ecfbf18d5e6436f9be6bd3b1c4ea3bca8c1a572
Merge: 47e0ad3cb 02b968ed9
Author: Shane Smiskol <shane@smiskol.com>
Date:   Mon Mar 28 20:14:08 2022 -0700

    Merge remote-tracking branch 'upstream/master' into override-alert-type

commit 47e0ad3cbe4fee81b7a6e4c284973c25b144ddf7
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 24 10:50:34 2022 -0700

    only rename

commit 8c46435630c1bfba5c5b911bc1d3c8d4b24c9fdd
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 24 10:49:26 2022 -0700

    bump cereal

commit eb48440843d6a4b09e1f34d8eb2ed4c7f7a8274c
Author: Shane Smiskol <shane@smiskol.com>
Date:   Thu Mar 24 10:29:49 2022 -0700

    fix

commit 231afe3e6f211e866216a557f2ec2787760d2607
Author: Shane Smiskol <shane@smiskol.com>
Date:   Wed Mar 23 23:57:40 2022 -0700

    clean up

commit 7a3f49db1bdb58c8ef59a9376306ef1157ba2e57
Author: Shane Smiskol <shane@smiskol.com>
Date:   Wed Mar 23 23:57:10 2022 -0700

    fix logic

commit eab4f8b46e6c22033ac4ae433b6ba94e6a4ff322
Author: Shane Smiskol <shane@smiskol.com>
Date:   Wed Mar 23 21:05:05 2022 -0700

    clean up

commit 51e189a27268364e051c6d9231ae6f181ec7f95b
Author: Shane Smiskol <shane@smiskol.com>
Date:   Wed Mar 23 20:51:23 2022 -0700

    override state testing

* clean up
old-commit-hash: 2624b4cb27
2022-04-04 18:02:27 -07:00
2022-03-23 16:42:04 -07:00
2022-04-01 20:59:15 -07:00
2022-03-30 12:09:38 -07:00
2022-03-25 17:27:30 -07:00
2022-03-31 12:50:17 -07:00
2022-03-31 17:16:15 -07:00
2022-04-01 15:12:54 -07:00
2021-01-05 12:50:23 -08:00
2020-01-17 10:25:50 -08:00
2022-01-12 23:07:06 -08:00
2020-06-15 16:49:18 -07:00
2022-01-10 23:14:30 -08:00
2020-05-11 10:40:49 -07:00
2020-01-17 10:22:00 -08:00
2022-02-08 19:48:14 -08:00
2021-10-07 16:32:44 -07:00
2020-01-17 10:22:00 -08:00
2020-05-28 15:05:04 -07:00
2021-12-01 15:37:59 -08:00
2020-05-14 15:36:56 -07:00

Table of Contents


What is openpilot?

openpilot is an open source driver assistance system. Currently, openpilot performs the functions of Adaptive Cruise Control (ACC), Automated Lane Centering (ALC), Forward Collision Warning (FCW) and Lane Departure Warning (LDW) for a growing variety of supported car makes, models and model years. In addition, while openpilot is engaged, a camera based Driver Monitoring (DM) feature alerts distracted and asleep drivers. See more about the vehicle integration and limitations.

Running in a car

To use openpilot in a car, you need four things

  • This software. It's free and available right here.
  • One of the 150+ supported cars. We support Honda, Toyota, Hyundai, Nissan, Kia, Chrysler, Lexus, Acura, Audi, VW, and more. If your car is not supported, but has adaptive cruise control and lane keeping assist, it's likely able to run openpilot.
  • A supported device to run this software. This can be a comma two, comma three, or if you like to experiment, a Ubuntu computer with webcams.
  • A way to connect to your car. With a comma two or three, you need only a car harness. With an EON Gold or PC, you also need a black panda.

We have detailed instructions for how to install the device in a car.

Running on PC

All of openpilot's services can run as normal on a PC, even without special hardware or a car. To develop or experiment with openpilot you can run openpilot on recorded or simulated data.

With openpilot's tools you can plot logs, replay drives and watch the full-res camera streams. See the tools README for more information.

You can also run openpilot in simulation with the CARLA simulator. This allows openpilot to drive around a virtual car on your Ubuntu machine. The whole setup should only take a few minutes, but does require a decent GPU.

Community and Contributing

openpilot is developed by comma and by users like you. We welcome both pull requests and issues on GitHub. Bug fixes and new car ports are encouraged. Check out the contributing docs.

Documentation related to openpilot development can be found on docs.comma.ai. Information about running openpilot (e.g. FAQ, fingerprinting, troubleshooting, custom forks, community hardware) should go on the wiki.

You can add support for your car by following guides we have written for Brand and Model ports. Generally, a car with adaptive cruise control and lane keep assist is a good candidate. Join our Discord to discuss car ports: most car makes have a dedicated channel.

Want to get paid to work on openpilot? comma is hiring.

And follow us on Twitter.

User Data and comma Account

By default, openpilot uploads the driving data to our servers. You can also access your data through comma connect. We use your data to train better models and improve openpilot for everyone.

openpilot is open source software: the user is free to disable data collection if they wish to do so.

openpilot logs the road facing cameras, CAN, GPS, IMU, magnetometer, thermal sensors, crashes, and operating system logs. The driver facing camera is only logged if you explicitly opt-in in settings. The microphone is not recorded.

By using openpilot, you agree to our Privacy Policy. You understand that use of this software or its related services will generate certain types of user data, which may be logged and stored at the sole discretion of comma. By accepting this agreement, you grant an irrevocable, perpetual, worldwide right to comma for the use of this data.

Safety and Testing

  • openpilot observes ISO26262 guidelines, see SAFETY.md for more details.
  • openpilot has software in the loop tests that run on every commit.
  • The code enforcing the safety model lives in panda and is written in C, see code rigor for more details.
  • panda has software in the loop safety tests.
  • Internally, we have a hardware in the loop Jenkins test suite that builds and unit tests the various processes.
  • panda has additional hardware in the loop tests.
  • We run the latest openpilot in a testing closet containing 10 comma devices continuously replaying routes.

Directory Structure

.
├── cereal              # The messaging spec and libs used for all logs
├── common              # Library like functionality we've developed here
├── docs                # Documentation
├── opendbc             # Files showing how to interpret data from cars
├── panda               # Code used to communicate on CAN
├── third_party         # External libraries
├── pyextra             # Extra python packages
└── selfdrive           # Code needed to drive the car
    ├── assets          # Fonts, images, and sounds for UI
    ├── athena          # Allows communication with the app
    ├── boardd          # Daemon to talk to the board
    ├── camerad         # Driver to capture images from the camera sensors
    ├── car             # Car specific code to read states and control actuators
    ├── common          # Shared C/C++ code for the daemons
    ├── controls        # Planning and controls
    ├── debug           # Tools to help you debug and do car ports
    ├── locationd       # Precise localization and vehicle parameter estimation
    ├── logcatd         # Android logcat as a service
    ├── loggerd         # Logger and uploader of car data
    ├── modeld          # Driving and monitoring model runners
    ├── proclogd        # Logs information from proc
    ├── sensord         # IMU interface code
    ├── test            # Unit tests, system tests, and a car simulator
    └── ui              # The UI

Licensing

openpilot is released under the MIT license. Some parts of the software are released under other licenses as specified.

Any user of this software shall indemnify and hold harmless Comma.ai, Inc. and its directors, officers, employees, agents, stockholders, affiliates, subcontractors and customers from and against all allegations, claims, actions, suits, demands, damages, liabilities, obligations, losses, settlements, judgments, costs and expenses (including without limitation attorneys fees and costs) which arise out of, relate to or result from any use of this software by user.

THIS IS ALPHA QUALITY SOFTWARE FOR RESEARCH PURPOSES ONLY. THIS IS NOT A PRODUCT. YOU ARE RESPONSIBLE FOR COMPLYING WITH LOCAL LAWS AND REGULATIONS. NO WARRANTY EXPRESSED OR IMPLIED.


openpilot tests Total alerts Language grade: Python Language grade: C/C++ codecov

Languages
Python 70.6%
C++ 21.7%
C 2.2%
Cap'n Proto 1.9%
Shell 1.6%
Other 1.9%