Skip to content

This project aims to provide a data and control bridge for the communication between Carla and Autoware.Universe.

License

Notifications You must be signed in to change notification settings

guardstrikelab/carla_autoware_bridge


Carla Autoware Bridge

Carla & Autoware.Universe Co-simulation
Report Bug · Request Feature

visitor issues issues-closed issues-pr last-commit TODOs milestones repo-size lines language License: Apache 2.0 stars

About

This project aims to provide a data and control bridge for the communication between Carla and Autoware.Universe.

1. Preset condition

  • 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.10 branch, the rest of the branches are unverified.

  • Install Carla 0.9.15

    Refer to the official link to install Carla. carla-installation

2. Install carla_universe_bridge

  • Download the code
git clone https://github.com/guardstrikelab/carla_universe_bridge.git
  • Install the dependencies
pip install -r ./carla_universe_bridge/requirements.txt

Add 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_bridge

Verify 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.

deploy

  1. Copy the Makefile, start_carla_simulator.sh to the autoware directory.
cp Makefile start_carla_simulator.sh   ~/project/autoware

Note: 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.

makefile

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

carla_simulator

  1. Copy the carla_sensor_kit folder to the autoware/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/

carla_sensor_kit

  1. Extract open_planner.tar.gz to the autoware/src/universe/external/ directory.

open_planner

  1. Finally, run the make command to recompile universe.

make

Add the following command to ~/.bashrc and replace it with your local path.

source /opt/ros/humble/setup.bash
source xxxx/autoware/install/setup.bash

then run

source ~/.bashrc
  1. 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

3. Run carla_universe_bridge

  1. Go to the autoware directory and execute the command.
./start_carla_simulator.sh

Wait for the startup to finish loading the map as follows.

rviz

  1. Start carla
./CarlaUE4.sh
  1. Go to the carla_universe_bridge directory and execute the command.
python spawn_ego/spawn_ego_vehicle.py

Wait for command line output Done. The ego vehicle will be spawned in the carla simulator as follows. spawn_ego

  1. Open a new command line terminal and run main.py in the carla_universe_bridge directory.
python main.py

In the rviz of the universe you will see the generated ego vehicle and the planned paths as follows.

auto_ego

  1. Click on the AUTO button and the main vehicle will follow the planned trajectory.

4. TODO

  • On line 131 of the spawn_ego_vehicle.py script, 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.py script, 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.

no_path

  • The rviz interface API has been implemented in engage_node.py, but it is not yet automated and needs to be optimized.

  • main.py and spawn_ego_vehicle.py do not support continuous running yet and need to be optimized.

  • The conversion method between carla xodr and universe osm format maps needs further research.

5. Reference

About

This project aims to provide a data and control bridge for the communication between Carla and Autoware.Universe.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages