Skip to content

About

This is a AVP simulation using CARLA and Autoware.

Resources

Stars

14 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

AVP-Simulation

Automated Valet Parking Co-Simulation Based on CARLA and Autoware

CARLA × ROS 2 Galactic × Autoware

Ubuntu ROS 2 Autoware CARLA License

Automated valet parking simulation demo

Overview

AVP-Simulation is an Automated Valet Parking (AVP) co-simulation project built with CARLA, ROS 2, and Autoware.

CARLA provides the parking environment, vehicle dynamics, and simulated sensor data. ROS-Agent Bridge transfers LiDAR, camera, IMU, GNSS, and vehicle-state data from CARLA to Autoware. Autoware then performs localization, path planning, and vehicle control before the resulting commands are sent back to CARLA, creating a complete closed-loop autonomous parking system.

The main contributions of this project include:

  • Creating a PCD point cloud map of the parking environment for Autoware localization;
  • Creating a Lanelet2 high-definition map containing road and parking-space semantics;
  • Aligning sensor poses, coordinate frames, topics, and launch pipelines between CARLA and Autoware;
  • Creating and adapting sensor_kit_calibration.yaml, sensors_calibration.yaml, gnss.launch.xml, and autoware.launch.xml;
  • Establishing a closed loop from sensor input through Autoware localization, planning, and control to vehicle execution in CARLA;
  • Supporting initial-pose estimation, parking-space selection, trajectory planning, and autonomous parking through RViz.

System Architecture

CARLA and Autoware co-simulation architecture

The closed-loop data flow is summarized below:

CARLA Parking Environment and Sensors
                 │
                 │ LiDAR / Camera / IMU / GNSS / Vehicle Status
                 ▼
        ROS-Agent Bridge (ROS 2)
                 │
                 ▼
 Autoware: Localization → Planning → Control
                 │
                 │ AckermannControlCommand
                 ▼
       ROS-Agent / CARLA Vehicle

Main Contributions

1. Parking Lot PCD Map

Autoware point cloud localization requires a prebuilt PCD map of the parking environment. In this project, the map is generated from the CARLA SUSTC_Parkinglot environment using either of the following approaches:

  1. PCL Recorder: uses the point cloud map recorder provided by CARLA ROS Bridge to sample the simulated environment directly;
  2. LIO-SAM (SLAM): combines LiDAR, IMU, and GNSS data to create the map through a workflow closer to real-world vehicle mapping.

Useful references:

Note

Vector Map Builder requires an ASCII PCD file. If the generated point cloud is stored as a binary PCD, convert it with pcl_converter:

sudo apt install pcl-tools
pcl_converter -f ascii source.pcd destination.pcd

2. Lanelet2 High-Definition Parking Map

The point cloud map is used as the base layer in Vector Map Builder to create an extended Lanelet2 map compatible with Autoware. The resulting HD map describes:

  • Drivable areas and lane boundaries in the parking lot;
  • Lane centerlines and their topological connections;
  • Parking spaces, parking goals, and associated semantic information;
  • Lanelet2 attributes and routing relationships required by Autoware planning.

Useful mapping tools and documentation:

3. CARLA–Autoware Sensor Alignment

CARLA uses Unreal Engine coordinate conventions, whereas ROS and Autoware use the ROS right-handed coordinate system. A working integration must therefore align not only the sensor positions and orientations, but also the frame_id values, TF tree, topic names, and launch order.

The key files adapted in this project are:

File Purpose Main alignment task
sensor_kit_calibration.yaml Defines static extrinsic transforms inside the sensor kit LiDAR, camera, IMU, and GNSS x/y/z/roll/pitch/yaw relative to sensor_kit_base_link
sensors_calibration.yaml Defines the transform between the vehicle and sensor kit Static transform from base_link to sensor_kit_base_link
gnss.launch.xml Starts and adapts the GNSS/IMU pipeline Node startup, topic remapping, message integration, and coordinate frames
autoware.launch.xml Organizes the main Autoware launch pipeline Map, sensor model, localization, planning, control, and simulation parameters

After applying the calibration and launch files, verify the critical topics and TF transforms:

# Inspect the critical topics
ros2 topic list
ros2 topic hz /carla_pointcloud
ros2 topic echo /sensing/gnss/ublox/nav_sat_fix --once

# Verify that the TF tree is connected
ros2 run tf2_ros tf2_echo base_link sensor_kit_base_link
ros2 run tf2_ros tf2_echo sensor_kit_base_link velodyne_top_base_link

System Requirements

Important

This project preserves its original validated environment: Ubuntu 20.04, ROS 2 Galactic, and Autoware Galactic. ROS 2 Galactic has reached end of life. Use the versions below consistently instead of mixing this setup with ROS 2 Humble or a recent Autoware release.

Component Recommended configuration
Operating system Ubuntu 20.04
CPU 9th-generation Intel Core i7 or newer
Memory 32 GB or more
GPU 8 GB VRAM or more
ROS 2 Galactic
Autonomous driving stack Autoware Galactic
Simulator Project-provided CARLA build with the SUSTC_Parkinglot map

Installation

The complete installation consists of four parts: CARLA, ROS 2 Galactic, Autoware, and ROS-Agent Bridge.

The recommended workspace layout is:

~/ros-agent/
├── autoware/
└── bridge/
    ├── op_bridge/
    ├── op_agent/
    ├── scenario_runner/
    └── Maps/

1. Install CARLA with the Parking Lot Map

Download the specified CARLA version containing the SUSTC_Parkinglot map:

After extracting CARLA, define CARLA_ROOT. Replace the example path with the actual installation directory:

echo 'export CARLA_ROOT=/path/to/CARLA' >> ~/.bashrc
source ~/.bashrc

Confirm that CARLA starts correctly on its own:

cd "$CARLA_ROOT"
./CarlaUE4.sh

2. Install ROS 2 Galactic

Follow the official ROS 2 Galactic installation guide for Ubuntu, then initialize the dependency-management tools:

source /opt/ros/galactic/setup.bash
sudo rosdep init  # Skip this command if rosdep has already been initialized
rosdep update --include-eol-distros

3. Install Autoware Galactic

Clone the Autoware branch used by this project:

mkdir -p ~/ros-agent
cd ~/ros-agent
git clone https://github.com/ROS-Agent/autoware.git -b galactic

Install the development dependencies:

cd ~/ros-agent/autoware
./setup-dev-env.sh

Import the Autoware source repositories:

cd ~/ros-agent/autoware
mkdir -p src
vcs import src < autoware.repos

Install the required ROS packages:

cd ~/ros-agent/autoware
source /opt/ros/galactic/setup.bash
rosdep update --include-eol-distros
rosdep install -y --from-paths src --ignore-src --rosdistro "$ROS_DISTRO"

Build the workspace:

cd ~/ros-agent/autoware
source /opt/ros/galactic/setup.bash
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

4. Install ROS-Agent Bridge and Map Configurations

Clone the bridge, agent, Scenario Runner, and map repositories:

mkdir -p ~/ros-agent/bridge
cd ~/ros-agent/bridge
git clone https://github.com/ROS-Agent/op_bridge.git -b AVP
git clone https://github.com/ROS-Agent/op_agent.git -b AVP
git clone https://github.com/ROS-Agent/scenario_runner.git
git clone https://github.com/ROS-Agent/Maps.git

5. Apply the Autoware Sensor and Launch Configurations

Back up the original files before copying the project-specific configurations. The following procedure preserves the original installation workflow while using cp so that the source files remain available in the Maps repository:

cd ~/ros-agent/bridge/Maps

cp ~/ros-agent/autoware/src/launcher/autoware_launch/autoware_launch/launch/autoware.launch.xml \
   ~/ros-agent/autoware/src/launcher/autoware_launch/autoware_launch/launch/autoware.launch.xml.bak
cp ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_launch/launch/gnss.launch.xml \
   ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_launch/launch/gnss.launch.xml.bak
cp ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensor_kit_calibration.yaml \
   ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensor_kit_calibration.yaml.bak
cp ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensors_calibration.yaml \
   ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensors_calibration.yaml.bak

cp autoware.launch.xml ~/ros-agent/autoware/src/launcher/autoware_launch/autoware_launch/launch/autoware.launch.xml
cp gnss.launch.xml ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_launch/launch/gnss.launch.xml
cp sensor_kit_calibration.yaml ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensor_kit_calibration.yaml
cp sensors_calibration.yaml ~/ros-agent/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensors_calibration.yaml

If these files are replaced after the first Autoware build, rebuild the workspace and source the updated environment:

