Skip to content

Robotics

Unity Robotics Hub

Robotics-Nav2-SLAM-Example

This is a memo for the example provided here.

Quick start based on ROS installation in a VM (May 2022)

git clone --recurse-submodule git@github.com:Unity-Technologies/Robotics-Nav2-SLAM-Example.git

Configure ROS

Make sure to have ros, python3, pip, rosdep and colcon installed:

sudo apt install ros-foxy-desktop python3.8 pip python3-rosdep python3-colcon-common-extensions

Then:

python3 -m pip install --no-warn-script-location ipython
source /opt/ros/${ROS_DISTRO}/setup.bash
sudo rosdep init
rosdep update
rosdep install -yrq --from-paths src --ignore-src --rosdistro $ROS_DISTRO

Finally, go in the colcon_ws directory and build the packages:

colcon build

Configure Unity

Follow the instruction given in Setting up the Unity Project .

Note

Everything worked "fine" when converting the project to Unity version 2021.3.2f1. Thus you can accept all instructions given by Unity when opening the project. Thought there is some bugs when giving the 2D Goal Pose command to the robot from RViz. It is not determined if the version of Unity is the cause.

To find the IP address of the VM type ifconfig in the terminal.

Run the example

In the VM run in the colcon_ws directory (where the install folder is created after the build):

source install/local_setup.bash
ros2 launch unity_slam_example unity_slam_example.py

Troubleshooting

If you encounter the following error when launching the ROS package:

LookupError: Could not find the resource 'nav2_bringup' of type 'packages'

... rerun this command:

rosdep install -yrq --from-paths src --ignore-src --rosdistro $ROS_DISTRO