This repository provides a simple simulation environment—including a mobile robot—to help you learn basic path-planning algorithms as part of the Skoltech Robotics Course.
Using this setup, you will learn how to connect ROS2 nodes to a Unity simulation.
The project contains two main folders:
- MobileRobotSim — a prebuilt Unity simulation
- RoboticsLesson_ws — a ROS2 workspace containing the final exam task
To start the simulation, unzip the MobileRobotSim.zip file and open a terminal (Ctrl + Alt + T), navigate to the application folder, and run:
cd <path_to_workspace>/MobileRobotSim
chmod +x MobileRobotSim.x86_64
./MobileRobotSim.x86_64A window will appear showing the janitor mobile robot inside a fast-food restaurant:
Open a second terminal and navigate to the RoboticsLesson_ws folder. Install the ROS_TCP_Endpoint package:
echo "export ROS_LOCALHOST_ONLY=1" >> ~/.bashrc
cd <path_to_workspace>/RoboticsLesson_ws/src
git clone https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git -b main-ros2 ROS_TCP_Endpoint enables communication between Unity and your ROS2 nodes.
Now build and source the workspace:
cd ../
colcon build
source install/setup.bashIn a new terminal, start the endpoint server:
ros2 run ros_tcp_endpoint default_server_endpointOnce running, the Unity simulation will connect to ROS2. The red arrows in Unity should turn blue and yellow:
Open the workspace in your preferred editor (e.g., VS Code) and locate the main navigation script:
RoboticsLesson_ws/src/navigation_pkg/navigation_node.pyThis script defines the structure of the path-planning node. It subscribes to:
-
/obstacle_pointcloud— receives a PointCloud2 representing obstacles -
/robot_goal— receives a PoseStamped representing the goal position
Your node must publish a Path.
Fill in all the TODO sections in the script.
After completing the TODOs, rebuild and source the workspace:
cd <path_to_workspace>/RoboticsLesson_ws/
colcon build
source install/setup.bashThen run your path-planner node:
ros2 run navigation_pkg navigation_nodeTo verify the result, run the test script once your planner is ready:
ros2 run navigation_pkg testBelow is an example of a completed solution:
Below are some essential ROS2 tools and command-line utilities that will help you inspect and debug your system while working with the Unity simulation.
Launches the RQT framework, which provides a collection of GUI plugins such as topic monitors, publishers, and node graphs.
rqtStarts RViz2, the main visualization tool in ROS2. Use this to view your robot, paths, point clouds, and other data.
rviz2This lessons RViz2 file is in the <path_to_workspace>/RoboticsLesson_ws/rviz folder.
ROS2 provides a set of helpful ros2 topic commands for inspecting and interacting with topics:
ros2 topic list # List all active topics
ros2 topic info <topic_name> # Show detailed info about a topic
ros2 topic pub <topic_name> <msg_type> <args> # Manually publish messages (you can do this with rqt)
For more details, see: Understanding topics



