Turtlesim
Turtlesim is a tool made for teaching ROS and ROS packages.
This tutorial will show you how to set up and run a variation of the ROS Turtlesim on the cloud using rapyuta.io.
To attain a deeper understanding of rapyuta.io, it is highly recommended that the developer refer to the following sections in the documentation
Learning objectives
The tutorial will show you how to deploy a basic Turtlesim ROS package on the cloud.
The steps mentioned here would help you
- Create a routed network for ROS Communication
- Understand packages and how they can be added to your account.
- Deploy packages to the cloud
- Access network endpoints of the cloud deployment
- Bonus: ROS communication using across deployments and a common routed network
The tutorial will also have a few optional and exploratory steps covering
- Recording ROS Bag jobs on running deployments
- Remote SSH for accessing deployments
- Accessing logs of deployments
Estimated Time
15 - 30 minutes
Difficulty
Beginner
Prerequisites
- Ensure that the Google Chrome browser is installed on the computer.
- You should have your account setup completed and have 1 Project created.
- You should be familiar with the below tools:
- UNIX/LINUX command terminal
- ROS topics
- ROS services
Step 1: Create a Routed Network
rapyuta.io offers seamless communication between different ROS nodes running on the cloud or a device. This automatic communication reduces the need to manage shared ROS masters and allows you to focus on building your robotics solution.
Let’s begin by creating a melodic-cloud-rnet routed network.
- On the left navigation menu, click Networking > Networks.
- Click Add Network and select Routed Networks.
- In the Create new routed network dialog-box, enter the following details in the respective fields.
- Name : Type
melodic-cloud-rnet
as the name of the routed network.
- ROS Distro: From the drop-down menu, select the ROS distro as
Melodic
.
- Runtime: Select the runtime as
Cloud
.
- Resource Limit: Select the resource limit as
Small: 1cpu core, 4Gib memory
.
- Click Continue.
Your new network would now be provisioned in a few minutes.
💡 Understand: Routed Networks
For people familiar with ROS1, discovery & communication between nodes and their advertised topics, services and actions are facilitated via a ROS Master.
This communication pattern works well on a single machine, or in a local area network [LAN].
A key limitation of the ROS1 communication mechanism comes from the fragility of a single ROS Master shared between nodes both on the same device or on the same LAN. This makes the system especially susceptible to network fluctuations and ROS Master failures.
ROS Routed networks are a key component in this seamless communication scheme. For more information about routed network, click here
Step 2: Import Packages
Software is distributed on rapyuta.io’s cloud platform using Packages.
We will begin with importing the TurtleSim packages into your account.
- Import
Turtle-World
package into your account
If you want to create your own packages, refer to the how to guide and deep dives on Packages.
💡 Understand : Packages
Packages are a way of defining components that need to be deployed together.
The two packages imported above help to simulate a simple flat 2D world where multiple turtles can be spawned and moved.
Turtle-World provides the simulated world with simple rectangular walls. It also provides services to add and move one or more turtles.
By default, a single turtle is added to the world on startup.
Along with running the ROS components for the turtle world’s rudimentary simulation,
the package also comes with a Web application to visualize the turtle world and a few developer-friendly additions like a notebook server and desktop UI access over WebVNC.
More turtles can be added by deploying the Turtle Melodic package.
It has a simple ROS node, no GUI environment, and communicates with Turtle-World using ROS topics, services, and actions over a Routed Network
First, examine Turtle-World in detail.
-
Turtle-World has a component that runs on the cloud.
In package specification terminology, this is referred to as a component with a cloud runtime.
-
This component runs a simple Docker image on the cloud.
In package specification terminology, this is referred to as an executable with a docker image reference
💡 Did you find the docker image used in the package? Look for the docker image name under the executable section
-
Cloud Endpoints allow for TCP/HTTP-based services in your component to be accessible on the public internet or to other deployments.
In the world package we have added a few note-worthy endpoints.
- HTTP endpoint for a simple web-UI to visualize turtles and their world
- TCP endpoint for WebSocket connections to
rosbridge_server
- HTTP endpoint exposing a notebook server for you to play with the turtle example and explore the ROS workspace
- VNC endpoint to access the desktop remotely.
💡 Did you notice the fifth endpoint exposed by the package?
- We expose the ssh service as an endpoint. but it is not recommended to expose SSH in production environments.
- For accessing your running deployment’s shell rapyuta.io offers Remote SSH access from any running deployment’s detail page.
-
Configuration Parameters
- We have defined the default user
rapyuta
’s password using configuration parameters of the package.
💡 Did you find the default password set by the package?
Step 3: Deploy Packages
Deployments are instances of running packages. Begin by deploying the Turtle-World package.
- On the left navigation menu, click Development > Package
- Click the package Turtle-World, and click Deploy package.
- In the Name of deployment field, type
turtlesim-cloud
.
- Optionally, to add a new ROS bag job to the deployment, click Add ROS bag Job. In the Name field, type
rosbag-all
and select All Topics to record.
- From the Routed Network drop-down menu, select
melodic-cloud-rnet
.
- Click Create Deployment to proceed.
The deployment should now start running in the cloud. This usually takes a few minutes. You would be taken to the detail page of the deployment where the progress of the provisioning can be seen.
When the deployment is running its status should show up as Succeeded with a green dot next to it.
Step 4: Explore Turtle World
Congratulations! You have your first deployment running on rapyuta.io.
Open the TURTLESIM_WEB endpoint to access turtlesim world web UI in a new browser tab.
- Try moving the Turtle around using the command interface.
- If the Turtle behaves as you expect, you have successfully finished the basic tutorial.
Additionally, you can also,
- Open the JUPYTER endpoint to access the notebook server.
- Jupyter server has been configured with the python 2 kernel and has python-ros packages installed.
- Try moving the turtle programmatically
- Open the VNC endpoint to access a complete desktop environment
💡 Endpoints can be found on the Deployment Detail Page. They are of the format http://inst-xxxxxxxx:80 , https://inst-xxxxxxx:443
Remote SSH
rapyuta.io allows you to access running deployment over a web SSH terminal right from your browser.
- Go to Development > Deployment
- Click on the deployment you created above: turtlesim-cloud
- Click on Shell Access
- Click SSH on the turtlesim component.
Remote SSH helps you in debugging deployments that are running on the platform but don’t come bundled with remote-debugging tools like webVNC or notebook servers.
Logs
rapyuta.io captures and stores terminal output for your running deployments.
You can access both the live-logs of a running deployment as well as the historical logs of a deployment that is running or has been stopped recently.
Historical logs of deployment are retained for 7 days or more as per your subscription plan.
To access logs for turtlesim-cloud
- Go to Development > Deployment
- Click on the deployment you created above: turtlesim-cloud
- Click on either Live Logs or Historical Logs to see the output generated by the deployment.
Read more about logs here
ROS Bag
rapyuta.io can record rosbags on your running deployments.
Recording jobs added at the time of deployment creation start and stop with the deployment.
You can additionally start new ROS bag jobs on any running deployment.
You can also stop any ROS bag job manually while a deployment is still running.
Ros bag jobs upload the recorded bags to Cloud storage and these bags are available for easy access and archiving even after your deployment stops running.
To access ROS bags recorded on our deployment
- Go to Development > Deployment
- Click on the deployment you created above : turtlesim-cloud
- Click on ROS Bag jobs
- Click on Stop to stop a running job
- In a few minutes, ROS bag job will go from Stopping to Stopped
- Rosbags uploaded to cloud storage will appear under Collected Bags
Read more about Rosbags on rapyuta.io here
Bonus: More Turtles
We will now add another turtle into the sim world.
To do this, import and deploy the Turtle Melodic package over the same routed network as Turtle-World
- Import
Turtle Melodic
pacakge into your account
- Once the package is imported, you would be automatically taken to the package detail page
- On the detail page, press Deploy package.
- Enter the following details in the respective fields.
- Name of deployment:
turtle-1
- Routed Network: Press Add and select
melodic-cloud-rnet
from the network drop-down menu.
- Click Create Deployment to proceed.
The second turtle should now show up in the Web-UI.
You can deploy more Turtles if you want. You can now command two turtles simultaneously.
Cleanup
💡 Deployments consume cloud resources that are chargeable beyond your free-tier usage limit. It is advised to deprovision deployments when not in use.
To deprovision (stop) a running deployment, follow the steps:
- Go to Development > Deployments
- Click Deprovision against the running deployment that you want to stop.
- Deployment is successfully deprovisioned when you get a DEPLOYMENT STOPPED message and the corresponding deployment status read Stopped.
- Repeat these steps for any deployment you may have created but aren’t using anymore.