Skip to content

ricardodeazambuja/carla-ros

 
 

Repository files navigation

ROS/ROS2 bridge for CARLA simulator

Actions Status Documentation GitHub GitHub release (latest by date)

This ROS package is a bridge that enables two-way communication between ROS and CARLA. The information from the CARLA server is translated to ROS topics. In the same way, the messages sent between nodes in ROS get translated to commands to be applied in CARLA.

rviz setup

This version requires CARLA 0.9.13

Features

  • Provide Sensor Data (Lidar, Semantic lidar, Cameras (depth, segmentation, rgb, dvs), GNSS, Radar, IMU)
  • Provide Object Data (Transforms (via tf), Traffic light status, Visualization markers, Collision, Lane invasion)
  • Control AD Agents (Steer/Throttle/Brake)
  • Control CARLA (Play/pause simulation, Set simulation parameters)

Getting started and documentation

Installation instructions and further documentation of the ROS bridge and additional packages are found here.

My modifications

I modified this repo to allow you to use hostnames (avahi) and to allow you to download just one script to use together with a headless CARLA server from another docker image.
It's expected that you are running linux and you have docker and nvidia-docker2 installed (and working).

CARLA headless server

Download the script to launch the headless server:

$ wget https://raw.githubusercontent.com/ricardodeazambuja/carla-simulator-python/main/launch_simulator_docker.sh

Don't forget to launch it before you try any of the examples:

$ source launch_simulator_docker.sh

CARLA rosbridge container

Download this second script for the ROS2 container:

$ wget https://raw.githubusercontent.com/ricardodeazambuja/carla-ros/master/docker/build_ros2-galactic.sh

Build your image (it will download the script run_ros2-galactic.sh after that):

$ source build_ros2-galactic.sh

And finally launch the CARLA ROS2 stuff :)

$ source run_ros2-galactic.sh

Using it

If everything went as expected, and you started the CARLA headless server on a different terminal, you should be able to test your container with this:

$ ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py

When you need to open more terminals inside the same container (considering the name is carla-ros2-8589d9bd2d):

$ docker exec -it carla-ros2-8589d9bd2d bash

And if you just want to execute something (e.g. ros2 topic list):

$ docker exec -t carla-ros2-8589d9bd2d bash -i -c "ros2 topic list"

About

ROS bridge for CARLA Simulator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 83.6%
  • C++ 11.0%
  • CMake 3.7%
  • Other 1.7%