Following the first part of this blog series (Integrated Development Framework for ROS-based Autonomous Vehicles Using Autoware (Part I) – Claytex) where we covered aspects of our development framework, this post will cover our use of CARLA and AUTOWARE.AI. The overall goal of this work was to develop an interface between rFpro and AUTOWARE.AI so that we could substitute rFpro for CARLA as the simulation environment and leverage our existing tools and sensor models to support the development of AUTOWARE.AI based autonomous vehicles.
CARLA is an open-source autonomous driving simulator, built to serve as a modular and flexible API to address a range of tasks involved in the problem of autonomous driving. One of the main goals of CARLA is to help democratize autonomous driving R&D, serving as a tool that can be easily accessed and customized. CARLA is built on Unreal Engine for the simulation and uses the OpenDRIVE standard to define roads and urban settings. Control over the simulation is granted through an API handled in Python and C++ .
In a recent release, CARLA has integrated an AUTOWARE.AI bridge, using AUTOWARE version 1.14, which relies on the CARLA_ROS_BRIDGE. The purpose of this bridge is to establish the communication between the CARLA world and the AUTOWARE.AI control system through ROS topics.
CARLA  and AUTOWARE.AI  are both developed to run on Ubuntu 18.04 and currently use ROS Melodic . Installation and setup instructions are provided by these projects.
Running a Simulation with CARLA-AUTOWARE
- Run Carla Server: cd /opt/carla-simulator && ./CarlaUE4.sh
- Run Carla autoware agent: cd carla-autoware && ./run.sh
- Start the agent inside a docker container: roslaunch carla_autoware_agent carla_autoware_agent.launch town:=Town01
Once those above start, then Rviz will open up using predefined CARLA maps that match the CARLA worlds. With a working CARLA-AUTOWARE simulator we were then able to develop the rFpro interface. The initial goal being to have the rFpro vehicle drive in response to the same commands published by AUTOWARE whilst it runs within the CARLA simulator.
rFpro AUTOWARE Interface
AUTOWARE.AI publishes the vehicle commands to a ROS topic called vehicle_cmd which is an AUTOWARE.AI message defined by autoware_msgs/VehicleCmd. The VehicleCmd message can include various bits of information but for our purposes we are interested in the speed and yaw rate demands. These are in the form of a ROS geometry_msgs/Twist message.
The diagram below shows the basic communication that has to happen. The CARLA-AUTOWARE simulator is publishing the vehicle_cmd topic and runs on Ubuntu. rFpro is running on a Windows PC and requires inputs in the form of vehicle control demands: steering, accelerator, brake, clutch and gear demands.
The ROS Vehicle Control Plugin has been developed by Claytex as an rFpro plugin that subscribes to the vehicle_cmd topic. This plugin then converts the speed and yaw rate demands into the vehicle control commands. This is done using an FMU that includes the vehicle level control function. This vehicle level control function could be replaced by your own FMU that uses the FMI 2.0 standard. The ROS Vehicle Control Plugin can also publish the vehicle_status message within the ROS system.
Before setting up a trajectory for the vehicle to follow, we will run the Simulation Manager (More here: Architecture Development to Virtual Validation of ADAS Systems using Digital Twin Technologies – Claytex). This tool is used to configure and control the rFpro simulator. The ego vehicle, called Physics in the screenshot below, is configured to use the ROS-Vehicle-Control plugin. This will control the rFpro vehicle from AUTOWARE.AI which means whatever action we take inside AUTOWARE, will affect rFpro.
Once the rFpro simulator is running, we can set a trajectory inside AUTOWARE.AI, using Rviz, and the vehicle starts moving. At this point AUTOWARE.AI is running in closed loop control with the CARLA vehicle model, but the same vehicle_cmd topic is being used to also drive the rFpro vehicle.
The next step in this work is to use our sensor models to enable closed loop control with the rFpro vehicle model and then we can stop using the CARLA simulator.
More details have been purposefully omitted; however, if you would like more details and are interested in how to connect rFpro with AUTOWARE.AI or similar control systems, do get in touch.
 CARLA Simulator
Written by Amina Hamoud – Project Engineer
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion