This sample project demonstrates a robotic vacuum simulation project navigating through the O3DE Loft scene using the ROS 2 Gem and the ROS 2 navigation stack.
This project will run on
The ROS 2 Gem is not yet developed for Windows.
Refer to the O3DE System Requirements documentation to make sure that the system/hardware requirements are met
This project has the following dependencies:
main
branch should work.main
branch (the default) should work.The following steps will assume the following
source /opt/ros/galactic/setup.bash
source /opt/ros/humble/setup.bash
.profile
or .bashrc
echo $ROS_DISTRO
. You should see galactic
or humble
.$ cd $DEMO_BASE
~$ git clone https://github.com/o3de/o3de.git -b main
~$ cd o3de
~/o3de$ git lfs install
~/o3de$ git lfs pull
~/o3de$ python/get_python.sh
~/o3de$ scripts/o3de.sh register --this-engine
~$ cd $DEMO_BASE
~$ git clone https://github.com/o3de/o3de-extras.git -b main
~$ $DEMO_BASE/o3de/scripts/o3de.sh register -gp $DEMO_BASE/o3de-extras/Gems/ROS2
$ cd $DEMO_BASE
~$ git clone https://github.com/o3de/loft-arch-vis-sample.git -b main
~$ cd loft-arch-vis-sample
~/loft-arch-vis-sample$ git lfs install
~/loft-arch-vis-sample$ git lfs pull
~/loft-arch-vis-sample$ $DEMO_BASE/o3de/scripts/o3de.sh register -gp $DEMO_BASE/loft-arch-vis-sample/Gems/ArchVis
$ cd $DEMO_BASE
~$ git clone https://github.com/o3de/RobotVacuumSample.git
~$ cd RobotVacuumSample
~/RobotVacuumSample$ git lfs install
~/RobotVacuumSample$ $DEMO_BASE/o3de/scripts/o3de.sh register -pp .
~/RobotVacuumSample$ cmake -B build/linux -G "Ninja Multi-Config" -DLY_STRIP_DEBUG_SYMBOLS=TRUE -DLY_DISABLE_TEST_MODULES=ON
~/RobotVacuumSample$ cmake --build build/linux --config profile --target RobotVacuumSample Editor AssetProcessor
$ cd $DEMO_BASE
~$ cd RobotVacuumSample/build/linux/bin/profile
~/RobotVacuumSample/build/linux/bin/profile$ ./Editor
We can run ROS2 navigation stack with our simulation scene and robot. When we run the navigation stack, it will start SLAM and build the map of environment based on Lidar sensor data. You can set navigation goals for the robot using RViz2 (which is also started with the launch file).
These packages are required to run ROS 2 navigation stack for our robot. For ROS 2 Humble, replace galactic
with humble
.
source /opt/ros/galactic/setup.bash
sudo apt install -y ros-${ROS_DISTRO}-slam-toolbox ros-${ROS_DISTRO}-navigation2 ros-${ROS_DISTRO}-nav2-bringup ros-${ROS_DISTRO}-pointcloud-to-laserscan ros-${ROS_DISTRO}-ackermann-msgs ros-${ROS_DISTRO}-control-toolbox ros-${ROS_DISTRO}-gazebo-msgs
O3DE
Editor, select the Loft
Level.Play Game
button or press CTRL+G
The launch file is included in this repository
~/RobotVacuumSample/launch$ ros2 launch navigation.launch.py
You should see output in the console as well as RViz2 window.
Use RViz GUI to set the goal by using the 2D Goal Pose
tool (upper toolbar).
You can drag it to indicate direction you would like your robot to face when reaching the goal.
Watch your robot go. You can set subsequent goals.
Sometimes when there were problems while the AssetProcessor was working (for example, disk space ran out), subsequent executions of the Editor fail to re-start the process for such Assets. This might be due to a limitation of the number of files that can be watched by a single user. You can fix this by increasing the value, for example:
sudo sysctl -w fs.inotify.max_user_watches=524288
To make this setting permanent, add it to /etc/systctl.conf
file.
This could be caused by a firewall, disabled multicast or issues with docker.
Please refer to ROS 2 troubleshooting guide.
If your machine is a bit less powerful, you can try a lightweight, simple Warehouse scene instead of the Loft scene.