AWS RoboMaker
Developer Guide

Creating a Simulation Job

This section describes how to create a simulation job from the command line.

Prerequisites

To create an AWS RoboMaker simulation job from the command line, you need the following:

  • The AWS Command Line Interface (AWS CLI). For more information about installing the AWS CLI, see Installing the AWS CLI.

  • A robot application and a simulation application. They must be bundled with colcon and target the X86_64 platform. To create a simple robotics application and simulation application from scratch, see Creating a New Robotic Application.

Optionally, you will need access to the AWS RoboMaker console for easy access to simulation tools like Gazebo, rqt, rviz and terminal. These tools are available on the Simulation Job Detail page.

Create Source and Output Amazon S3 Buckets

Before you create a simulation job, you need to create a bucket to use as source location for your applications. You can also create a bucket for output generated during the simulation job.

  1. Open the command prompt.

  2. Create a bucket for your application source. This bucket will be the source location for your robot and simulation applications. Select a unique bucket name.

    $ aws s3 mb s3://MyApplicationSource
  3. Create a bucket for output generated by the simulation job. AWS RoboMaker uploads ROS bags, ROS logs and Gazebo logs when the simulation job completes. Select a unique bucket name.

    $ aws s3 mb s3://MySimulationJobOutput

Create a Robot Application

Before you can create a simulation job, you need to create a robot application in AWS RoboMaker. It contains details like target architecture and ROS version. It can be used in a simulation job and can be deployed to physical robots in a fleet.

  1. Open the command prompt.

  2. Copy the robot application source bundle to your Amazon S3 bucket. It is renamed to /my-robot-application.tar.gz during the copy. The bundle might be .tar or .tar.gz extension.

    The robot application must be built for the X86_64 platform.

    $ aws s3 cp robot_ws/bundle/output.tar.gz s3://MyApplicationSource/my-robot-application.tar.gz
  3. Create a robot application in AWS RoboMaker.

    $ aws robomaker create-robot-application --name MyRobotApplication --sources s3Bucket=MyApplicationSource,s3Key=my-robot-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic

    The call returns information about the newly created robot application. You will use the Amazon Resource Name (ARN) when you create the simulation job.

Create a Simulation Application

A simulation application contains all of the assets and logic needed to simulate an environment. You need to create a simulation application in AWS RoboMaker before you can create a simulation job.

  1. Open the command prompt.

  2. Copy the simulation application source bundle to your Amazon S3 bucket. The simulation application must be built for the X86_64 platform. The bundle might be .tar or .tar.gz extension.

    $ aws s3 cp simulation_app/bundle/robot_ws/bundle/output.tar.gz s3://MyApplicationSource/my-simulation-application.tar.gz
  3. Create a simulation application in AWS RoboMaker.

    $ aws robomaker create-simulation-application --name MySimulationApplication --sources s3Bucket=MyApplicationSource,s3Key=my-simulation-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic --simulation-software-suite name=Gazebo,version=7 --rendering-engine name=OGRE,version=1.x

    The call returns information about the newly created simulation application. You will use the Amazon Resource Name (ARN) when you create the simulation job.

Create a Simulation Job Role

When you create a simulation job, you need to specify an IAM role AWS RoboMaker can use to access resources like Amazon S3 buckets and Amazon CloudWatch Logs. The role will also be used by your robot application to access resource it consumes like Amazon Lex or Amazon Rekognition.

If you have already created a role, you can skip to Create a Simulation Job.

To create the simulation job role

  1. Sign in to the AWS Management Console and open the AWS Identity and Access Management console at console.aws.amazon.com/iam.

  2. Create the access policy. On the left, choose Policies, then choose Create policy. Choose JSON and paste the code below:

    { "Version": "2012-10-17", "Statement": [ { "Action": "s3:ListBucket", "Resource": [ "arn:aws:s3:::my-input-bucket" ], "Effect": "Allow" }, { "Action": [ "s3:Get*", "s3:List*" ], "Resource": [ "arn:aws:s3:::my-input-bucket/*" ], "Effect": "Allow" }, { "Action": "s3:Put*", "Resource": [ "arn:aws:s3:::my-output-bucket/*" ], "Effect": "Allow" }, { "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams" ], "Resource": [ "arn:aws:logs:*:account#:log-group:/aws/robomaker/SimulationJobs*" ], "Effect": "Allow" }, { "Action": [ "ec2:CreateNetworkInterfacePermission" ], "Resource": [ "arn:aws:ec2:*:account#:*" ], "Effect": "Allow" }, { "Action": [ "ec2:AssociateRouteTable", "ec2:CreateSubnet", "ec2:DeleteNetworkInterface", "ec2:DeleteSubnet", "ec2:DescribeNetworkInterfaces", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs" ], "Resource": "*", "Effect": "Allow" } ] }

    Replace my-input-bucket and my-output-bucket with your input and output bucket names. Replace account# with your AWS account number.

    Choose Review policy, type in a Name, and then choose Create policy.

  3. Choose Roles and then choose Create role.

  4. In the Create role: Step 1 page, choose RoboMaker. Choose RoboMaker - Simulation as the use case, then choose Next: Permissions.

  5. In the Permissions page, select the policy you created above, then choose Next: Tags.

  6. In the Add tags page, add optional tags to the role, then choose Next: Review.

  7. In the Review page, type in a Role name and then choose Create role.

  8. Select Roles and then select the role you created. Note the Amazon Resource Name (ARN) for the role. You will use it when you create the simulation job.

Create a Simulation Job

When you create a simulation job, you specify the applications in the simulation and their launch configurations, the IAM role, and simulation duration.

To create a simulation job

  1. Open the command prompt.

  2. Create the simulation job.

    $ aws robomaker create-simulation-job --max-job-duration-in-seconds 3600 --iam-role arn:aws:iam::111111111111:role/RoboMakerSimulationJobRole --robot-applications application=arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551987693226,launchConfig='{packageName=robot_app,launchFile=rotate.launch}' --simulation-applications application=arn:aws:robomaker:us-west-2:111111111111:simulation-application/MyRobotApplication/1551988628094,launchConfig='{packageName=simulation_app,launchFile=example.launch}'
  3. Check on the status of your simulation job using the following commands.

    $ aws robomaker list-simulation-jobs $ aws robomaker describe-simulation-job --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-pql32v7pfjy6

    Once the simulation has a status of Running, you can use tools like Gazebo, rqt, rviz and terminal to visualize sensors, devices, and other aspects of the simulation. To access the tools, open the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/, then choose Simulation jobs, then select your simulation. Scroll down and select one of the tools.

    For more information about simulation tools, see Simulation Tools.