Openpilot on Prius Prime
in robotics and tagged carI've recently installed a Comma 3X into my Prius Prime. The device runs openpilot, an open-source driver assistance system. There are several things to appreciate about the ecosystem:
- Reverse engineering of a car's signals
- Injecting signals into the car
- Tuning of steering, acceleration, etc.
- Machine learning models for predicting a human driver
- Many useful tools
- And much more...
Newer models of the Prius come with something advertised as "Toyota Safety Sense" (TSS-P), which includes various sensors and actuators to, for example, nudge the steering wheel when crossing road lines. Openpilot is able to capitalize on the pre-existing system and send its own commands, such as to rotate the steering wheel.
Now, out-of-the-box openpilot is able to provide lateral control, e.g., rotate the steering wheel, by substituting the commands sent by the Forward Recognition Camera (FRC). The wire harness that is installed lets the Comma filter the signals sent by the FRC and replace them. However, the longitudinal control, such as accelerating or braking, will be handled by Toyota's Driver Support Unit (DSU). This module is responsible for controlling radar cruise and automatic emergency braking. To obtain similar functionality, we need another device that filters the messages sent by the DSU. This device, "Smartened DSU" (SDSU), does exactly that. On the Prius Prime, the SDSU is located above the glove box, which you can access by removing the glove box (also how to change the cabin air filter).
The wire harness splits some signals to travel directly, while filtering some signals to instead to travel through the SDSU to be filtered.
I tested the harness to make sure all the wires were properly connected by doing a continuity test one-by-one. Thankfully everything worked. Here is resulting schematic of the wiring from my testing.
Another possibility, however, is to reroute the DSU bus through the camera harness that openpilot uses. This would remove the need for SDSU, and instead let openpilot handle the filtering as usual. Members of the community have done exactly that. I may pursue this option in the future...
Recently, upstream openpilot decided to remove support for the community-made SDSU hardware. Fortunately, as with the nature of open source, popular forks maintain support for SDSU hardware. I settled with the Frogpilot fork, which IMO has the most transparent development as well as sane defaults and explanation of features.
Unfortunately, TSS-P cars have a weak steering assist motor and a lower resolution steering sensor. This causes two issues:
- A slight ping-pong motion when traveling on the interstate
- A lower turning radius that openpilot is able to perform
Some of these limitations are somewhat mitigated by smarter software, such as automatically slowing down before a curve.
In the newer TSS 2.0 system, the motor and the sensor have been upgraded. In principle, it may be possible to replace the weak stock motor and sensor with an upgraded one.
Stay tuned...