AWS Robotics Blog

Improving control of diagnostic tools in simulations with AWS RoboMaker tool configuration

Introduction

When running a simulation, developers use diagnostic tools to interact with and debug the simulation. AWS RoboMaker released a tool configuration feature that allows customers to improve control of diagnostic tools with their simulations. This new level of control allows users to configure which default tools to run, change the commands used to run them, and add additional tools. In this blog, we walk through two procedures. First, we walk through how to add a configuration to an existing tool and, second, how to add a new tool to your simulation.

Default and custom diagnostic tools

Simulation tools such as RViz, RQT, Gazebo client, and terminals are the default tools provided in AWS RoboMaker. Until now, AWS RoboMaker ran these diagnostic tools for every simulation job with default settings in place. Now, for each simulation tool, you can configure what command to run, the exit behavior for the tool, whether to stream the UI for interactive viewing, and whether to stream the logs to Amazon CloudWatch. Configuring the tool command allows for passing in tool configuration files to tools, eliminating the need to manually configure them each time they are opened. Additionally, this feature allows you to add custom diagnostic tools of your choice, or choose to run no tools. Running without tools can reduce the resources and cost required to run simulations.

When configuring a diagnostic tool with AWS RoboMaker, you have the following options:

  • Specify the command to invoke the tool – this is useful if you have a command line argument to pass the tool such as a configuration file. We detail an example of using a configuration file with RViz later in this blog.
  • Choose whether to restart the tool if it exits – for some tools, like RViz, you may want them to restart if they exit unexpectedly. For other tools, such as logging tools, you may want them to cause the entire simulation job to fail, if they are integral to the simulation job.
  • Choose whether to stream the UI – for interactive, graphical tools, Stream UI should be On, to enable the GUI. Stream UI can also be set to Off if you want to run a tool in the background, such as a logger.
  • Choose whether to stream text output – this option streams the ‘stdout’ and ‘stderr’ outputs to log files in a dedicated Amazon CloudWatch log stream. In the case of a non-GUI tool that has text output, you may want to set Stream UI to Off and Stream output to On.

Edit an existing tool configuration

In this tutorial, we run the AWS RoboMaker robot monitoring sample application that launches a simulation of a Turtlebot3 robot navigating the AWS RoboMaker Bookstore World. We show you how to configure RViz, the default visualization tool in AWS RoboMaker, so you can easily view the Turtlebot3 in the AWS RoboMaker console as it moves autonomously through the Bookstore World.

Prerequisites

For this tutorial, you should have the following prerequisites:

  1. An AWS account.

High-level tutorial overview

  1. Create a simulation job
  2. Edit the RViz tool command
  3. Open RViz and see the robot move

To create a simulation job

  1. Launch a simulation job from a sample application.
  2. Clone the simulation job so you can make changes to the cloned version. From the top right corner, choose Actions, Clone.

Edit the RViz tool configuration

  1. From the left menu, choose Step 2 – Specify robot application.
  2. Scroll down and expand the Robot application tools.

  1. Choose Customize tools then select the RViz
  2. From the Tools actions drop-down list choose Edit Tool.
  3. The RViz command for this sample app is set to:
rviz -d `rospack find cloudwatch_robot`/rviz/turtlebot3_navigation.rviz
  1. Note that this can be changed to use a different RViz config file by changing the <package name> and <config file> name to a custom file:
rviz -d `rospack find <package_name>`/rviz/<config_file.rviz>
  1. Select exit behavior to Restart so that if the tool exits, the simulation job will restart it.
  2. Choose Enable UI streaming so that you can access the RViz GUI through the console.
  3. Choose Update tool to save the changes.

 

 

  1. Choose Next to save the robot application and specify the simulation application. No changes to the simulation application are needed, so choose Next This takes you to the Review and create simulation job page.
  2. Scroll down to the bottom and choose Create to create the simulation job.

Once your job is running, you see the tools listed in the console.

To open RViz and see the robot move

  1. In the rviz tool, choose Connect.
  2. Zoom out by right clicking in the view pane and moving the mouse arrow down

The robot should now be moving autonomously around the map in the RViz view.

Now you know how to add a configuration to an existing tool. Next, we show how to add a custom tool to your application.

To add a custom tool

Another benefit diagnostic tools configuration is that you can run any tool available in the simulation environment or included in your application bundle. In this tutorial, we show you how to add a tool called PlotJuggler to a simulation application and how to use the tool to assess the simulation run. The steps outlined in the tutorial can be repeated for other tools.

Prerequisites

For this tutorial, you should have the following prerequisites:

  1. An AWS account.
  2. An AWS RoboMaker CloudWatch sample application.
  3. An Ubuntu 18.04 development system with ROS Melodic installed or you can use the AWS RoboMaker IDE.
  4. If you are using your own system, you also need to install the AWS CLI.

High-level tutorial overview

  1. Bundle PlotJuggler and simulation application
  2. Upload the bundle
  3. Configure and run a custom PlotJuggler tool
  4. Plot the robot’s commanded velocity with PlotJuggler

To bundle PlotJuggler and your simulation application

  1. Within your development environment, clone the repository.
git clone https://github.com/aws-robotics/aws-robomaker-sample-application-cloudwatch
  1. Add PlotJuggler as a dependency in the package.xml file for the cloudwatch_simulation package.
cd aws-robomaker-sample-application-cloudwatch/simulation_ws/cloudwatch_simulation
  1. Open package.xml in your favorite editor (ie. nano, vim) or IDE and insert these three lines. Then, save the file and exit the editor.
<exec_depend>plotjuggler</exec_depend>
<exec_depend>plotjuggler_ros</exec_depend>
<exec_depend>plotjuggler_msgs</exec_depend>
  1. Next, install the dependencies for the simulation application.
cd ~/aws-robomaker-sample-application-cloudwatch/simulation_ws/

vcs import < .rosinstall

rosdep install --from-paths src --ignore-src -r -y
  1. Build and bundle the simulation application using colcon, as described in the AWS Robomaker Developer Guide.
colcon build

colcon bundle

To upload the bundle

In order to upload this bundle, we need the name of the previous simulation application bundle.

  1. Open the AWS RoboMaker console, select Simulation applications.
  2. Select your application name (ie. AWSRoboMakerCloudWatch-xxx), then $LATEST, then the name of the Source file (ie. cloudwatch-simulation.tar). This opens the Amazon S3 object for your simulation application. Choose Copy S3 URI.
  3. Upload the resulting bundle file to an Amazon S3 bucket using the AWS CLI, replacing <simulation app URI> with the URI you copied.
aws s3 cp bundle/output.tar <simulation app URI>

To configure and run a custom PlotJuggler tool

  1. Open the AWS RoboMaker console to create our simulation job and configure the tools.
  2. From the left-hand menu, select Simulation jobs. Then, find the job we ran in the previous section, and clone it by choosing Actions, Clone.
  3. On the left-hand menu, choose Step 3 – Specify simulation application.
  4. Scroll down and expand the Simulation application tools
  5. Add the PlotJuggler tool as a new custom tool by selecting Customize tools.
  6. Choose Add tool. Enter PlotJuggler as the Tool name and rosrun plotjuggler plotjuggler as the command.
  7. Set Exit behavior to Restart, then Enable UI Streaming, and then click Add tool.

PlotJuggler will appear in the tools list.

  1. Choose PlotJuggler, then choose Next to save the simulation application.
  2. In Review and create simulation job, scroll to the bottom and choose Create.

To plot the robot’s commanded velocity with PlotJuggler

  1. Under PlotJuggler, choose Connect to open the PlotJuggler tool from the console.
  2. On the left panel, choose ROS Topic Subscriber, then push Start. This brings up a list of topics.
  3. Choose cmd_vel.
  4. Expand the cmd_vel drop down and select the linear x This shows a graph of cmd_vel vs. time.

You can also use PlotJuggler for plotting other useful topics such as the instantaneous acceleration from the Turtlebot3 IMU.

This concludes the tutorial. We showed you how to use the new AWS RoboMaker application tools configuration to add a custom tool to your simulation.

Clean up

To clean up the resources used in these previous examples:

  1. Open the AWS RoboMaker console.
  2. On the left-hand menu, select Simulation Jobs.
  3. Find any simulation jobs that are still in the Running status, then click on the ID, and then choose Actions, Cancel.
  4. To delete all the resources created, from the console, choose Services, CloudFormation. This shows you a list of stacks created. For each one, choose the stack name, then choose Delete.

Conclusion

In this blog, we showed two examples of how to configure diagnostic tools, both default and custom, in AWS RoboMaker. This new level of control allows you to individually select which of the default tools to run, change the commands used to run them, and add additional tools if desired. We reviewed step-by-step tutorials to add an RViz configuration file for viewing the robot in simulation, and then to add a new tool, PlotJuggler, and use it to graph time series data from our simulation.

To learn more about AWS RoboMaker, visit the AWS RoboMaker web page or contact us.

Matt Hansen

Matt Hansen

Matt Hansen is a Principal Solutions Architect specializing in Robotics at Amazon Web Services (AWS). Prior to joining AWS, Matt had 5 years working with ROS and ROS 2 in Intel’s Open Source Robotics team, where he led the ROS 2 Navigation2 project and was an original member of the ROS 2 Technical Steering Committee. He is an Oregon native and has an MS in Electrical Engineering from Portland State University.