AWS Robotics Blog
Improving control of diagnostic tools in simulations with AWS RoboMaker tool configuration
This blog references AWS RoboMaker Integrated Development Environment (IDE), a feature that has been deprecated. To follow along with this blog post, use the AWS Cloud9 IDE. See our updated blog on how to Build and simulate robotics applications in AWS Cloud9.
This blog uses colcon bundle for robot and simulation applications. AWS RoboMaker now only supports containers to make it easy for you to bring and run your own simulations and applications. To follow along with this blog post, see our updated blog on Preparing ROS application and simulation application containers for AWS RoboMaker.
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:
- An AWS account.
High-level tutorial overview
- Create a simulation job
- Edit the RViz tool command
- Open RViz and see the robot move
To create a simulation job
- Launch a simulation job from a sample application.
- 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
- From the left menu, choose Step 2 – Specify robot application.
- Scroll down and expand the Robot application tools.
- Choose Customize tools then select the RViz
- From the Tools actions drop-down list choose Edit Tool.
- The RViz command for this sample app is set to:
rviz -d `rospack find cloudwatch_robot`/rviz/turtlebot3_navigation.rviz
- 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>
- Select exit behavior to Restart so that if the tool exits, the simulation job will restart it.
- Choose Enable UI streaming so that you can access the RViz GUI through the console.
- Choose Update tool to save the changes.
- 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.
- 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
- In the rviz tool, choose Connect.
- 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:
- An AWS account.
- An AWS RoboMaker CloudWatch sample application.
- An Ubuntu 18.04 development system with ROS Melodic installed or you can use the AWS RoboMaker IDE.
- If you are using your own system, you also need to install the AWS CLI.
High-level tutorial overview
- Bundle PlotJuggler and simulation application
- Upload the bundle
- Configure and run a custom PlotJuggler tool
- Plot the robot’s commanded velocity with PlotJuggler
To bundle PlotJuggler and your simulation application
- Within your development environment, clone the repository.
git clone https://github.com/aws-robotics/aws-robomaker-sample-application-cloudwatch
- 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
- 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>
- 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
- 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.
- Open the AWS RoboMaker console, select Simulation applications.
- 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.
- 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
- Open the AWS RoboMaker console to create our simulation job and configure the tools.
- 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.
- On the left-hand menu, choose Step 3 – Specify simulation application.
- Scroll down and expand the Simulation application tools
- Add the PlotJuggler tool as a new custom tool by selecting Customize tools.
- Choose Add tool. Enter PlotJuggler as the Tool name and rosrun plotjuggler plotjuggler as the command.
- Set Exit behavior to Restart, then Enable UI Streaming, and then click Add tool.
PlotJuggler will appear in the tools list.
- Choose PlotJuggler, then choose Next to save the simulation application.
- In Review and create simulation job, scroll to the bottom and choose Create.
To plot the robot’s commanded velocity with PlotJuggler
- Under PlotJuggler, choose Connect to open the PlotJuggler tool from the console.
- On the left panel, choose ROS Topic Subscriber, then push Start. This brings up a list of topics.
- Choose cmd_vel.
- 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:
- Open the AWS RoboMaker console.
- On the left-hand menu, select Simulation Jobs.
- Find any simulation jobs that are still in the Running status, then click on the ID, and then choose Actions, Cancel.
- 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.