Skip to content

Enhance openpilot longitudinal control with an external radar add-on.

License

Notifications You must be signed in to change notification settings

eFiniLan/openpilot-ext-radar-addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openpilot External Radar Addon

Overview

This project enables sensor fusion in openpilot by integrating an external radar. The radar is mounted on the windshield and connected to the vehicle's OBD2 port for both power and signal transmission. With openpilot also connected to the OBD2 port, it can read radar data, enhancing its perception capabilities.

Why This Project?

Some vehicles with openpilot installed can only use Vision-Only Adaptive Cruise Control (VOACC). By adding an external radar to the car, sensor fusion enables more accurate lead car speed detection and distance measurement, significantly improving safety and performance.

The guide and code are designed for Toyota vehicles. If using a different vehicle, you will need:

  • Modify the code to use the correct CAN channel.
  • Adjust the distance from the vehicle front to the radar if mounting in front of the vehicle.
  • Ensure CAN message compatibility to avoid conflicts with the vehicle's existing communication.

Prerequisites

Before installing this addon, ensure you have the following:

  • A car that already has openpilot installed.
  • The car must support openpilot longitudinal control.
  • The car does not have radar support. (e.g. Nissan, Volkswagen, Mazda, Subaru...)
  • A comma 3 or 3X device with the OLD comma power (which supports sending and receiving CAN messages via the OBD2 port).
  • A comma 3 or 3X running openpilot version 0.9.8 or above.

Bill of Materials (BOM)

  1. Radar, ~$236 USD
  2. GoPro Accessories:
  3. Male OBD2 Cable w/ Open Pins, ~$3.00 USD
  4. 4 Pins Phoenix Type Connector, ~$2.00 USD

Installation

Hardware Build

Wiring

0ad176a15aa93dfece0d144b085280f1

Radar Mount

91f0ffd1e2a280c6983ec02e0e43d259

Mounting Example

cf6ec2886d137ccc931ce7a3d0f34eae

Hardware Setup

  1. Mount the Radar: Secure the radar unit onto the windshield.
  2. Connect to OBD2 Port: Use the provided adapter to link the radar’s signal and power to the OBD2 port.

Wiring Diagram

Connect the radar and openpilot to the OBD2 cable as follows:

OBD2 Cable Pin Radar Cable openpilot Cable
Pin 14 CAN L (green) CAN L (green)
Pin 6 CAN H (yellow) CAN H (yellow)
Pin 5 Ground (black) Ground (black)
Pin 16 12V (red) 12V (red)

Software Setup (tested on 0.9.8)

opendbc/dbc/u_radar.dbc

Upload to /data/openpilot/opendbc/dbc/u_radar.dbc

opendbc/dbc/u_radar_config.py

  1. Upload to /data/openpilot/opendbc/dbc/u_radar_config.py
  2. Change radar settings:
# manually terminate openpilot
tmux a
press "<ctrl> + c" several times

# apply settings
cd /data/openpilot/opendbc/dbc/ && python u_radar_config.py 

opendbc/car/radar_interface.py

Upload to /data/openpilot/opendbc/car/radar_interface.py

Apply panda change

  1. upload panda.diff to /data
  2. Apply changes:
cd /data/openpilot/panda && git apply ../../panda.diff

Apply card.py change

  1. upload panda.diff to /data
  2. Apply changes:
cd /data/openpilot/ && git apply ../card.diff

Notes

  1. Mounting Bracket: The provided mounting bracket is designed as a temporary solution to allow easy adjustment and removal of the radar unit.
  2. Power Management: Due to the nature of the OBD2 port, it will constantly provide power to the radar. To prevent battery drain, it is recommended to add a power switch to disconnect the radar when not in use.

Contributing

Contributions are welcome! Please submit issues or pull requests to improve functionality.

License

This project is licensed under MIT Non-Commercial License.

See the LICENSE file for complete details.

Acknowledgments

Thanks to the openpilot community for ongoing support and development.