This repository is for the ROS 2 version of the Mobile System Control lecture.
For the ROS 1 version, please refer to Mobile_System_Control.
This repository has been tested on Ubuntu 20.04 with ROS 2 Foxy.
Before building, please ensure your environment meets the prerequisites listed below.
Note: It was also successfully tested on Ubuntu 22.04 with ROS 2 Humble as of 2025-08-18.
- ROS 2 Foxy Installation
- Installation guide: ROS 2 Foxy Official Installation Docs
- You must source the ROS 2 environment in every new terminal:
source /opt/ros/foxy/setup.bash
- Download CARLA: Mobile System Control package version of CARLA simulator
- Launch CARLA
./CarlaUE4.sh
-
Check the directory of Python API in CARLA simulator
-
Add PYTHONPATH in ~/.bashrc or ~/.zshrc
The following is just an example. Make sure to modify the path according to your own CARLA PythonAPI location.
-
bash
echo "PYTHONPATH=$PYTHONPATH:~/Downloads/CARLA_package/CARLA/PythonAPI/carla/dist/carla-0.9.15-py3.8-linux-x86_64.egg:~/Downloads/CARLA_package/CARLA/PythonAPI/carla/" >> ~/.bashrc
-
zsh
echo "PYTHONPATH=$PYTHONPATH:~/Downloads/CARLA_package/CARLA/PythonAPI/carla/dist/carla-0.9.15-py3.8-linux-x86_64.egg:~/Downloads/CARLA_package/CARLA/PythonAPI/carla/" >> ~/.zshrc
- Create a ROS 2 workspace named
your workspace name.mkdir -p ~/carla_ws_ros2/src cd ~/carla_ws_ros2/src
- Clone this repository into the
srcfolder.git clone https://github.com/rise-lab-skku/Mobile_System_Control_ROS2
-
Install External Libraries (e.g., QP Solver)
Run the provided
install.shscript to install optimization libraries required for controllers like MPC.cd ~/carla_ws_ros2/src/Mobile_System_Control_ROS2 sudo ./install.sh
- Navigate to the workspace root directory and build all packages
cd ~/carla_ws_ros2 colcon build
- After the build is complete, you must source the setup file in every new terminal to use the packages.
- bash
source ~/carla_ws_ros2/install/setup.bash
- zsh
source ~/carla_ws_ros2/install/setup.zsh
- Launch carla_ros_bridge
ros2 launch carla_ros_bridge carla_ros_bridge.launch.py
- Launch mobile_system_control
ros2 launch mobile_system_control mobile_system.launch.py
ros2 launch mobile_system_control_vis mobile_system_control_vis.launch.py
- Spawn vehicle and control window
ros2 launch carla_spawn_objects carla_spawn_objects.launch.py object_name:=ego
ros2 launch carla_manual_control carla_manual_control.launch.py role_name:=ego_vehicle - Launch control examples
- PID controller
ros2 launch pid_control_ex pid_control_ex.launch.py - Pure Pursuit controller
ros2 launch purepursuit_control_ex purepursuit_control_ex.launch.py - Kanayama controller
ros2 launch kanayama_control_ex kanayama_control_ex.launch.py - MPC controller
ros2 launch mpc_control_ex mpc_control_ex.launch.py - Lap timer (pygame view)
ros2 launch carla_lap_timer carla_lap_timer.launch.py role_name:=ego_vehicle
