Motivation: to understand and visualize radar information using available ROS driver.
Pre-Requisites
- ROS (full desktop version or with Rviz ready)
- Delphi ESR 2.5 ROS driver by AutonomousStuff
- ROS socketcan_bridge package
- CAN device + Radar or CAN logs.
Log CAN data (skip this if you are already familiar with CAN logging using can-utils)
On Linux system, I use can-utils a lot as CAN tools that are easily run through terminal.
- Install can-ultils (socketcan):
sudo apt-get install can-utils
- Connect Linux supported CAN device to PC. You can use something like a Kvaser USB. If you have an Nvidia Jetson TX2 or Xavier, you can enable CAN bus and run ROS directly with these modules.
- Setup CAN device to 500K bitrate to connect to Delphi ESR 2.5
sudo modprobe can
sudo modprobe can_raw
sudo ip link set can0 type can bitrate 5000000
sudo ip link set up can0
To check CAN is properly set up, check:ifconfig
- When all devices are connected and running, raw CAN frames can be seen from terminal with:
candump can0
- To log data:
candump -l can0
- Playback data with a can0 interface available on the network
canplayer -I your_saved_data.log
- Playback data which previously logged with can0 with a virtual can:
First, bring up a virtual can interface: https://elinux.org/Bringing_CAN_interface_up
Thencanplayer vcan0=can0 -v -I your_saved_data.log
Install AutonomousStuff Delphi ESR Driver
Assume ROS is already installed on working machine. The ROS driver can be installed using the steps here
Here are the steps I took on my Ubuntu 18.04 running ROS Melodic
sudo apt update && sudo apt install apt-transport-https
sudo sh -c 'echo "deb [trusted=yes] https://s3.amazonaws.com/autonomoustuff-repo/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/autonomoustuff-public.list'
sudo apt update
sudo apt install ros-$ROS_DISTRO-delphi-esr
After installation, you can the launch sample file provided in this driver and checkout their list of topics roslaunch delphi_esr delphi_esr.launch
Then rostopic list
on another terminal. Info of the topics are also documented here.
To see more detail of the sample launch files, they are located here:
cd /opt/ros/$ROS_DISTRO/share/delphi_esr/
Install ROS socketcan_bridge
For the convenience of reading raw logged CAN frames, I find the socketcan_bridge is a good option because user can assign the CAN interface at launch file.
To install:
sudo apt get ros-$ROS_DISTRO-socketcan-bridge
Visualize data with Rviz
With all the pre-requisites complete, we are ready to read and visualize the parsed output of the Delphi ESR by AS ROS driver. I modified the sample launch file and created a rviz config for this in this repo.
Try out the visualization with the sample CAN frames.
git clone https://github.com/ancabilloni/ros-delphi-esr-visualization.git
cd ros-delphi-esr-visualization
# Bring up virtual can interface
sudo ./setup_vcan.sh
# Launch driver and rviz
roslaunch master.launch use_socketcan:="true" socketcan_device:="vcan0"
Playback sample CAN data on a different terminal
cd ros-delphi-esr-visualization
canplayer vcan0=can0 -v -I sample/sample1.log
When doing sudo ip link set can0 type can bitrate 5000000
I get RTNETLINK answers: Numerical argument out of domain
Why and how should I fix it?
hmm not sure why. Usually I would only get error during setup if can interface is not available. What type of can device were you using?