Basic Simulation With Teleoperation
Learning Objective
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.
Difficulty
Intermediate
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.
Add a Device
- On the left navigation bar, click 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 below steps:
- On the left navigation bar, click BUILDS
- Click on ADD NEW BUILD
- In the Build Name box, enter a name for the build say
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 analyse the corresponding
build logs, which help debug failing builds.
Teleoperation build
To create the build, follow below steps :
- On the left navigation bar, click BUILDS
- Click on ADD NEW BUILD
- In the Build Name box, enter a name for the build say
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 analyse the corresponding
build logs, which help debug failing builds.
Please proceed to creation of 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 CATALOG.
- 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 Builds.
- In the Choose Build select the Build (
io-simulation-teleoperation
) created above
from the drop-down list
- 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 CATALOG.
- 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 Builds.
- In the Choose Build select the Build (
turtlebot-teleoperation
) created above
from the drop-down list
- 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.
Deploy Packages
You will deploy all the packages created in the previous step.
Robot Simulation
- On the left navigation bar, click CATALOG.
- Select Turtlebot3 Robot Simulation package.
- Click Deploy Package.
- The name of the deployment is
ROBOT SIMULATION
- Enter the value for VNC_PASSWORD.
- 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 CATALOG.
- Select Turtlebot3 Keyboard Teleoperation package.
- Click Deploy Package.
- The name of the deployment is
KEYBOARD TELEOPERATION
- Select Teleop Device to deploy the teleop component.
- Add ROBOT SIMULATION as a dependent deployment by clicking Add dependency.
- 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.
- Enter the following commands in sequence:
bash
. /opt/catkin_ws/devel/setup.bash
TURTLEBOT3_MODEL=burger roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
- Try controlling the robot using the keyboard commands shown in ther 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