Tutorial: Turtlebot3 Demo Scene with ROS2 and Unity3D¶
Note
Prerequisites – The following is required for this tutorial
- Unity3D last stable version
- Docker and docker-compose
- ROS2 dependencies
- Сloned this repository unity_ros2.
The goal of this tutorial is to get the turtlebot3 sample scene up and running and to explore some of the features in unity_ros2.
Getting a Unity Project with ROS2 support¶
Navigate to ~/UnityRos2/Assets
and run python3 start_editor.py
. This script sets environment variables and starts the Unity Editor. Don’t use sudo. This is only way to start the Editor with ROS2 support at the moment. Opening the project through Unity Hub is not supported yet.
Unity should now look similar to the image above. (Depending on your layout settings for Unity).
Double click on Turtlebot3NavigationDemo located under Assets/Scenes
in the Project window.
Press the Play button to start the simulation.
If everything is working, there should be no error messages in the Console.
To teleop the turtlebot3 with your keyboard (wasd or arrows), navigate to Inspector window then click Add Component. Find Unity Input Teleop and select it. Then navigate to Game window and press navigation buttons.
If everything is fine TurtleBot3 must move.