Carla & Autoware.Universe Co-simulation
Report Bug
·
Request Feature
This project aims to provide a data and control bridge for the communication between Carla and Autoware.Universe.
-
Ubuntu 22.04
-
Python 3.10
-
ROS2 Humble
-
Install universe
Refer to the official link to install universe. source-installation
Note: that we are using the
release/2023.10branch, the rest of the branches are unverified. -
Install Carla 0.9.15
Refer to the official link to install Carla. carla-installation
- Download the code
git clone https://github.com/guardstrikelab/carla_universe_bridge.git- Install the dependencies
pip install -r ./carla_universe_bridge/requirements.txtAdd PYTHONPATH to ~/.bashrc and replace it with your local path.
export PYTHONPATH=$PYTHONPATH:$(pwd)/carla_universe_bridge/src/PythonAPI/carla-0.9.15-py3.10-linux-x86_64.egg:$(pwd)/carla_universe_bridgeVerify that the carla package is available.
source ~/.bashrc
python -c "import carla;client=carla.Client('localhost', 2000);word= client.get_world();print('OK')"
Output OK, indicating that carla is OK.
- Install of plug-ins
Go to the deploy directory as follows.
- Copy the
Makefile,start_carla_simulator.shto theautowaredirectory.
cp Makefile start_carla_simulator.sh ~/project/autowareNote: The map_path:=/home/dep/project/code/carla_universe_bridge/map/Town01 in this script needs to be changed to your actual map storage path.
Copy the carla_simulator.launch.xml to the autoware/src/launcher/autoware_launch/autoware_launch/launch directory.
cp carla_simulator.launch.xml ~/project/autoware/src/launcher/autoware_launch/autoware_launch/launch- Copy the
carla_sensor_kitfolder to theautoware/src/param/autoware_individual_params/individual_params/config/default/directory.
cp -r carla_sensor_kit/ ~/project/autoware/src/param/autoware_individual_params/individual_params/config/default/- Extract
open_planner.tar.gzto theautoware/src/universe/external/directory.
- Finally, run the
makecommand to recompileuniverse.
Add the following command to ~/.bashrc and replace it with your local path.
source /opt/ros/humble/setup.bash
source xxxx/autoware/install/setup.bashthen run
source ~/.bashrc- Configure carla_universe_bridge
Go to the carla_universe_bridge directory, open config/config.yaml and change the relevant fields.
oasis:
host: 'localhost' # IP address of the carla server
carla_port: 2000
carla_timeout: 30- Go to the
autowaredirectory and execute the command.
./start_carla_simulator.shWait for the startup to finish loading the map as follows.
- Start carla
./CarlaUE4.sh- Go to the
carla_universe_bridgedirectory and execute the command.
python spawn_ego/spawn_ego_vehicle.pyWait for command line output Done.
The ego vehicle will be spawned in the carla simulator as follows.

- Open a new command line terminal and run
main.pyin thecarla_universe_bridgedirectory.
python main.pyIn the rviz of the universe you will see the generated ego vehicle and the planned paths as follows.
- Click on the
AUTObutton and the main vehicle will follow the planned trajectory.
- On line 131 of the
spawn_ego_vehicle.pyscript, the ego vehicle location needs to be made into a configuration item.
spawn_point = carla.Transform(carla.Location(x=119.267, y=330.394, z=0), carla.Rotation(yaw=0, pitch=0, roll=0))- In lines 42 and 43 of the
main.pyscript, sending the start and end positions of the ego vehicle needs to be a configurable item.
self.init_position = {'x': '119.267', 'y': '330.394', 'z': '0', 'r': '0', 'p': '0', 'h': '0'}
self.dst_position = {'x': '307.291', 'y': '330.394', 'z': '0', 'r': '0', 'p': '0', 'h': '0'}- When both universe and bridge are started for the first time, you may encounter the problem of the ego vehicle position deviation or no planned trajectory, see the figure below, in this case, you need to re-specify the start point and the end point by using the 2D Pose Estimate and 2D Goal Pose buttons in rviz.
-
The rviz interface API has been implemented in
engage_node.py, but it is not yet automated and needs to be optimized. -
main.pyandspawn_ego_vehicle.pydo not support continuous running yet and need to be optimized. -
The conversion method between carla xodr and universe osm format maps needs further research.








