Hacking my own car: Lessons learnt after a few months of setbacks.
I have spent the past few months understanding the self driving car field., studying at Udacity’s Self Driving Car Nanodegree program and testing out hardware for my Ford Fusion.
Below is a series of lessons learnt that took hours, days or weeks of setbacks. Please feel free to call me out on things that I state as facts but are only my biased opinion.
- USB cables should not be more than 4 meters long
- Can buses need a 120 Ohm termination resistor
- Several USB cameras connected to a USB hub is a bad idea, use physical USB sockets on the motherboard.
- Latency matters, data from a USB3.0 cameras can take a long time before reaching the GPU.
- Being able to tweak the camera drivers is important, Gigabit Ethernet cameras give you less flexibility and there is not much you can do about dropped frames.
- MIPI cameras are a godsend, they allow you to have super fast (several gigabytes!) badnwidth directly to the RAM.
- Can buses are good, dual can buses are great. They allow you to be able to separate key traffic in order to be able to ‘replace’ a factory module like the LKAS or the ACC. Get an Arduino due with dual can. ($70)
- If you know nothing about your car’s can bus, get an adapter from Kvaser with a buffer to help you not loose precious packets. ($350)
- If you know what you are looking for in your car’s can bus, get a CANable / CANtact, the are great if you can just filter what you are listening to. ($20 / $60).
- A desktop with a GTX1080/1070 and any half decent processor plus SSD hard drive is enough for you to train on a simulator. It is faster than the smallest Amazon machines and can let you run interesting games like GTA V.
- The best platform for your car is an Nvidia Jetson TX2, it gives you MIPI cameras that could reach 300 fps at low resolution, has dual can buses, runs TensorRT, consumes little power and most important of all fits on the globe compartment so the camera cables do not have to be long.
- Choose a camera with good linux support, look at the list of UVC supported cameras. I settled for the Logitech 930c ($150).
- Lidars are very expensive, they are very useful for mapping an unknown are where you are going to test. If your area is not mapped at all, you should try to get data with a Velodyne HDL-64E, but only very especialized companies are able to make a rectified map with little drift after collection. If you know how to do it, please write about it and release open source packages. ($60K?).
- Garmin lidar lite ($150) is a 2D lidar that is a good option for just detecting obstacles. If your area is already mapped, this should be enough.
- If you are a small fish, most companies working on self driving cars will just ignore your emails.
- If you are a n00b, most knowledgeable hackers will just tell you things like ‘if you know where to look …’ or ‘just put a sniffer on X module’. Read this whole thread if you are just getting started on hacking your can bus, it has links to a lot of interesting material: https://github.com/commaai/openpilot/issues/1
- If you are interested in open source software / hardware, self driving cars and have a day job. PLEASE, PLEASE, PLEASE stay on that job and help us put as much information out there as we can, this is a big opportunity for outsiders (people doing career switch, emerging countries, NGOs) to get into this field but as soon as people taking on jobs with the big guys we can safely assume they will blog less and have more private github repos.
- Buses are key: can buses, ROS topics, ZeroMQ Pub-sub, it is all about modules sending information without defining who is going to listen to it. Cars are very interesting distributed systems.
- Get a hybrid or electric car if you want, unfortunately none of those were an option where I live. But you are going to need a lot of electric power for sensors and it is not easy to create your own version.
- Safety first, make sure you add a panic button to you car that would disconnect the power on the modules you have added. When things go wrong you should still be able to get back home. Do not override the car’s safety features like making it harder to turn when you are at high speed.
- If you are buying a car, make sure you get one that is Automatic, has LKAS, Park assist, and Adaptive Cruise Control. You do not want to add home grown brake-by-wire or gas-by-wire while you are still learning.
That’s it for now, on my next article I will detail the hardware I have running on my car along with a suggested budget.