• 沒有找到結果。

AWS RoboMaker

N/A
N/A
Protected

Academic year: 2022

Share "AWS RoboMaker"

Copied!
545
0
0

加載中.... (立即查看全文)

全文

(1)

AWS RoboMaker

Developer Guide

(2)

AWS RoboMaker: Developer Guide

Copyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

(3)

Table of Contents

What Is AWS RoboMaker? ... 1

Are You a First-time User of AWS RoboMaker? ... 1

Supported Software and Versions ... 1

Software Support Policy ... 2

Support Changes: March 15th, 2022 ... 2

Support ended April 2021 ... 3

How It Works ... 5

Robotics Development with AWS RoboMaker ... 5

Create a ROS Development Environment ... 5

Create a Robot Application ... 6

Develop Simulation and Testing Data ... 6

Getting Started ... 8

Getting Started with AWS RoboMaker ... 8

Important Licensing Information ... 8

Step 1: Create an Account ... 9

Step 2: Configure Environment and Build Applications ... 10

Step 3: Run Robot and Simulation Applications ... 11

Step 4: Run a Simulation Job ... 12

Step 5: Clean up ... 13

Getting Started with Simulation WorldForge ... 13

Step 1: Complete the Prerequisites ... 13

Step 2: Create a Simulation World Template ... 14

Step 3: Generate a Simulation World from the Simulation World Template ... 14

Step 4: Use the Generated World in the Hello World Simulation ... 15

Step 5: Clean Up Resources ... 15

Sample Applications ... 16

Launching a Sample Application ... 16

Configuring Permissions ... 17

Minimum permissions ... 17

Application Versioning ... 19

Application Versioning With Bundles ... 19

Application Versioning With Images ... 19

The $LATEST Version ... 20

Updating an Application Version ... 20

Deleting an Application Version ... 20

Application Versioning for Bundles ... 21

Developing Applications ... 22

Creating a New Robotic Application ... 22

Prerequisites ... 23

Create the Robot Application Workspace ... 23

Create the Simulation Application Workspace ... 26

Build the Robot and Simulation Application Bundles ... 29

Building and Bundling Robotic Applications with Colcon ... 30

Installing Colcon ... 30

Using Colcon to Build and Bundle ... 30

Using Images to Develop Your AWS RoboMaker Applications ... 31

Migrating ROS Applications to Containers ... 31

ROS Containers FAQ ... 32

Requirements for AWS RoboMaker Compatible Containers ... 35

Creating Images to Run GPU Applications ... 50

Creating Images to Run the Hello World Sample Application ... 51

Creating a Simulation Job with a Container Image ... 64

Using Amazon S3 Prefix and Archive Data Sources ... 66

Using Amazon S3 Prefixes to Load Your Data Into AWS RoboMaker ... 67

(4)

Creating a Simulation Job ... 68

Prerequisites ... 68

Create Source and Output Amazon S3 Buckets ... 68

Create a Robot Application ... 68

Create a Simulation Application ... 69

Create a Simulation Job Role ... 69

Create a Simulation Job ... 71

Using generated worlds in your simulation ... 71

Using an imported world in a simulation job ... 72

Using an exported world locally in ROS and Gazebo ... 72

Using an exported world with custom physics, lights, and models ... 73

Developing with AWS Cloud9 ... 73

Creating a Development Environment ... 74

Virtual Desktop (NICE DCV) ... 74

Build and Bundle Applications ... 75

Menu Commands Reference ... 76

Deleting an Environment ... 76

Working with Robot Applications ... 77

Creating a Robot Application ... 77

Creating a Robot Application Version ... 78

Viewing a Robot Application ... 79

Updating a Robot Application ... 79

Deleting a Robot Application ... 80

Deleting a Robot Application Version ... 80

Working with Simulation Applications ... 82

Creating a Simulation Application ... 82

Creating a Simulation Application Version ... 83

Viewing a Simulation Application ... 84

Updating a Simulation Application ... 84

Deleting a Simulation Application ... 85

Deleting a Simulation Application Version ... 86

Creating Worlds with Simulation WorldForge ... 87

Simulation WorldForge Concepts ... 87

Understanding Simulation World Templates ... 88

Floor Plan ... 88

Interiors ... 89

Common Tasks ... 90

Specifying a List of Rooms for a Floor ... 91

Requesting a Long Hallway ... 92

Requesting a Doorway Between Rooms ... 92

Applying a Configuration to All Rooms ... 93

Requesting Doors in Doorways ... 94

Requesting No Doors in Doorways ... 95

Requesting a Wide Floor Plan Footprint ... 96

Requesting a Custom Ceiling Height ... 96

Specifying the Same Material Types to Floors in Different Rooms ... 97

Specifying Different Material Types to Floors Between Rooms of the Same Type ... 98

Specifying More and Less Furniture in Rooms ... 99

Adding Specific Furniture Types to all Bedrooms and a Single Shared Living/Dining Room ... 100

Specifying a Room without Furniture ... 101

JSON Schema for Simulation World Template Body ... 102

Sample World Templates in JSON ... 127

One Bedroom House ... 128

One room only ... 131

Two rooms ... 132

Managing Simulation World Templates ... 132

Creating a Simulation World Template ... 133

(5)

Viewing a Simulation World Template ... 145

Modifying a Simulation World Template ... 145

Deleting a Simulation World Template ... 146

Simulation World Template Releases ... 147

Managing World Generation Jobs ... 148

Creating a World Generation Job ... 148

Viewing a World Generation Job ... 149

Cancelling a World Generation Job ... 150

Managing World Export Jobs ... 150

Creating a World Export Job ... 151

Viewing a World Export Job ... 151

Managing Generated Worlds ... 152

Exporting a Generated World ... 152

Viewing a Generated World ... 152

Deleting a Generated World ... 153

Running Simulation Jobs ... 154

VPC Settings ... 154

Configuring an AWS RoboMaker Simulation Job for Amazon VPC Access ... 154

Internet Access for Simulation Jobs ... 155

Configuring SimulationJob Compute ... 155

Connecting to a Simulation Job ... 156

Before You Enable Port Forwarding ... 156

Enabling Port Forwarding ... 156

Port Forwarding Examples ... 157

Accessing Simulation Job Data ... 159

Configuring Custom Uploads ... 159

Adding a Custom Upload Configuration ... 160

Root Access and System Capabilities ... 161

Environment Variables Created by AWS RoboMaker ... 162

Managing Tags in a Simulation Job ... 162

Using tags using ROS command-line tools ... 163

Using tags from code in a simulation application ... 163

Using ROS Bags for Play Back ... 164

Example Launch File Configurations ... 164

Avoiding a Failed Simulation Job when Play Back Ends ... 167

Using Tags for Custom Status and Property Values ... 167

Canceling a Simulation Job Early ... 167

Managing Simulation Jobs ... 169

Creating a Simulation Job ... 169

Viewing a Simulation Job ... 177

Cancelling a Simulation Job ... 177

Cloning a Simulation Job ... 178

Restarting a Simulation Job ... 178

Managing Simulation Job Batches ... 178

Starting a Simulation Job Batch ... 179

Viewing a Simulation Job Batch ... 180

Cancelling a Simulation Job Batch ... 181

Cloning a Simulation Job Batch ... 181

Simulation Tools ... 181

Configuring Custom Simulation Tools ... 182

GZClient ... 183

rqt ... 184

rviz ... 185

Terminal ... 186

Application Deployment ... 188

Managing Robots ... 188

Deleting a Robot ... 188

(6)

Application Deployment ... 189

Deregistering Robots ... 189

Deleting a Fleet ... 190

Managing Deployments ... 190

Viewing a Deployment Job ... 191

Security ... 192

Data Protection ... 192

Authentication and Access Control ... 192

Introduction to Authorization and Access Control ... 193

Permissions Required ... 194

How AWS RoboMaker Works with IAM ... 198

Troubleshooting Authentication and Access Control ... 198

What is Authentication? ... 199

What is Access Control? ... 200

What are Policies? ... 203

AWS managed policies ... 205

Using Service-Linked Roles ... 208

Getting Started with IAM ... 210

Logging and Monitoring ... 217

Monitoring AWS RoboMaker with Amazon CloudWatch ... 217

Logging AWS RoboMaker API Calls with AWS CloudTrail ... 219

Security Compliance ... 220

Resilience ... 221

Infrastructure Security ... 221

Tagging Your AWS RoboMaker Resources ... 222

Tag Basics ... 222

Tag Restrictions and Limitations ... 223

Using Tags with IAM Policies ... 223

Troubleshooting ... 225

Troubleshooting Simulation Jobs ... 225

Simulation Job Failed ... 225

Troubleshooting Simulation WorldForge ... 228

Why did my world generation job fail? ... 228

Why did my world export job fail? ... 228

Why is there an issue with world image? ... 229

Troubleshooting Development Environments ... 229

Troubleshooting Deployments ... 231

Troubleshooting Colcon Build and Bundle ... 233

API Reference ... 236

Actions ... 236

BatchDeleteWorlds ... 238

BatchDescribeSimulationJob ... 240

CancelDeploymentJob ... 245

CancelSimulationJob ... 247

CancelSimulationJobBatch ... 249

CancelWorldExportJob ... 251

CancelWorldGenerationJob ... 253

CreateDeploymentJob ... 255

CreateFleet ... 261

CreateRobot ... 264

CreateRobotApplication ... 268

CreateRobotApplicationVersion ... 273

CreateSimulationApplication ... 277

CreateSimulationApplicationVersion ... 282

CreateSimulationJob ... 286

CreateWorldExportJob ... 297

CreateWorldGenerationJob ... 302

(7)

CreateWorldTemplate ... 308

DeleteFleet ... 312

DeleteRobot ... 314

DeleteRobotApplication ... 316

DeleteSimulationApplication ... 318

DeleteWorldTemplate ... 320

DeregisterRobot ... 322

DescribeDeploymentJob ... 325

DescribeFleet ... 329

DescribeRobot ... 333

DescribeRobotApplication ... 337

DescribeSimulationApplication ... 341

DescribeSimulationJob ... 345

DescribeSimulationJobBatch ... 353

DescribeWorld ... 361

DescribeWorldExportJob ... 364

DescribeWorldGenerationJob ... 368

DescribeWorldTemplate ... 373

GetWorldTemplateBody ... 376

ListDeploymentJobs ... 378

ListFleets ... 382

ListRobotApplications ... 385

ListRobots ... 388

ListSimulationApplications ... 391

ListSimulationJobBatches ... 394

ListSimulationJobs ... 397

ListTagsForResource ... 400

ListWorldExportJobs ... 402

ListWorldGenerationJobs ... 405

ListWorlds ... 408

ListWorldTemplates ... 411

RegisterRobot ... 414

RestartSimulationJob ... 417

StartSimulationJobBatch ... 419

SyncDeploymentJob ... 430

TagResource ... 435

UntagResource ... 437

UpdateRobotApplication ... 439

UpdateSimulationApplication ... 443

UpdateWorldTemplate ... 448

Data Types ... 450

BatchPolicy ... 452

Compute ... 453

ComputeResponse ... 454

DataSource ... 455

DataSourceConfig ... 457

DeploymentApplicationConfig ... 459

DeploymentConfig ... 460

DeploymentJob ... 461

DeploymentLaunchConfig ... 463

Environment ... 465

FailedCreateSimulationJobRequest ... 466

FailureSummary ... 468

Filter ... 469

FinishedWorldsSummary ... 470

Fleet ... 471

LaunchConfig ... 473

(8)

LoggingConfig ... 475

NetworkInterface ... 476

OutputLocation ... 477

PortForwardingConfig ... 478

PortMapping ... 479

ProgressDetail ... 480

RenderingEngine ... 482

Robot ... 483

RobotApplicationConfig ... 485

RobotApplicationSummary ... 487

RobotDeployment ... 489

RobotSoftwareSuite ... 491

S3KeyOutput ... 492

S3Object ... 493

SimulationApplicationConfig ... 494

SimulationApplicationSummary ... 496

SimulationJob ... 498

SimulationJobBatchSummary ... 502

SimulationJobRequest ... 504

SimulationJobSummary ... 507

SimulationSoftwareSuite ... 509

Source ... 510

SourceConfig ... 511

TemplateLocation ... 512

TemplateSummary ... 513

Tool ... 515

UploadConfiguration ... 517

VPCConfig ... 519

VPCConfigResponse ... 520

WorldConfig ... 522

WorldCount ... 523

WorldExportJobSummary ... 524

WorldFailure ... 526

WorldGenerationJobSummary ... 528

WorldSummary ... 530

Common Errors ... 531

Common Parameters ... 532

Limits and Supported Regions ... 535

Document History ... 536

AWS glossary ... 537

(9)

What Is AWS RoboMaker?

AWS RoboMaker is a robotics simulation service that extends the Robot Operating System (ROS) with cloud services. This enables robotics developers to cost-effectively scale and automate simulation workloads, run large-scale and parallel simulations with a single API call, and create user-defined, randomized 3D virtual environments. Using the simulation service, you can speed application testing and create hundreds of new worlds from templates you define.

AWS RoboMaker is capable of automated testing within a continuous integration and continuous delivery (CI/CD) pipeline, training reinforcement models with high volumes of iterative trials, and connecting multiple concurrent simulations to your fleet management software for testing. When combined with AWS machine learning, monitoring, and analytics services, robots can stream data, navigate, communicate, comprehend, and learn.

Are You a First-time User of AWS RoboMaker?

If you are a first-time user of AWS RoboMaker, do the following.

1.Read How It Works (p. 5) – An overview of AWS RoboMaker. Learn the key concepts and components involved in building robot applications and simulations. Read this topic in the order presented.

2.Read Getting Started with AWS RoboMaker (p. 8) – A tutorial to help you build your first robot application and simulation. Explains how to run a simulation job. Use the sample code provided by AWS RoboMaker.

3.Read Getting Started with Simulation WorldForge (p. 13) – A tutorial to help you create a simulation world template and generate worlds to use in your simulation.

4. Depending on your needs, explore the following topics.

• Learn about the Robot Operating System (ROS). In AWS RoboMaker, you build applications and simulations based on ROS. For more information, see http://wiki.ros.org/ROS/Tutorials.

• Learn about Gazebo, a simulator to test robots. Gazebo helps you test algorithms. It helps you design robots and train artificial intelligence. For more information, see http://gazebosim.org/

tutorials. Select version 9.

Supported Software and Versions

AWS RoboMaker supports the following programs, tools, and libraries.

Name Versions Supported Description

Robot Operating System (ROS) Melodic (end of life May 2023) Libraries and tools to help you create robot applications.

Robot Operating System 2 (ROS

2) Foxy Released June 5, 2020.

Colcon Latest Command line tool to bundle

ROS robot and simulation applications.

(10)

Name Versions Supported Description

Gazebo 9, 11 Tool to simulate robots in an

environment.

rviz ROS rviz

ROS2 rviz2

Tool to visualize sensor data and state information from ROS in 3D.

rqt latest Framework and plugins based

on Qt for ROS GUI development.

ROS supports the Python and Ubuntu versions listed below.

Name Version(s) Supported Ubuntu Version(s) Supported

ROS Melodic Python 2 Ubuntu Bionic

ROS2 Foxy Python 3 Ubuntu Focal

The following table shows which ROS versions are supported for different AWS RoboMaker features.

AWS RoboMaker Feature ROS version(s) Supported

Cloud Extensions Melodic

Development Environment (Create) Melodic, Foxy

Simulation Job Melodic, Foxy

Fleet Management Melodic, Foxy

AWS RoboMaker simulation jobs support the combinations of ROS distribution and Gazebo listed here.

• Melodic and Gazebo 9

• Foxy and Gazebo 11

Gazebo supports the following components:

Component Version(s) Supported

Physics engine ODE

Rendering engine OGRE

Software Support Policy

Support Changes: March 15th, 2022

Starting March 15th 2022, we are making two changes to AWS RoboMaker simulation which may affect your simulation jobs.

(11)

1. We are migrating AWS RoboMaker simulation jobs to container images. You must migrate your robot and simulation applications to a supported container image. For more information, see Migrating ROS Applications to Containers (p. 31).

2. We will stop vending preinstalled Robot Operating Software (ROS), Gazebo, and Ubuntu base images in AWS RoboMaker Simulation. You can continue to run ROS and Gazebo based simulations, but the mechanism for doing so has changed. You must update to the General software suite for your robot applications and Simulation runtime software suite for your simulation applications. For more information, see Migrating ROS Applications to Containers (p. 31).

Why are we making this change?

AWS RoboMaker now supports expanded configuration for any robot and simulation software, enabling you to use and configure any robot and simulation software of your choice while running simulations.

You can still use ROS in your robot applications, including older versions such as ROS Kinetic or newer versions such as ROS2 Galactic, but keep in mind that you can run custom robot applications without using ROS. Additionally, you can now use the simulation software of your choice while running simulations in AWS RoboMaker.

What happens now?

Existing robot and simulation applications which have not been migrated will be restricted from usage, but can be migrated to the supported software suites and container images. Any simulation jobs and simulation job batches launched prior to March 15th, 2022, and whose duration extends past March 15th, 2022, will continue to run until completed.

Customer actions

We recommend planning your migration as soon as possible. To learn more about migrating your software suites and using container images to develop your AWS RoboMaker applications, see Migrating ROS Applications to Containers (p. 31).

Support ended April 2021

Starting April 30, 2021, you will no longer be able to create new ROS Kinetic, Gazebo 7.1, ROS Dashing or Ubuntu 16.04 resources in AWS RoboMaker. However, any existing AWS RoboMaker resources will remain in your account. If you do not upgrade, functionality of your ROS Kinetic, Gazebo 7.1, ROS Dashing and Ubuntu 16.04 resources within AWS RoboMaker features will change or even break.

The following software suite combinations will be deprecated:

• ROS Kinetic, Gazebo 7.1, Ubuntu 16.04

• ROS Kinetic, Gazebo 9, Ubuntu 16.04

• ROS Dashing, Gazebo 9, Ubuntu 16.04

The deprecation affected the following areas:

AWS Cloud9 integrated development environments (IDEs)

• You will have access to all existing ROS Kinetic and ROS Dashing based IDEs. You can continue to work within the IDE. The successful execution of the build and bundle process is not guaranteed.

• You will be unable to create new ROS Kinetic and ROS Dashing based IDEs.

Robot and simulation applications

• You will be unable to create new ROS Kinetic and ROS Dashing based robot applications.

• You will be unable to create new simulation applications with ROS Kinetic with Gazebo 7.1, ROS Kinetic with Gazebo 9, or ROS Dashing with Gazebo 9.

(12)

• You will be unable to create a new versions of existing robot or simulation applications using the deprecated ROS and Gazebo versions.

Simulation jobs and simulation batches

• You will not be able to create new simulation jobs with robot applications and simulation applications using Kinetic, Dashing or Gazebo 7.1.

Simulation jobs launched prior to the deprecation date and whose duration extends past the deprecation date will continue to run successfully until completed. With a maximum simulation job duration of 14 days, these jobs can run for a maximum of 14 days post deprecation.

Deployment jobs

• You will be not be able to create a deployment job for Kinetic or Dashing based robot applications.

Sample applications and cloud extensions

• The cloud extensions will no longer be supported in ROS Kinetic and ROS Dashing based applications. While you can install the cloud extensions into ROS Kinetic and ROS Dashing workspaces, they may or may not work.

• You can no longer select ROS Kinetic or ROS Dashing as the ROS distribution to launch a sample application. The sample applications may still be downloaded into existing ROS Kinetic and ROS Dashing IDEs, however, they are no longer supported and may break.

(13)

How It Works

AWS RoboMaker is a service that allows you to quickly develop and test robot applications. This section provides an overview of robot development. It explains how AWS RoboMaker works. If you are a first- time user of AWS RoboMaker, read the following sections in order.

Topics

• Robotics Development with AWS RoboMaker (p. 5)

• Create a ROS Development Environment (p. 5)

• Create a Robot Application (p. 6)

• Develop Simulation and Testing Data (p. 6)

Robotics Development with AWS RoboMaker

This section shows a typical robot development workflow. It tells how you accomplish the tasks with AWS RoboMaker.

Robot application development usually starts after you choose your physical robot hardware. First, you create a development environment and load the tools to build an application. Next, create the robot application. Write custom logic that responds to environmental data. Next, build simulations, or models of the world that your robot will inhabit. Collect data about how your robot performs in simulation jobs.

When your tests are complete, deploy your application to physical robots. Monitor them and update the software when needed.

As a robot developer, you typically perform the following activities.

1. Create a ROS development environment. To create a robot application, you need an environment configured for ROS development along with tools like Colcon to build and bundle the application.

You'll also need tools to help you cross-compile the application for your physical robot. Using an integrated development environment makes it easier.

In AWS RoboMaker, you can create an AWS Cloud9 development environment that is already configured with the tools to develop robot applications. You can also use your existing environment.

2. Create the robot application. This is where you get to write code. Build on the foundation provided by ROS and integrate functions you find elsewhere. The application you create works with your robot hardware, provides intelligence, and works with the cloud.

3. Develop simulation and testing data. In this stage, run your robot application in simulated

environments. Collect sensor data and other performance data from the simulation. It can take many simulation tests to complete the robot programming.

4. Deploy an application to robot fleets. When your application performs as expected, you are ready to deploy it to a robot. In AWS RoboMaker, a robot must belong to a group of robots (a fleet) in order to receive deployed software. Each virtual robot in AWS RoboMaker represents a physical robot.

5. Monitor and update robots. Your robots are interacting in the world!

The following sections explore the details of each step.

Create a ROS Development Environment

Before you create a robot application, you need a properly configured development environment. Robot development with AWS RoboMaker depends on a number of open source packages.

(14)

Package Version Description Robot Operating

System (ROS) Melodic Libraries and tools to

help developers create robot applications.

Robot Operating

System 2 (ROS2) Foxy A newer version of ROS.

Colcon Latest A command line tool

for bundling ROS robot and simulation applications.

Gazebo 9

11

Tool for simulating robots in complex environments.

rviz Melodic

Foxy

Tool for visualizing sensor data and state information from ROS in 3D.

rqt Melodic

Foxy

Framework and plugins based on Qt for ROS GUI development.

You can create your own development environment or update an existing development environment to support AWS RoboMaker. Most developers use Ubuntu or other supported Linux variants. Other operating systems might be compatible.

AWS RoboMaker provides a quick and easy way to create a development environment that is already configured for robot development.

Create a Robot Application

After your development environment is configured, create a robot application. Build on the foundation ROS provides. ROS relies on a Computation Graph. It's a collection of concurrent processes (or nodes) that perform a task like controlling wheel motors or passing messages.

You do not have to create nodes for common robotic hardware and algorithms. There are packages, which are nodes and dependent message definitions, to work with motors, lasers, actuators, lidar, and sensors of all kinds. There are also packages that consume data from other packages to create maps, find paths, and more. For a more comprehensive list, see ros.org.

A robot application includes information about the robot software suite required by the application. The robot software suite specifies the name and the version of a supported ROS distribution. For example, ROS2 and Foxy.

Develop Simulation and Testing Data

Robot application developers use simulations to help refine behavior. They use simulations to test robotics algorithms and perform regression tests. Simulations use realistic scenarios and detailed virtual environments to model the world and mimic robot behavior.

(15)

In AWS RoboMaker, a simulation application contains models for the robot, terrain, and assets organized in a scene. The simulation application is responsible for simulating the physical aspects of a robot such as its sensors, kinematics, and dynamics. Sensors may include cameras, lidars, and even GPS devices.

Kinematics and dynamics are required to allow the robot to move its joints or wheels and interact physically, such as colliding, with objects in a simulated environment.

A simulation application includes information about the simulation software suite and robot software suite required by the simulation application. The simulation software suite specifies the name and the version of a supported simulation software suite. For example, you can specify Gazebo version 9 or RosbagPlay for Melodic.

You can generate hundreds of unique worlds from world templates using Simulation WorldForge. Each world template defines the parameters like room types and furnishing to use when generating worlds.

When your world template is complete, you generate worlds using a world generation job. You can use the worlds in your simulation job or export them to use in other applications.

To run a simulation, pair a robot application with a simulation application in a simulation job. The simulation job can run up to 14 days. You can restart it with a new application while it is running. If default tools are enabled, you can interact with a running simulation by using Gazebo, rviz, rqt, and a terminal to interact at the command line. For example, use Gazebo to see a rendered model of the robot in the environment and use the terminal to listen or send ROS messages to your robot.

When you create a simulation job, you specify a robot application configuration and a simulation application configuration. These specify launch configuration, tools, upload configurations, and for simulation applications, the world configuration. For example, you can configure custom tools to interact with the running simulation.

The robot is unaware that it is inside a simulated environment. The simulator uses the same interfaces and data types as the robot's physical devices. This makes it possible to test the same robot software in a simulation and then deploy it to your robots.

(16)

Getting Started with AWS RoboMaker

This section walks through running your first robotic application using AWS RoboMaker simulation and creating your first worlds with Simulation WorldForge. You use robotic applications and sample simulation world templates provided by AWS RoboMaker.

Topics

• Getting Started with AWS RoboMaker (p. 8)

• Getting Started with Simulation WorldForge (p. 13)

Getting Started with AWS RoboMaker

In this section, you learn the basics of how to structure your robot applications and simulation

applications. You also learn how to edit code, build, and run your applications. Hello world is an example robot application and simulation application you can use. Hello world is built for TurtleBot3. The robot rotates in place. The simulation is an empty world.

Build a robot application. A robot application is a robot operating system (ROS)-based application that runs on a physical robot. To run your application in an AWS RoboMaker simulation, you build an X86_64 architecture version of the robot application.

Build a simulation application. A simulation application includes a 3D artificial world and Gazebo plugins that control the movement of a robot within that world. An X86_64 architecture version of the simulation application is required.

Launch the robot and simulation application. Use ROS to launch the applications. Explore the running simulation using rqt, Gazebo and other tools.

Topics

• Important Licensing Information (p. 8)

• Step 1: Create an AWS Account and an Administrator (p. 9)

• Step 2: Configure Environment and Build Applications (p. 10)

• Step 3: Run Robot and Simulation Applications (p. 11)

• Step 4: Run a Simulation Job (p. 12)

• Step 5: Clean up (p. 13)

Important Licensing Information

AWS RoboMaker sample applications include third-party software licensed under open-source licenses.

The samples are provided for demonstration purposes only. Incorporation or use of AWS RoboMaker sample applications in connection with your production workloads or commercial products or devices may affect your legal rights or obligations under the applicable open-source license. Source file information is included in the readme file of each sample application.

• Hello World

• Navigation and Person Recognition

(17)

• Voice Commands

• Navigation

• Self-Driving using Reinforcement Learning

• Object Following using Reinforcement Learning

AWS RoboMaker development environment and simulation include third-party software licensed under open-source licenses. View the source file and licensing information here:

• Simulation Environment

• Development Environment

Step 1: Create an AWS Account and an Administrator

Before you use AWS RoboMaker for the first time, complete the following tasks:

Topics

• Create an AWS Account (p. 9)

• Create an IAM Administrator and Sign in (p. 9)

Create an AWS Account

If you already have an AWS account, skip this step.

When you sign up for Amazon Web Services (AWS), your AWS account is automatically signed up for all AWS services, including AWS RoboMaker. You are charged only for the services that you use.

To create an AWS account

1. Open https://portal.aws.amazon.com/billing/signup.

2. Follow the online instructions.

Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad.

Write down your AWS account ID because you'll need it for the next task.

Create an IAM Administrator and Sign in

When you create an AWS account, you get a single sign-in identity. This allows access to all of the AWS services and resources in the account. This identity is called the AWS account root user. When you sign in to the AWS Management Console with the credentials that you used to create the account, you have access to all of the AWS resources in your account.

We strongly recommend that you not use the root user for everyday tasks, even the administrative ones.

Instead, adhere to the Create Individual IAM Users. Create an AWS Identity and Access Management (IAM) user with administrator permissions. Then, securely store your root user credentials and use them to perform only a few account and service management tasks.

To create an IAM user with administrator permissions, and sign in to the console 1. Create an account with administrator permissions in your AWS account. For instructions, see

Creating Your First IAM User and Administrators Group in the IAM User Guide.

(18)

NoteWe assume that you use administrator-level credentials for the exercises and procedures in this guide. If you choose to create and use another IAM user, grant that user minimum permissions.

2. Sign in to the AWS Management Console.

To sign in to the AWS Management Console as a IAM user, you must use a special URL. For more information, see How Users Sign In to Your Account in the IAM User Guide.

For more information about IAM, see the following:

• AWS Identity and Access Management (IAM)

• Getting started

• IAM User Guide

Step 2: Configure Environment and Build Applications

In this section, you create an AWS Cloud9 environment with AWS RoboMaker. You then install sample code. In the development environment, you modify the robot application, and then build the robot and simulation application.

Topics

• Create a Development Environment (p. 10)

• Modify and Build Applications (p. 10)

Create a Development Environment

The AWS Cloud9 development environment provides the tools to develop robot applications and simulation applications with ROS and AWS RoboMaker.

To create a development environment:

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. On the left, expand Development, choose Development environments, and then choose Create development environment.

3. In the Create AWS RoboMaker development environment page, enter HelloWorld as the environment name.

4. For ROS Distribution, select ROS Melodic.

5. Accept the default Instance type (c4.xlarge). You can select different instances type to improve bundling performance.

6. Select a VPC. Use the default VPC.

7. Select a Subnet. Use a public Subnet.

8. Choose Create to create the AWS Cloud9 development environment.

Modify and Build Applications

In this section, you use the AWS Cloud9 development environment to modify the robot application.

The steps show how to rotate the robot counter-clockwise and then build the robot and the simulation

(19)

application. You then bundle the robot application and simulation application into source files. A source file includes all of the dependencies you need to run the application. You use a robot application source file and a simulation application source file to create a simulation job. You use a robot application source file to create a deployment.

To build the robot and simulation applications

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. On the left, expand Development, choose Development environments, select HelloWorld, and then choose Open environment. It might take a few minutes to prepare the development environment.

3. In the HelloWorld AWS Cloud9 development environment, on the Welcome page, choose Clone Hello world sample.

4. On the left, in the Environment tab, expand aws-robomaker-sample-application-helloworld, robot_ws. src, hello_world_robot, and then nodes. Select the file rotate.py to load into the editor.

5. In the rotate tab, modify the code to make the robot turn clockwise by making the rate negative:

self.twist.angular.z = -0.1. Save the file by selecting File and then Save.

6. Build the robot application. On the menu, choose Window, and then choose New Terminal. In the terminal window, use the following commands to build the application:

$ sudo apt update

$ sudo apt install python3-vcstool -y

$ cd aws-robomaker-sample-application-helloworld/robot_ws/

$ vcs import < .rosinstall

$ rosdep install --from-paths src --ignore-src -r -y

$ colcon build

NoteNote: When using the “sudo apt update” command, if you receive a GPG error follow these instructions: ROS GPG Key Error (p. 230).

7. Build the simulation application. In the terminal window, change to the simulation application workspace and then use colcon to build the application:

$ cd ../simulation_ws

$ vcs import < .rosinstall

$ rosdep install --from-paths src --ignore-src -r -y

$ colcon build

Step 3: Run Robot and Simulation Applications

In this section, you run the Hello World application in the AWS Cloud9 environment.

Topics

• Launch Applications (p. 11)

• View and Explore a Simulation (p. 12)

Launch Applications

Launch the Hello World application in the AWS Cloud9 environment.

1. In the menu, navigate to Virtual Desktop and select Launch Virtual Desktop. It may take a few moments to launch in a new browser tab.

(20)

2. Navigate back to the HelloWorld AWS Cloud9 development environment, and in the terminal change directories to the robot_ws folder.

3. Launch the robot application:

$ cd ../robot_ws

$ source install/setup.bash

$ roslaunch hello_world_robot rotate.launch

After the robot application launches, you will see the following information continuously updated in the terminal:

[INFO] [1616095476.465313, 1350.786000]: Rotating robot: linear:

x: 0.0 y: 0.0 z: 0.0 angular:

x: 0.0 y: 0.0 z: -0.1

4. Open a terminal in the simulation_ws folder.

5. Launch the simulation application:

$ cd aws-robomaker-sample-application-helloworld/simulation_ws

$ source install/local_setup.bash

$ export DISPLAY=:0

$ roslaunch hello_world_simulation empty_world.launch gui:=true

NoteWhen you specify gui:=true, roslaunch launches the Gazebo server (gzserver) and Gazebo client (gzclient). You should specify gui:=false when running an AWS RoboMaker simulation job. You can start and configure Gazebo and other simulation tools when you create a simulation job. For more information, see Simulation Tools (p. 181). You can stop zombie Gazebo processs by using killall gzserver in any terminal.

View and Explore a Simulation

When the simulation is running, you can use the virtual desktop to launch Gazebo and verify that the robot is rotating counter-clockwise.

1. In the HelloWorld AWS Cloud9 development environment, navigate to the previously opened Virtual Desktop.

2. In the Virtual Desktop, in the Gazebo application, zoom in on the robot. It is rotating in place.

Step 4: Run a Simulation Job

Once you have a working simulation you can bundle it, upload to Amazon S3, and create a simulation job in AWS RoboMaker. An AWS RoboMaker simulation job is a pairing of a robot application and a simulation application running in the cloud. While the simulation job is running, you can interact with it using simulation tools like Gazebo, rviz, rqt and a terminal to visualize sensor data or control components of the robot.

(21)

NoteBefore running a simulation job in AWS RoboMaker simulation, check the gui argument in the launch file. The launch file starts the Gazebo server, and setting gui:=true will also launch the Gazebo client that is used for viewing the simulation on the Ubuntu desktop. However, when running an AWS RoboMaker simulation job, the Gazebo server and client are started separately and you should ensure that your launch files do not set the gui argument to true. You can start and configure the Gazebo client in the AWS RoboMaker simulation service using the simulation tool configuration.

Step 5: Clean up

1. Once you have finished using the development environment, select the robot symbol from the menu and then open the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/. 2. You can either leave it for use another time OR you can delete it by choosing Development

environments from the RoboMaker menu, choosing your environment from the list (e.g.: Helloworld), and then selecting Delete.

Getting Started with Simulation WorldForge

In this section, you learn Simulation WorldForge concepts and how to create a simulation world template describing the parameters of your world including floor plan, rooms, and furnishings. You also learn how to use a world generation job to generate worlds and then use them in a simulation application.

Topics

• Step 1: Complete the Prerequisites (p. 13)

• Step 2: Create a Simulation World Template (p. 14)

• Step 3: Generate a Simulation World from the Simulation World Template (p. 14)

• Step 4: Use the Generated World in the Hello World Simulation (p. 15)

• Step 5: Clean Up Resources (p. 15)

Step 1: Complete the Prerequisites

Complete the following setup steps before starting the walkthrough. Setup includes signing up for an AWS account, configuring a user, and then running the Hello World sample application. You use the Hello World robot application and simulation application with the worlds you create in this walkthrough.

If you are already using AWS RoboMaker and have a robotic application that meets the criteria described in Using generated worlds in your simulation (p. 71), you can skip this step.

To complete the prerequisites

1. Follow the instructions in Step 1: Create an AWS Account and an Administrator (p. 9).

2. Run the Hello World sample application as described in Run the Hello World Sample Application (p. 13).

Run the Hello World Sample Application

Before you begin working with a robot application and simulation application code, run the Hello World demo application in the AWS RoboMaker console. This sets up the AWS resources the application needs, including the appropriate IAM roles and Amazon S3 bucket for loading applications and writing simulation output.

(22)

To run the Hello World demo application

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. In the AWS RoboMaker console, expand Resources on the left and then select Sample applications.

3. In the Try AWS RoboMaker sample applications page, select Hello World! and then select Launch.

This opens the simulation job detail page while AWS RoboMaker launches the sample simulation.

The sample application will use ROS Melodic and Gazebo 9 by default.

4. On the simulation job detail page, when status becomes running, select Gazebo.

5. In the AWS RoboMaker gzclient window, use the mouse or keyboard to zoom in on the TurtleBot.

For more information, see Gazebo Keyboard Shortcuts.

It is spinning clockwise. Gazebo is fully functional, so you can try out other features. For example, if you want more light on the robot, choose the sun (point light) icon. Then move the pointer around the robot to illuminate it.

6. When you are done, close Gazebo by closing the browser window.

The Hello World simulation runs for 1 hour. In later steps, you have an opportunity to restart the simulation. If you do, the simulation job timer is reset to zero and the simulation job will run another 1 hour.

Step 2: Create a Simulation World Template

In this section, you create a simulation world template. A simulation world template contains parameters that Simulation WorldForge uses to generate random worlds. Simulation WorldForge provides sample templates to help you get started.

To create a simulation world template

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. On the AWS RoboMaker console, expand Simulation WorldForge on the left and then choose World templates.

3. On the World templates page, choose Create template.

4. On the Create a world template page, under Sample templates, choose Browse and select.

5. On the Templates page, under Small house, choose Start.

6. On the Template detail page, choose Save and exit to save the simulation world template. You will use it in the next section to generate a simulation world.

Step 3: Generate a Simulation World from the Simulation World Template

In this section, you create a world generation job using the simulation world template you created. A world generation job generates the worlds using the specified template parameters. When you create the generation job, you specify the number of floor plans and interior variations per floor plan in the worlds.

To create a simulation world from a simulation world template

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. On the AWS RoboMaker console, expand Simulation WorldForge on the left and then choose World templates.

(23)

3. On the World templates page, choose the sample template you created, and then choose Generate worlds.

4. On the Generate worlds page, specify 1 for Number of floor plans and Interior variations per floor plan. Simulation WorldForge generates 1 world, or the number of floor plans * interior variations per floor plan. You can generate up to 50 worlds.

5. Choose Generate to begin world generation.

6. On the World generation job details page, you can track world generation progress. Generated worlds appear under Completed worlds.

Step 4: Use the Generated World in the Hello World Simulation

In this section, you create a simulation job that runs the Hello World application with the new world you generated.

To use the generated world in the Hello World simulation

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/.

2. On the AWS RoboMaker console, expand Simulations on the left and then choose Simulation jobs.

3. On the Simulation jobs page, choose the Hello World simulation job. It is the simulation job with a robot application named AWSRoboMakerHelloWorld.

4. On the Simulation jobs detail page, choose Actions and then choose Clone.

5. On the Review and create simulation job page, next to Step 3: Specify simulation application, choose Edit.

6. On the Specify simulation application page, change Launch file to worldforge_world.launch.

7. On the Specify simulation application page, expand Import world from WorldForge, and then choose Browse worlds.

8. On the Choose worlds page, under World, choose the world you previously created, and then choose Choose world.

9. On the Specify simulation application page, choose Next.

10. On the Review and create simulation job page, choose Create.

11. You can explore the simulation using simulation tools. For more information about simulation tools, see Simulation Tools (p. 181). For other ways to explore the simulation, see View and Explore a Simulation (p. 12).

Step 5: Clean Up Resources

To avoid extra charges, clean up the example by following the steps in Step 5: Clean up (p. 13).

(24)

Sample Applications

AWS RoboMaker comes with sample programs you can launch in the AWS RoboMaker console. You can also download and build them on your own. Each sample has a repo on GitHub. The readme file describes the sample and how to build it. The readme tells how it can be run on your desktop and in AWS RoboMaker.

Hello world — Learn the basics of how to create your robot applications and simulation applications.

Start from a basic project template including a robot in an empty world.

Navigation — Navigate a robot to designated locations in a simulated bookstore world. Learn how to procedurally generate an occupancy map for any Gazebo world using a map generation plugin.

In this section, you learn how to launch a sample application in the AWS RoboMaker console. You will also how to configure permissions if you want to provide your own IAM role when launching a sample application.

Topics

• Launching a Sample Application (p. 16)

• Configuring Permissions (p. 17)

Launching a Sample Application

The AWS RoboMaker console makes it easy to launch a pre-built AWS RoboMaker sample application.

You can launch an application using default settings and let AWS RoboMaker manage permissions. You can also choose a different Gazebo version and use a custom IAM role.

To launch a sample application

Follow the steps under one of the following tabs.

1. Sign in to the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/. 2. In the left pane, choose Resources, and then choose Sample applications.

3. Select one of the sample applications.

4. Optional: Select Additional settings to view additional configuration options.

5. Optional: Select a ROS distribution. ROS Melodic is the latest version. It works with Gazebo 9. For more information about the Robot Operating System (ROS), see www.ros.org.

6. Optional: Select a Simulation software suite. Each sample application is built for Gazebo 9 and 11.

7. Optional: Select an IAM role. This role will be used by AWS RoboMaker to create the sample application environment and launch it. It will also be used by the sample application to access resources like Amazon Rekognition.

NoteIf you are a student or educator accessing AWS RoboMaker through the AWS Educate portal, select the robomaker_students IAM role.

For more information about the permissions required by the sample applications, see ??? (p. 17)

(25)

Configuring Permissions

When you launch a sample program in the AWS RoboMaker console, you can provide an IAM role to use.

This section describes what you need to launch the samples.

For more information about AWS Identity and Access Management roles, see Creating a Role to Delegate Permissions to an AWS Service.

Minimum permissions

To launch a sample application, you need a role that has:

• A trust relationship with robomaker.amazonaws.com.

• A trust relationship with lambda.amazonaws.com.

• Sample application permissions.

Use the following permissions to launch Hello world and Robot monitoring.

Replace account# with your account number. Replace simulation-job-role-id with the IAM role ID. For more information, see iamRole under CreateSimulationJob (p. 286).

{

"Version": "2012-10-17", "Statement": [

{

"Action": [

"s3:ListBucket", "s3:GetObject", "s3:PutObject"

],

"Resource": [ "*"

],

"Effect": "Allow"

}, {

"Action": [

"iam:PassRole"

],

"Resource": "arn:aws:iam::account#:role/simulation-job-role-id", "Effect": "Allow"

}, {

"Action": [ "robomaker:*"

],

"Resource": "*", "Effect": "Allow"

}, {

"Action": [

"ec2:AssociateRouteTable", "ec2:AttachInternetGateway", "ec2:CreateInternetGateway", "ec2:CreateSubnet",

"ec2:CreateVpc", "ec2:CreateTags", "ec2:CreateRoute", "ec2:CreateRouteTable",

(26)

"ec2:CreateSecurityGroup", "ec2:DeleteSubnet",

"ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs"

],

"Resource": "*", "Effect": "Allow"

}, {

"Action": [

"logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"

],

"Resource": [

"arn:aws:logs:us-west-2:account#:log-group:/aws/lambda/*:*"

],

"Effect": "Allow"

}, {

"Condition": { "StringEquals": {

"iam:AWSServiceName": [ "robomaker.amazonaws.com"

] } },

"Action": "iam:CreateServiceLinkedRole", "Resource": "*",

"Effect": "Allow"

}, {

"Action": [

"cloudformation:DescribeStacks"

],

"Resource": "arn:aws:cloudformation:*:account#:stack/*", "Effect": "Allow"

} ] }

(27)

Application Versioning

AWS RoboMaker supports creating more than one version of your robot applications and simulation applications. This helps you control which code your robots and simulations use. A version is a numbered snapshot of the $LATEST version of your application. You can create a version to use in different parts of your development workflow. For example, development, beta deployment, or production.

When you version an AWS RoboMaker robot application or simulation application you create a snapshot of the application.

If you're using colcon to build and bundle your applications, AWS RoboMaker remembers the Amazon S3 path and ETag of the file for each version. You can use the version of the application as it existed when the version was made provided it still exists in the Amazon S3 path and has not been altered (its ETag is unchanged).

If you're using container images for your applications, you upload your images to Amazon ECR. Amazon ECR uses image digests to indicate the version of your application. AWS RoboMaker remembers the image digest for each version.

If you have the image uploaded to Amazon ECR and you haven't altered the image digest, you can access and use that version of your application.

You can create a maximum of 40 versions per application.

Topics

• Application Versioning With Bundles (p. 19)

• Application Versioning With Images (p. 19)

• The $LATEST Version (p. 20)

• Updating an Application Version (p. 20)

• Deleting an Application Version (p. 20)

• Application Versioning for Bundles (p. 21)

Application Versioning With Bundles

You can update the $LATEST version as you develop your application. When you select the $LATEST version, you get it from the Amazon S3 location that you specify.

For example, you can start a simulation job using the latest version of your robot application and simulation application. If make changes to the robot application at the Amazon S3 path [what does at the S3 path mean?] and restart the simulation job, you use the updated version of the robot application.

You can only make updates to the $LATEST version of an AWS RoboMaker application. When you update the application to the $LATEST version, AWS RoboMaker uses that version. For example, if you restart a simulation job, AWS RoboMaker uses the latest version of the applications that you use in the simulation job.

Application Versioning With Images

You can update the $LATEST version of your container image as you develop your application. When you select the $LATEST version, get it from the Amazon ECR location that you specify.

When you create an image, you can also apply tags to them. You can specify the value of the tag field as

"latest" for the $LATEST version. These values are distinct from each other.

(28)

There are two ways that an image gets the "latest" tag:

• If you specified a tag with the value of "latest".

• If you're pushing an image that doesn't have tags, Amazon ECR updates the image with the "latest"

tag.

In AWS RoboMaker, when you specify a tag for an image, that image is always picked as the $LATEST version. For example, if you create a robot application with the image name "myImage", the tag "xyz", and the image digest "123", the $LATEST version is myImage:xyz with the digest "123".

The following are the scenarios when you want to add a tag:

• When you want to update the $LATEST version to use a new tag. For example, you can have the image

"myImage". You can update your image with the tag "abc". The $LATEST version of the image points to myImage:abc.

• When you want to update the image and retag it. For example, you can make changes to an image that has the tag "abc". You can use the tag "xyz" after you update it. The $LATEST version points to myImage:xyz.

The $LATEST Version

When you create a version, AWS RoboMaker takes a snapshot of the $LATEST version and increments the version number by 1. AWS RoboMaker remembers the Amazon S3 path and ETag of the file. The path is used to retrieve the file. The ETag is used to confirm it has not changed. Version numbers are never reused. For example, if your latest version is 10 and you remove it and then create a new version, the new version will be version 11.

You can update the $LATEST version as you develop your application. When you select the $LATEST version, it will be retrieved from the Amazon S3 location you specify. For example, if you start a simulation job using the latest version of your robot application and simulation application, then make changes to the robot application at the Amazon S3 path, and then restart the simulation job, the updated robot application will be used.

When you deploy a robot application, you must select a specific numbered version to deploy. For more information on how to create a robot application version, see Creating a Robot Application Version (p. 78).

For more information how to create a simulation application version, see Creating a Simulation Application Version (p. 83). For more information about ETags, see Common Response Headers.

Updating an Application Version

You can update only the $LATEST version of an AWS RoboMaker application . When you do this, it is available to use in AWS RoboMaker. For example, if you restart a simulation job, the latest version of the applications will be used in the simulation.

For more information, see Updating a Robot Application (p. 79) and Updating a Simulation Application (p. 84).

Deleting an Application Version

When you no longer need an application version, delete it. For more information, see Deleting a Robot Application Version (p. 80) and Deleting a Simulation Application Version (p. 86).

(29)

Application Versioning for Bundles

(30)

Developing Applications

This section helps you get set up to develop with the Robot Operating System (ROS). You learn how to create robot applications and simulation applications with the configured AWS Cloud9 development environment. You learn about how to extend your robot application with AWS RoboMaker cloud extensions.

It also describes how to create and manage AWS RoboMaker robot applications and AWS RoboMaker simulation applications.

Topics

• Creating a New Robotic Application (p. 22)

• Building and Bundling Robotic Applications with Colcon (p. 30)

• Using Images to Develop Your AWS RoboMaker Applications (p. 31)

• Using Amazon S3 Prefix and Archive Data Sources for Your Assets (p. 66)

• Creating a Simulation Job (p. 68)

• Using generated worlds in your simulation (p. 71)

• Developing with AWS Cloud9 (p. 73)

Creating a New Robotic Application

This section describes how to create a robotic application. It uses a directory structure that separates the robot application and the simulation application. This makes it easier to use in AWS RoboMaker simulations and other stages of robotics development.

Robotics applications usually include both a robot application and a simulation application. A robot application is deployed to the physical robot. Simulation applications are used to model aspects of the physical world. Using an AWS RoboMaker simulation job, robot applications can run inside of simulation applications and data can be collected and visualized.

AWS RoboMaker robotics applications usually have the following directory structure and files:

MyApplication

### robot_ws # workspace for the robot system

# ### src

# ### robot_app # ROS package for the robot application

# ### CMakeLists.txt # build config

# ### launch

# # ### rotate.launch # robot entrypoint, specifies running system

# ### package.xml # ROS package config

# ### scripts

# # ### rotate.py # custom ROS node, loaded at launch

# ### setup.py # allow ROS to find your python code

# ### src

# ### robot_app

# ### __init__.py # python module for any .py code

### simulation_ws # workspace for the simulation ### src

### simulation_app # ROS package for the simulation application ### CMakeLists.txt # build config

### launch

# ### example.launch # simulation entrypoint, specifies world, etc # ### spawn_turtlebot.launch # launch file for spawning the simulated robot

(31)

### package.xml # ROS package config ### worlds

### example.world # world description

Topics

• Prerequisites (p. 23)

• Create the Robot Application Workspace (p. 23)

• Create the Simulation Application Workspace (p. 26)

• Build the Robot and Simulation Application Bundles (p. 29)

Prerequisites

You need to have a development environment configured for robotics development using AWS RoboMaker. Your development environment must have the following:

• Robot Operating System (ROS) Melodic or ROS2.

• Colcon

To create a preconfigured robotics development environment in AWS Cloud9, see Creating a Development Environment (p. 74).

Create the Robot Application Workspace

The robot application workspace contains custom ROS nodes and other assets needed by your robot application.

To create the robot application workspace 1. Open the command prompt.

2. Create the project directory, then move to the new directory.

$ mkdir MyApplication

$ cd MyApplication

3. Create directories for ROS launch files, ROS nodes, deployment scripts, and source folders.

$ mkdir -p robot_ws/src/robot_app

$ cd robot_ws/src/robot_app

$ mkdir -p launch scripts src/robot_app

4. Create an empty __init__.py file for using Python with ROS.

$ touch src/robot_app/__init__.py

5. Copy the following Python script into a file named rotate.py and then save it to the scripts directory. This sample node periodically rotates the robot. Your application will likely have more than one node and more sophisticated code.

#!/usr/bin/env python import rospy

from geometry_msgs.msg import Twist class Rotator():

(32)

def __init__(self):

self._cmd_pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1) def rotate_forever(self):

self.twist = Twist() r = rospy.Rate(10)

while not rospy.is_shutdown():

self.twist.angular.z = 0.1 self._cmd_pub.publish(self.twist)

rospy.loginfo("Rotating robot: %s", self.twist) r.sleep()

def main():

rospy.init_node('rotate') try:

rotator = Rotator() rotator.rotate_forever() except rospy.ROSInterruptException:

pass

if __name__ == '__main__':

main()

6. Make the Python script executable so it can be found by roslaunch. roslaunch is used to start the nodes in your application.

$ chmod +x scripts/rotate.py

7. Copy the following XML into a file named rotate.launch and then save it to the launch directory. The launch file is configured to start the rotate node.

<launch>

<!--

Using simulation time means nodes initialized after this will not use the system clock for its ROS clock and instead wait for simulation ticks.

See http://wiki.ros.org/Clock

Note: set to false for deploying to a real robot.

-->

<arg name="use_sim_time" default="true"/>

<param name="use_sim_time" value="$(arg use_sim_time)"/>

<!-- Rotate the robot on launch -->

<node pkg="robot_app" type="rotate.py" name="rotate" output="screen"/>

</launch>

8. Copy the following into a file named CMakeLists.txt and save it to the robot_app directory. For more information on creating make files for ROS, see CMakeLists.txt.

################################################################################

# Set minimum required version of cmake, project name and compile options

################################################################################

cmake_minimum_required(VERSION 2.8.3)

# Mention your package name project(robot_app)

################################################################################

# Find catkin packages and libraries for catkin and system dependencies

(33)

################################################################################

find_package(catkin REQUIRED COMPONENTS rospy

std_msgs )

################################################################################

# Setup for python modules and scripts

################################################################################

catkin_python_setup()

################################################################################

# Declare ROS messages, services and actions

################################################################################

################################################################################

# Declare ROS dynamic reconfigure parameters

################################################################################

################################################################################

# Declare catkin specific configuration to be passed to dependent projects

################################################################################

catkin_package(

CATKIN_DEPENDS rospy std_msgs )

################################################################################

# Build

################################################################################

include_directories(

include

${catkin_INCLUDE_DIRS}

)

################################################################################

# Install

################################################################################

# Add your custom nodes here.

catkin_install_python(PROGRAMS scripts/rotate.py

DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}

)

install(DIRECTORY launch

DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}

)

################################################################################

# Test

################################################################################

9. Copy the following XML into a file named package.xml and then save it to the robot_app directory. It includes all robot application dependencies.

<?xml version="1.0"?>

<package format="2">

<name>robot_app</name>

<version>1.0.0</version>

<description>

A custom AWS RoboMaker robot package with a rotating Turtlebot3 </description>

<license>MIT</license>

<author email="[email protected]">AWS RoboMaker</author>

參考文獻

相關文件

Once you get down to a purely business level, your influence is gone and the true light of your life isdimmed. You must work in the missionary spirit, with a breadth of charity

Interface positions at different instants: experimental (left) and numerical results computed without (Simulation 1, middle) and with (Simulation 2, right)

Your problem may be modest, but if it challenges your curiosity and brings into play your inventive faculties, and if you solve it by your own means, you may experience the tension

You may spend more time chatting online than talking face-to-face with your friends or family.. So, are you a heavy

Unless prior permission in writing is given by the Commissioner of Police, you may not use the materials other than for your personal learning and in the course of your official

Unless prior permission in writing is given by the Commissioner of Police, you may not use the materials other than for your personal learning and in the course of your official

Unless prior permission in writing is given by the Commissioner of Police, you may not use the materials other than for your personal learning and in the course of your official

• Uses a nested structure to accumulate path data as the simulation is running. • Uses a multiple branch structure to choose the