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.10
branch, 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.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.
- Copy the
Makefile
,start_carla_simulator.sh
to theautoware
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.
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_kit
folder 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.gz
to theautoware/src/universe/external/
directory.
- Finally, run the
make
command 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.bash
then 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
autoware
directory and execute the command.
./start_carla_simulator.sh
Wait for the startup to finish loading the map as follows.
- Start carla
./CarlaUE4.sh
- 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.
- Open a new command line terminal and run
main.py
in thecarla_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.
- Click on the
AUTO
button and the main vehicle will follow the planned trajectory.
- 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.
-
The rviz interface API has been implemented in
engage_node.py
, but it is not yet automated and needs to be optimized. -
main.py
andspawn_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.