Skip to content

rise-lab-skku/Mobile_System_Control_ROS2

Repository files navigation

Mobile System Control (ROS 2)

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.

MPC Controller Simulation Screen

Prerequisites

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.

  1. ROS 2 Foxy Installation

Launching CARLA

  1. Download CARLA: Mobile System Control package version of CARLA simulator
  2. Launch CARLA
    ./CarlaUE4.sh

Set CARLA API

  1. Check the directory of Python API in CARLA simulator

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

Build ROS 2 Packages

Create a ROS 2 Workspace

  1. Create a ROS 2 workspace named your workspace name.
    mkdir -p ~/carla_ws_ros2/src
    cd ~/carla_ws_ros2/src
  2. Clone this repository into the src folder.
    git clone https://github.com/rise-lab-skku/Mobile_System_Control_ROS2

Install Dependencies

  1. Install External Libraries (e.g., QP Solver)

    Run the provided install.sh script to install optimization libraries required for controllers like MPC.

    cd ~/carla_ws_ros2/src/Mobile_System_Control_ROS2
    sudo ./install.sh

Build the Packages

  1. Navigate to the workspace root directory and build all packages
    cd ~/carla_ws_ros2
    colcon build
  2. 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 Control Examples

  1. Launch carla_ros_bridge
    ros2 launch carla_ros_bridge carla_ros_bridge.launch.py
  2. 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
  3. 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
    
  4. 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
    

Download Link

  1. RoadRunner Map Files
  2. ERP42 model (.dae)
  3. Blender Project File
  4. ERP42 model from Blender (.fbx)

About

This is the repository for Mobile System Control lecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •