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 /realtime_raw_data - std_msgs/String - Reports CAN data. Use the node subs_fs.cpp to interpret these into car sensing data
This ROS node interfaces libpanda's ToyotaHandler
Publishers:
- /realtime_raw_data - 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
1.Create a ROS Workspace
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
2.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
.
3.Build the WS
$ cd ~/catkin_ws
$ catkin_make
4.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.