Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro to ROS2: Mobile Robot Simulation

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

1. Running the Unity Simulation

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_64

A window will appear showing the janitor mobile robot inside a fast-food restaurant:

2. Setting Up the ROS2 Workspace

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

3. Running ROS_TCP_Endpoint

In a new terminal, start the endpoint server:

ros2 run ros_tcp_endpoint default_server_endpoint

Once running, the Unity simulation will connect to ROS2. The red arrows in Unity should turn blue and yellow:

4. The Task

Open the workspace in your preferred editor (e.g., VS Code) and locate the main navigation script:

RoboticsLesson_ws/src/navigation_pkg/navigation_node.py

This 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.bash

Then run your path-planner node:

ros2 run navigation_pkg navigation_node

To verify the result, run the test script once your planner is ready:

ros2 run navigation_pkg test

5. Example Output

Below is an example of a completed solution:

Simulation view

Rviz view

6. Useful Commands

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.

GUI Tools

rqt

Launches the RQT framework, which provides a collection of GUI plugins such as topic monitors, publishers, and node graphs.

rqt

rviz2

Starts RViz2, the main visualization tool in ROS2. Use this to view your robot, paths, point clouds, and other data.

rviz2

This lessons RViz2 file is in the <path_to_workspace>/RoboticsLesson_ws/rviz folder.

Topic Commands

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

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages