The tutorial will show you how to simulate a robot in a 3D world using rapyuta.io
Prerequisites
The CPU architecture of the device is AMD64.
The version of ROS running on the device is ROS Melodic.
Install the Google Chrome browser.
Be familiar with git, UNIX/LINUX command terminal.
Estimated Time
30 minutes
Tutorial Walkthrough
In this tutorial, you will first add a device to rapyuta.io.
You will run turtlebot3 simulation on the cloud, and then run
keyboard teleoperation from the device.
On the left navigation bar, click Devices>All Devices.
Click ADD NEW DEVICE.
The name of the device is Teleop Device
Select Use docker compose as default runtime option.
Select Melodic as ROS Version.
In the Description box, type in demonstrate communication to Gazebo simulation running on the cloud.
Click CONTINUE.
Click COPY to copy the generated token.
Run the copied token in the device’s terminal. The token sets up rapyuta.io device agent on the device.
When the device is successfully registered, you will see a green dot next to the device’s name, indicating that the device is online.
Create builds
You will create two builds in the tutorial.
Simulation build
To create the build, follow the below steps:
On the left navigation bar, click Development>Builds
Click on ADD NEW BUILD
In the Build Name box, enter a name for the build, for example, io-simulation-teleoperation
In the Git repository box, enter the URL address :
https://github.com/rapyuta-robotics/io_simulation_tutorials and select Build Recipe as Catkin.
In the context directory, enter turtlebot_teleoperation
Click on next, select ROS Version as Melodic and select the Has Simulation option.
Click on Add Parameter under CATKIN BUILD PARAMETERS,
add the following ROS Packages:turtlebot3_gazebo turtlebot3_description
add the following packages to Blacklist:
turtlebot3 turtlebot3_bringup turtlebot3_example turtlebot3_navigation turtlebot3_slam
Click on next, the build will be created.
The build takes about two to five minutes to build the source code in the io_simulation_tutorials
repository into a running docker container. You may analyze the corresponding
build logs, which help debug failing builds.
Teleoperation build
To create the build, follow the below steps :
On the left navigation bar, click Development>Builds
Click on ADD NEW BUILD
In the Build Name box, enter a name for the build, for example, turtlebot-teleoperation
In the Git repository box, enter the URL address :
https://github.com/ROBOTIS-GIT/turtlebot3#melodic-devel and select Build Recipe as Catkin.
Click on next, select Architecture as amd64 and select ROS Version as Melodic.
Click on Add Parameter under CATKIN BUILD PARAMETERS,
add the following ROS Packages:turtlebot3_teleop
add the following packages to Blacklist:turtlebot3 turtlebot3_bringup turtlebot3_example turtlebot3_navigation turtlebot3_slam turtlebot3_description
Click on next, the build will be created.
The build takes about two to five minutes to build the source code in the turtlebot3
repository into a running docker container. You may analyze the corresponding
build logs, which help debug failing builds.
Please proceed to the creation of the package once the builds are complete.
Create Packages
You will create two packages in the tutorial.
Turtlebot3 Robot Simulation Package
On the left navigation bar, click Development > Packages.
Click ADD NEW PACKAGE.
The name of the package is Turtlebot3 Robot Simulation.
Make sure Is a singleton package is not selected.
Ensure Is a bindable package is selected.
The version of the package is 1.0.0
The purpose of the package is to run Gazebo simulation on the cloud
Click NEXT.
The name of the component is Simulator.
The runtime of the component is Cloud.
Ensure Is ROS Component is selected.
Choose Melodic for ROS Version.
The number of replicas to run the component is 1
The name of the executable is turtlebot3_autotrace_launcher
For Executable Type, click on Development>Builds.
From the Choose Build drop-down menu, select io-simulation-teleoperation.
In the Command to run in the docker container box, enter the command: roslaunch turtlebot3_gazebo turtlebot3_autorace.launch
Set Resource Limit to Medium:2 CPU cores, 8 GiB memory.
For simulation, the resource limit should either be Medium or Large. Simulation has issues with Small resource limits.
Click Add Topic under Inbound ROS Interfaces to add the ROS topic a deployment of this package subscribes to for velocity commands. The name of the topic is /cmd_vel
Click CONFIRM PACKAGE CREATION.
Turtlebot3 Keyboard Teleoperation Package
On the left navigation bar, click Development > Packages.
Click ADD NEW PACKAGE.
The name of the package is Turtlebot3 Keyboard Teleoperation
The version number of the package is 1.0.0
Make sure Is a singleton package is not selected.
Ensure Is a bindable package is selected.
The purpose of the package is to control the robot using the keyboard.
The name of the component is teleop
The runtime of the component is Device.
Ensure Is ROS Component is selected.
Select Melodic for ROS Version.
The CPU architecture is amd64.
Set Restart Policy to Always.
The name of the executable is sleep
For Executable Type, click on Development>Builds.
From the Choose Build drop-down menu, select turtlebot-teleoperation.
In the Command to run in the docker container box, enter the command: sleep infinity
The command, sleep infinity, will keep the deployment running and does not serve any other purpose.
Add a ROS topic by clicking on Add ROS topic. The name of the topic is /cmd_vel, and its QoS is set to Low.
Click NEXT > CONFIRM PACKAGE CREATION.
Create a Cloud Routed Network
A routed network allows you to establish ROS communication between different ROS package deployments. Binding a routed network resource to your deployment will enable other deployments on the same routed network to consume ROS topics/services/actions as defined in the package. If you have already created a routed network, skip the following steps.
Perform the following procedure to create a routed network.
On the left navigation bar, click NETWORKS.
Click ADD NEW ROUTED NETWORK.
Enter cloud_routed_network_1 as the name for the routed network.
Select ROS Distro, as Melodic.
Select the Runtime as Cloud.
From the Resource limit field, select the memory allocation and computational ability of the routed network. These resources are reserved in the platform for effective ROS communication. For this tutorial, you can select Small: 1cpu core, 4 GiB memory as the resource limit.
Click CONTINUE.
Deploy Packages
You will deploy all the packages created in the previous step.
Robot Simulation
On the left navigation bar, click Development > Packages.
Select Turtlebot3 Robot Simulation package.
Click Deploy Package.
The name of the deployment is ROBOT SIMULATION
Enter the value for VNC_PASSWORD.
Click on ROUTED NETWORK > Add, select the routed network you created from the dropdown list.
Click CREATE DEPLOYMENT > Confirm.
You will be redirected to the Details tab of the newly created deployment. The ROBOT SIMULATION is successfully running if the progress bar reaches Succeeded, and the status is Running.
Keyboard Teleoperation
On the left navigation bar, click Development > Packages.
Select Turtlebot3 Keyboard Teleoperation package.
Click Deploy Package.
The name of the deployment is KEYBOARD TELEOPERATION
Select Teleop Device to deploy the teleop component.
Click on ROUTED NETWORK > Add, select the routed network you created from the dropdown list.
Click CREATE DEPLOYMENT > Confirm.
You can verify if KEYBOARD TELEOPERATION is running successfully by checking if the progress bar reaches Succeeded and status is Running.
Simulation
On the Details tab of ROBOT SIMULATION deployment, copy the value of the network endpoint vnc.
Paste the copied URL address in the address bar of the web browser and press Enter.
Enter the value of VNC_PASSWORD, which you provided while deploying the package when prompted. You will view the 3D world and the Teleop Device (robot) inside it.
Go to the Shell Access tab of KEYBOARD TELEOPERATION deployment, and click on SSH.
Try controlling the robot using the keyboard commands shown in the terminal output. To see how the robot moves, switch to the Gazebo simulation browser tab.
To reset simulation, Ctrl+C and then run rosservice call /gazebo/reset_simulation