A panda and a cabana: How to get started car hacking with comma.ai
A quick link for those who’d just like to buy a panda, otherwise read on.
When I started on this journey 2 years ago, first trying to hack my ILX to drive itself, getting your car to talk to your computer was hard. I vaguely knew cars had a CAN bus, and I also knew they had an OBDII port. So I purchased a USB to OBDII interface off Amazon.
When I plugged it in to my MacBook, it showed up as a serial interface. And it used AT commands. I found some Python code to speak this protocol, and I thought I could now talk to the car.
When the code worked (which was about 50% of the time!), the information it gave me was very limited, mostly just about the engine. Surely there had to be more…
So I dove deeper, and looked into what’s actually on the OBDII port. Sure enough, there is a CAN bus! Many of the USB to CAN transceivers were thousands of dollars, but I found a moderately priced one that gave me full access. We were in business, and I could read all the CAN messages on the bus.
At first, it was just random noise. But after a few weeks of reverse engineering, it started to make sense. I found the message broadcasting the speed. Then I found the message broadcasting the steering angle. Then, I found the message that would actually let me turn the steering wheel via software!
panda: the nicest universal car interface ever
In order to get the reliability and throughput we needed to make cars self driving, we started building our own interface hardware.
panda is the nicest universal car interface ever.
It supports 3 CAN, 2 LIN, and 1 GMLAN. It also charges a phone. On the computer side, it has both USB and Wi-Fi.
The software is 100% open. And it plugs into the OBDII port on every car made in 1996 or later.
chffr: chffr is our cloud dashcam app. It allows you to record and review your drives, in addition to helping to train self driving cars. Now if you have a panda paired with chffr, you can record all the sensors from your car. From any part of your drive, assuming your car has the sensors, you’ll be able to see how many RPM your engine was going, how much gas was in your tank, your MPG, if you had a door open, how hard you hit the brake, and much much more.
pandacan: pandacan is a user space library for talking to your car over USB or Wi-Fi from Python. It allows full read/write access to all the CAN and LIN buses. “pip install pandacan”
openpilot: openpilot, our open source driving agent, can use panda to communicate with your car and control the gas, brake, and steering on supported vehicles.
And one more piece of software is supported…
cabana: comma.ai CAN analysis tool
CAN bus analysis is what allows you to make sense of all the sensors and signals in your car. Aside from CANalyzer, which is a $10,000 proprietary Windows only tool, there is no good software for CAN analysis.
Today, with the launch of comma cabana, this changes. We’ve set our app team loose on building the best CAN analysis tool to ever exist to complement our panda hardware. And I think they’ve succeeded.
On the left, you’ll find all the signals from your car. In the middle, the signal you are currently editing. And on the right, your driving video and graphs of the signals.
cabana is already live to all panda and NEO users, who can access it by clicking the purple checkmark on the driving explorer. Everyone else can try it out on an Acura ILX demo route.
Here is a livestream of me reverse engineering the signals on my Prius using a panda and cabana (skip to near the end for the good stuff). What took weeks before now only takes hours. We’ll also be doing a livestream Friday @ noon PST. Follow us on Twitter @comma_ai for details.
Even if you have a high quality CAN interface and great CAN analysis software, it’s still some work to figure out what the messages in your car mean. But it’s work that should only be done once in the world per car.
cabana integrates with our DBC repository, opendbc. DBC is the industry standard “decoder ring” for your car, and cabana makes it easy for you to create, save, and share DBC files with the world. From cabana: you can fork the opendbc repo to your github account, make edits as you discover new things about your car, then submit a pull request to the main repo when you are ready.
Our goal is to build a repository with a DBC file for every car ever manufactured and democratize access to the decoder ring for your car.
Getting a panda
But for everyone else, for the first time in history, comma.ai is selling a product. You can order a panda for $88 shipped anywhere in the world. Your card will not be charged until your panda is ready to ship, which should be in around 4 weeks for the first to order and up to 12 weeks if you are late.