*Originally written by Ekim Yurtsever.*
This is a short setup guide for Continental ARS 308-21 SSAO Radar node. This guide covers the following topics;
- Requirements and the hardware setup
- A brief introduction to CAN bus communication using Linux
- Radar configuration
- Receiving CAN messages on ROS
- Using the Autoware RADAR Node
- Ubuntu 14.04 or above
- ROS Packgage: socketcan_interface (http://wiki.ros.org/socketcan_interface)
*: Adaptor is needed for the termination of the can circuit. From the technical documentation of Continental ARS 308-2C/-21;
"Since no termination resistors are included in the radar sensor ARS 308-2C and ARS 308-21, two 120 Ohm terminal resistors have to be connected to the network (separately or integrated in the CAN interface of the corresponding unit)."
1-Connect the devices as shown below
2-Turn on the power supply. The device should start working with audible operation.
2. A brief introduction to CAN bus communication using Linux
There are various ways to communicate with CAN bus. For linux, SocketCAN is one of the most used CAN drivers. It is open source and comes with the kernel. Furthermore it can be used with many devices. If a different vendor driver is liked to be used however, please refer to that drivers manual for communicating via CAN bus.
First load the drivers. The device sends the messages with a specific bitrate, if it is not matched the stream would not be synchronized. Therefore the ip can link must be set with the bitrate of the device. Bitrate for this device is constant at 500000/s and cannot be changed. Below is an example sniplet for setting can device can1:
$ modprobe can_dev $ modprobe can $ modprobe can_raw $ sudo ip link set can1 type can bitrate 500000 $ sudo ifconfig can1 up
Now the connection between the computer and the sensor is established.
For checking the information sent by the device, a user friendly tool package called can-utils can be used with SocketCAN for accessing the messages via the driver.
Get the can-utils;
$ sudo apt-get install can-utils
Display the can messages from can1;
$ candump can1
A stream of CAN messages should be received at this point. An example of the message stream is shown below;
The can messages sent from the device have to be converted into meaningful information. Can messages have headers to identify the content of the message. Below the headers and the content of the messages sent from the Radar are shown;
0x300 and 0x301 are the input signals. The ego-vehicle speed and yaw rate can be sent to the device. If this information is provided, the radar will return detected objects's positions and speeds relative to the ego-vehicle. If this information is not sent, the radar will assume that it is stationary.
0x600, 0x701 and 0x702 are the output messages of the radar. The structure of these messages are given below;
3. Configuring the radar
The radar must be configured first to receive tracked object information. This device does not transmit raw data from the radar scans. Instead, its microcontroller reads the raw sensing data and detects/tracks objects with its own algorithm (this algorithm is not accesable). The sensor sends the detected/tracked object information through the CAN bus.
The default behavior of the device is to send detected objects (not tracked). In order to receive tracked object messages, 0x60A, 0x60B and 0x60C, a configuration message has to be sent. The following command will send the configuration message using the can-utils for receiving tracked object messages:
$ cansend can1 200#0832000200000000
Now 0x60A, 0x60B and 0x60C messages can be received instead of 0x600, 0x701 and 0x702. We can check this by dumping the CAN stream on the terminal screen with the following command again:
$ candump can1
The stream should include 0x60A, 0x60B and 0x60C messages now.
4. Receiving CAN messages on ROS
Ros package socketcan_interface is needed to receive can messages in ROS. This package is used with the socketCAN.
$ sudo apt-get install ros-kinetic-socketcan-interface
Test the communication in ros;
$ rosrun socketcan_interface socketcan_dump can1
With socketcan_interface a driver for this device can be developed. However there is already a ready can driver in ros called ros_canopen. Install this package with the following command;
$ sudo apt-get install ros-kinetic-ros-canopen
This package will be used to publish the can messages received from the device in the ROS environment.
The socketcan_to_topic node in the socketcan_bridge package can be used to publish topics from the can stream. First, start a ROS core and then launch this node with the name of the can port as an argument (e.g can1).
$ roscore $ rosrun socketcan_bridge socketcan_to_topic_node _can_device:="can1"
This will publish a topic called “received_messages”. Check the messages with the following command:
$ rostopic echo /received_messages
This should show the received messages. We are interested in the “id” and “data” fields. An example of the received_messages is shown below.