cd ~/ros-agent/autoware
source /opt/ros/galactic/setup.bash
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
source install/setup.bash

6. Configure the Bridge Environment Variables

Add the following variables to ~/.bashrc:

export SCENARIO_RUNNER_ROOT=~/ros-agent/bridge/scenario_runner
export LEADERBOARD_ROOT=~/ros-agent/bridge/op_bridge
export TEAM_CODE_ROOT=~/ros-agent/bridge/op_agent

Reload the shell configuration:

source ~/.bashrc

Running the Automated Parking Simulation

1. Start CARLA

Open terminal 1:

cd "$CARLA_ROOT"
./CarlaUE4.sh

Wait until the parking environment has finished loading before starting ROS-Agent Bridge.

2. Start Autoware and ROS-Agent Bridge

Open terminal 2:

cd ~/ros-agent/autoware
source /opt/ros/galactic/setup.bash
source install/setup.bash

cd ~/ros-agent/bridge/op_bridge/op_scripts
./run_exploration_mode_ros2.sh

Once the script is running, the vehicle and simulated sensor data from CARLA should become available to Autoware, and RViz should start automatically.

3. Set the Initial Vehicle Pose

  1. Click 2D Pose Estimate in the RViz toolbar;
  2. Click and drag in the 3D view to set the vehicle position and heading;
  3. Confirm that the point cloud aligns with the map and that the vehicle pose matches its position in CARLA.

Setting the initial vehicle pose in RViz

4. Select a Parking Goal and Engage Autoware

  1. Click 2D Goal Pose in the RViz toolbar;
  2. Click and drag inside the target parking space to define the parking position and final vehicle heading;
  3. Confirm that RViz displays a planned path from the current pose to the target space;
  4. Click Engage in the AutowareStatePanel;
  5. Autoware will publish control commands and the vehicle will execute the parking maneuver in CARLA.

Selecting a target parking space and engaging Autoware

ROS-Agent Bridge Topic Interface

Data Topic Message type Description
LiDAR /carla_pointcloud sensor_msgs/msg/PointCloud2 3D LiDAR point cloud from CARLA
Camera info /sensing/camera/traffic_light/camera_info sensor_msgs/msg/CameraInfo Camera calibration and image metadata
Camera image /sensing/camera/traffic_light/image_raw sensor_msgs/msg/Image Uncompressed camera image
IMU /sensing/imu/tamagawa/imu_raw sensor_msgs/msg/Imu Raw IMU measurements
GNSS /sensing/gnss/ublox/nav_sat_fix sensor_msgs/msg/NavSatFix GNSS position fix
Vehicle velocity /vehicle/status/velocity_status autoware_auto_vehicle_msgs/msg/VelocityReport Current vehicle velocity
Steering angle /vehicle/status/steering_status autoware_auto_vehicle_msgs/msg/SteeringReport Current steering angle
Control mode /vehicle/status/control_mode autoware_auto_vehicle_msgs/msg/ControlModeReport Autonomous, manual, and other control states
Control command /control/command/control_cmd autoware_auto_control_msgs/msg/AckermannControlCommand Lateral and longitudinal command produced by Autoware

Troubleshooting

The Point Cloud and Vehicle Model Have a Fixed Offset in RViz

Check the parent and child frames, units, and angles in sensor_kit_calibration.yaml and sensors_calibration.yaml. CARLA/Unreal and ROS use different coordinate conventions, so pay particular attention to the Y-axis direction and yaw sign.

Changes to the Calibration YAML Files Are Not Applied

Make sure that you edited the configuration under src for the active sensor_model. Run colcon build --symlink-install again and source install/setup.bash in a new terminal.

The Initial Pose Cannot Be Set or NDT Does Not Converge

Confirm that /carla_pointcloud is being published continuously, the TF tree is connected, and the PCD map uses the same origin, scale, and orientation as the CARLA environment. Set the initial pose inside an area covered by valid map points.

A Path Is Planned but the Vehicle Does Not Move

Check that Engage has been selected in AutowareStatePanel, the control mode has switched to autonomous, /control/command/control_cmd is being published, and ROS-Agent Bridge is still running.

Related Repositories

License

This project is distributed under the terms of the repository LICENSE.

About

This is a AVP simulation using CARLA and Autoware.

Resources

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors