can_to_ros is a ROS package that provide a real-time and offline decoding of CAN bus messages. It is also integrated with libpanda to send control commands to Toyota RAV4.
- Ubuntu 18.04/20.04 AMD64 or Ubuntu18.04/20.04 ARM
- ROS melodic or ROS noetic
- libpanda (must be installed in /opt directory)
This is automatically installed in robot_upstart with libpanda's scripts/installCanToRos.sh script
Invokes the following:
- vehicle_interface - Main interface for libpanda's ToyotHandler for vehicle control
- publishCommands - Maintains a regular 100Hz publish rate from /cmd_accel_safe to /car/cruise/accel_input
- node_status.py - Regulary publishes a 0 to /cmd_accel to maintain libpanda's command heartbeat if other commands are not sent
- launch/safety_checks.launch
- cut_in_disengager - Ensures that cars cutting in ahead do no coincide with large deceleration commands by disengaging the cruise controller.
- cruise_start_safety_check - Ensures that acceleration commands start within safe bounds and that a lead vehicle is seen on engage requests (otherwise a disengage is invoked)
- topic_check.py - Checks publish rate of /car/libpanda/controls_allowed to dispaly status on Blinkt kit
Expected interface topics:
/cmd_accel - std_msgs/Float64 - This is where control commands should be sent. cut_in_disengager will ensure convert this to /cmd_accel_safe as needed, then publishCommands will convert /cmd_accel_safe to /car/cruise/accel_input /car/can/raw - std_msgs/String - Reports CAN data. Use the node subs_fs.cpp to interpret these into car sensing data
This launch file allows you to pipe in replayed CAN and/or GPS data stored in CSV files, as if they are being read directly from the car in real time. Make sure that the generated subs.cpp node matches the vehicle type of the CSV file you are playing back data from. Caviat: the playback timing is not perfect in all cases but still very useful.
Usage:
roslaunch can_to_ros piping.launch publish_csv_args:= "-c {/FILEPATH/DATE_VIN_CAN_Messages.csv} -g {/FILEPATH/DATE_VIN_GPS_Messages.csv}" bag_name:="my_bagfile"
Uses:
- Creating new bagfiles for data. E.g. you've added new nodes and want to do software-in-the-loop testing.
- Playback for Ros2Ascii visualizations. Example snippet here for a Honda Pilot.
This ROS node interfaces libpanda's ToyotaHandler
Publishers:
- /car/can/raw - std_msgs/String - This publishes CAN data of interest where the can_to_ros node named subs_fs.cpp can interpret values
- /car/panda/gas_interceptor_detected - std_msgs/Bool - Reported by the Panda is their gas interceptor hardware is detected
- /car/panda/controls_allowed - std_msgs/Bool - Reported by the comma.ai panda. This is not event-based from the Panda, but is regularly checked at 2 Hz to reset the Panda's heartbeat
- /car/libpanda/controls_allowed - std_msgs/Bool - Reported by logic within libpanda. This is event based from libpanda using CAN messages. When no events occur, this regularly published at 1 Hz which can be used to assess libpanda's control command health
Subscribers:
- /car/cruise/accel_input - std_msgs/Float64 - This is for acceleration commands to be sent to the car's cruise controller (priorly known as /commands)
- /car/hud/mini_car_enable - std_msgs/Bool - When true, this will display a mini-vehicle on the car's HUD which cruise control is on and engaged
- /car/hud/cruise_cancel_request - std_msgs/Bool - When true published, the cruise controller will disengage and notify the driver with an audible chime
- Create a ROS Workspace
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
- Clone the repo.
$ cd ~/catkin_ws/src/
$ git clone https://github.com/jmscslgroup/can_to_ros.git
Note: make sure to install libpanda before running catkin_make
.
- Build the WS
$ cd ~/catkin_ws
$ catkin_make
- Source your enviroment:
$source ~/catkin_ws/devel/setup.bash
The following tests were performed on a Toyota RAV4
We created a set of slides (Step Input Commands Test) that have the steps needed to send acceleration commands to a Toyota RAV4.
The goad of this test is to replicate the cruise control functionality with a PID controller. Steps to run the test are here.