AWS RoboMaker 使用範例 AWS CLI - AWS Command Line Interface

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS RoboMaker 使用範例 AWS CLI

下列程式碼範例說明如何使用 AWS Command Line Interface 與來執行動作及實作常見案例 AWS RoboMaker。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數,但您可以在其相關情境和跨服務範例中查看內容中的動作。

Scenarios (案例) 是向您展示如何呼叫相同服務中的多個函數來完成特定任務的程式碼範例。

每個範例都包含一個連結 GitHub,您可以在其中找到如何在內容中設定和執行程式碼的指示。

主題

動作

下列程式碼範例會示範如何使用batch-describe-simulation-job

AWS CLI

若要批次描述模擬工作

下列batch-describe-simulation-job範例會擷取三個指定模擬工作的詳細資料。

命令:

aws robomaker batch-describe-simulation-job \ --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-p0cpdrrwng2n arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-g8h6tglmblgw

輸出:

{ "jobs": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x", "status": "Completed", "lastUpdatedAt": 1548959178.0, "failureBehavior": "Continue", "clientRequestToken": "6020408e-b05c-4310-9f13-4ed71c5221ed", "outputLocation": { "s3Bucket": "awsrobomakerobjecttracker-111111111-bundlesbucket-2lk584kiq1oa", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/AWSRoboMakerObjectTracker-154895-SimulationJobRole-14D5ASA7PQE3A", "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq/1548959170096", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "object_tracker_simulation", "launchFile": "local_training.launch", "environmentVariables": { "MARKOV_PRESET_FILE": "object_tracker.py", "MODEL_S3_BUCKET": "awsrobomakerobjecttracker-111111111-bundlesbucket-2lk584kiq1oa", "MODEL_S3_PREFIX": "model-store", "ROS_AWS_REGION": "us-west-2" } } } ], "tags": {}, "vpcConfig": { "subnets": [ "subnet-716dd52a", "subnet-43c22325", "subnet-3f526976" ], "securityGroups": [ "sg-3fb40545" ], "vpcId": "vpc-99895eff", "assignPublicIp": true } }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-p0cpdrrwng2n", "status": "Completed", "lastUpdatedAt": 1548168817.0, "failureBehavior": "Continue", "clientRequestToken": "e4a23e75-f9a7-411d-835f-21881c82c58b", "outputLocation": { "s3Bucket": "awsrobomakercloudwatch-111111111111-bundlesbucket-14e5s9jvwtmv7", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/AWSRoboMakerCloudWatch-154766341-SimulationJobRole-G0OBWTQ8YBG6", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AWSRoboMakerCloudWatch-1547663411642_NZbpqEJ3T/1547663517377", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "cloudwatch_robot", "launchFile": "await_commands.launch", "environmentVariables": { "LAUNCH_ID": "1548168752173", "ROS_AWS_REGION": "us-west-2" } } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6/1547663521470", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "cloudwatch_simulation", "launchFile": "bookstore_turtlebot_navigation.launch", "environmentVariables": { "LAUNCH_ID": "1548168752173", "ROS_AWS_REGION": "us-west-2", "TURTLEBOT3_MODEL": "waffle_pi" } } } ], "tags": {}, "vpcConfig": { "subnets": [ "subnet-716dd52a", "subnet-43c22325", "subnet-3f526976" ], "securityGroups": [ "sg-3fb40545" ], "vpcId": "vpc-99895eff", "assignPublicIp": true } }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-g8h6tglmblgw", "status": "Canceled", "lastUpdatedAt": 1546543442.0, "failureBehavior": "Fail", "clientRequestToken": "d796bbb4-2a2c-1abc-f2a9-0d9e547d853f", "outputLocation": { "s3Bucket": "sample-bucket", "s3Prefix": "SimulationLog_115490482698" }, "maxJobDurationInSeconds": 28800, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/RoboMakerSampleTheFirst", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerHelloWorldRobot/1546541208251", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerHelloWorldSimulation/1546541198985", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": {} } ], "unprocessedJobs": [] }

下列程式碼範例會示範如何使用cancel-simulation-job

AWS CLI

取消模擬工作

下列cancel-simulation-job範例會取消指定的模擬工作。

aws robomaker cancel-simulation-job \ --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x

下列程式碼範例會示範如何使用create-deployment-job

AWS CLI

若要建立部署工作

此範例會為叢集建立部署工作 MyFleet。它包括一個名為「環境」的環境變量。它還附加了一個名為「區域」的標籤。

命令:

aws robomaker create-deployment-job --deployment-config concurrentDeploymentPercentage=20,failureThresholdPercentage=25 --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711 --tags Region=West --deployment-application-configs application=arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerVoiceInteractionRobot/1546537110575,applicationVersion=1,launchConfig={environmentVariables={ENVIRONMENT=Beta},launchFile=await_commands.launch,packageName=voice_interaction_robot}

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/sim-0974h36s4v0t", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerVoiceInteractionRobot/1546537110575", "applicationVersion": "1", "launchConfig": { "packageName": "voice_interaction_robot", "launchFile": "await_commands.launch", "environmentVariables": { "ENVIRONMENT": "Beta" } } } ], "createdAt": 1550770236.0, "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "tags": { "Region": "West" } }

下列程式碼範例會示範如何使用create-fleet

AWS CLI

若要建立叢集

此範例會建立叢集。它貼附一個名為「區域」的標籤。

命令:

aws robomaker create-fleet --name MyFleet --tags Region=East

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyOtherFleet/1550771394395", "name": "MyFleet", "createdAt": 1550771394.0, "tags": { "Region": "East" } }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考CreateFleet中的。

下列程式碼範例會示範如何使用create-robot-application-version

AWS CLI

建立自動機制應用程式版本

此範例會建立自動機制應用程式版本。

命令:

aws robomaker create-robot-application-version --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931", "name": "MyRobotApplication", "version": "1", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "etag": "f8cf5526f1c6e7b3a72c3ed3f79c5493-70", "architecture": "ARMHF" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551201873.0, "revisionId": "9986bb8d-a695-4ab4-8810-9f4a74d1aa00" "tags": {} }

下列程式碼範例會示範如何使用create-robot-application

AWS CLI

建立自動機制應用程式

此範例會建立自動機制應用程式。

命令:

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

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551201873931", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "ARMHF" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551201873.0, "revisionId": "1f3cb539-9239-4841-a656-d3efcffa07e1", "tags": {} }

下列程式碼範例會示範如何使用create-robot

AWS CLI

建立自動機制

此範例會建立自動機制。它使用 ARMHF 架構。它還會貼附一個名為「區域」的標籤。

命令:

aws robomaker create-robot --name MyRobot --architecture ARMHF --greengrass-group-id 0f728a3c-7dbf-4a3e-976d-d16a8360caba --tags Region=East

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398", "name": "MyRobot", "createdAt": 1550772325.0, "greengrassGroupId": "0f728a3c-7dbf-4a3e-976d-d16a8360caba", "architecture": "ARMHF", "tags": { "Region": "East" } }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考CreateRobot中的。

下列程式碼範例會示範如何使用create-simulation-application-version

AWS CLI

建立模擬應用程式版本的步驟

此範例會建立自動機制應用程式版本。

命令:

aws robomaker create-simulation-application-version --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MySimulationApplication/1551203427605

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MyRobotApplication/1551203427605", "name": "MyRobotApplication", "version": "1", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "etag": "00d8a94ff113856688c4fce618ae0f45-94", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551203853.0, "revisionId": "ee753e53-519c-4d37-895d-65e79bcd1914", "tags": {} }

下列程式碼範例會示範如何使用create-simulation-application

AWS CLI

建立模擬應用程式

此範例會建立模擬應用程式。

命令:

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

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MyRobotApplication/1551203301792", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551203301.0, "revisionId": "ee753e53-519c-4d37-895d-65e79bcd1914", "tags": {} }

下列程式碼範例會示範如何使用create-simulation-job

AWS CLI

建立模擬工作

此範例會建立模擬工作。它使用機器人應用程序和模擬應用程序。

命令:

aws robomaker create-simulation-job --max-job-duration-in-seconds 3600 --iam-role arn:aws:iam::111111111111:role/AWSRoboMakerCloudWatch-154766341-SimulationJobRole-G0OBWTQ8YBG6 --robot-applications application=arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821,launchConfig={packageName=hello_world_robot,launchFile=rotate.launch} --simulation-applications application=arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605,launchConfig={packageName=hello_world_simulation,launchFile=empty_world.launch} --tags Region=North

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-w7m68wpr05h8", "status": "Pending", "lastUpdatedAt": 1551213837.0, "failureBehavior": "Fail", "clientRequestToken": "b283ccce-e468-43ee-8642-be76a9d69f15", "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/MySimulationRole", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": { "Region": "North" } }

下列程式碼範例會示範如何使用delete-fleet

AWS CLI

若要刪除叢集

此範例會刪除叢集。

命令:

aws robomaker delete-fleet --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771394395
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考DeleteFleet中的。

下列程式碼範例會示範如何使用delete-robot-application

AWS CLI

刪除自動機制應用程式

此範例會刪除自動機制應用程式。

命令:

aws robomaker delete-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821

下列程式碼範例會示範如何使用delete-robot

AWS CLI

刪除自動機制

此範例會刪除自動機制。

命令:

aws robomaker delete-robot --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540829698778
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考DeleteRobot中的。

下列程式碼範例會示範如何使用delete-simulation-application

AWS CLI

刪除模擬應用程式的步驟

此範例會刪除模擬應用程式。

命令:

aws robomaker delete-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605

下列程式碼範例會示範如何使用deregister-robot

AWS CLI

從叢集中取消註冊機器人

此範例會從叢集取消註冊自動機制。

命令:

aws robomaker deregister-robot --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907 --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907", "robot": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398" }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考DeregisterRobot中的。

下列程式碼範例會示範如何使用describe-deployment-job

AWS CLI

描述部署工作

下列describe-deployment-job範例會擷取有關指定部署工作的詳細資料。

aws robomaker describe-deployment-job \ --job arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711", "status": "InProgress", "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/RoboMakerHelloWorldRobot/1546541208251", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "createdAt": 1551218369.0, "robotDeploymentSummary": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540834232469", "deploymentStartTime": 1551218376.0, "status": "Deploying", "progressDetail": {} } ], "tags": {} }

下列程式碼範例會示範如何使用describe-fleet

AWS CLI

描述艦隊

下列describe-fleet範例會擷取指定叢集的詳細資料。

aws robomaker describe-fleet \ --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907

輸出:

{ "name": "MyFleet", "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "robots": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540834232469", "createdAt": 1540834232.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyOtherRobot/1540829698778", "createdAt": 1540829698.0 } ], "createdAt": 1539894765.0, "lastDeploymentStatus": "Succeeded", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-xl8qssl6pbcn", "lastDeploymentTime": 1551218369.0, "tags": {} }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考DescribeFleet中的。

下列程式碼範例會示範如何使用describe-robot-application

AWS CLI

描述自動機器人應用

此範例描述自動機制應用程式。

命令:

aws robomaker describe-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "X86_64" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "revisionId": "e72efe0d-f44f-4333-b604-f6fa5c6bb50b", "lastUpdatedAt": 1551203485.0, "tags": {} }

下列程式碼範例會示範如何使用describe-robot

AWS CLI

描述一個機器人

此範例描述自動機制。

命令:

aws robomaker describe-robot --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398", "name": "MyRobot", "status": "Available", "greengrassGroupId": "0f728a3c-7dbf-4a3e-976d-d16a8360caba", "createdAt": 1550772325.0, "architecture": "ARMHF", "tags": { "Region": "East" } }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考DescribeRobot中的。

下列程式碼範例會示範如何使用describe-simulation-application

AWS CLI

描述模擬應用程式的步驟

此範例說明模擬應用程式。

命令:

aws robomaker describe-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "name": "MySimulationApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "revisionId": "783674ab-b7b8-42d9-b01f-9373907987e5", "lastUpdatedAt": 1551203427.0, "tags": {} }

下列程式碼範例會示範如何使用describe-simulation-job

AWS CLI

描述模擬工作的步驟

此範例描述模擬工作。

命令:

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

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-pql32v7pfjy6", "status": "Running", "lastUpdatedAt": 1551219349.0, "failureBehavior": "Continue", "clientRequestToken": "a19ec4b5-e50d-3591-33da-c2e593c60615", "outputLocation": { "s3Bucket": "my-output-bucket", "s3Prefix": "output" }, "maxJobDurationInSeconds": 3600, "simulationTimeMillis": 0, "iamRole": "arn:aws:iam::111111111111:role/MySimulationRole", "robotApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551206341136", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch" } } ], "simulationApplications": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551206347967", "applicationVersion": "$LATEST", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "tags": {} }

下列程式碼範例會示範如何使用list-deployment-jobs

AWS CLI

若要列出部署工作

下列list-deployment-jobs範例會擷取部署工作的清單。

aws robomaker list-deployment-jobs

輸出:

{ "deploymentJobs": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/sim-6293szzm56rv", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "InProgress", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/HelloWorldRobot/1546537110575", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_robot", "launchFile": "rotate.launch", "environmentVariables": { "ENVIRONMENT": "Desert" } } } ], "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "createdAt": 1550689373.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-4w4g69p25zdb", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AWSRoboMakerHelloWorld-1544562726923_YGHM_sh5M/1544562822877", "applicationVersion": "1", "launchConfig": { "packageName": "fail", "launchFile": "fail" } } ], "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "failureReason": "", "failureCode": "", "createdAt": 1544719763.0 } ] }

下列程式碼範例會示範如何使用list-fleets

AWS CLI

列出車隊

此範例會列出叢集。最多將返回 20 個艦隊。

命令:

aws robomaker list-fleets --max-items 20

輸出:

{ "fleetDetails": [ { "name": "Trek", "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "createdAt": 1539894765.0, "lastDeploymentStatus": "Failed", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-4w4g69p25zdb", "lastDeploymentTime": 1544719763.0 } ] }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考ListFleets中的。

下列程式碼範例會示範如何使用list-robot-applications

AWS CLI

列出機器人應用

此範例列出自動機制應用程式 結果僅限於 20 個機器人應用。

命令:

aws robomaker list-robot-applications --max-results 20

輸出:

{ "robotApplicationSummaries": [ { "name": "MyRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobot/1546537110575", "version": "$LATEST", "lastUpdatedAt": 1546540372.0 }, { "name": "AnotherRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/AnotherRobot/1546541208251", "version": "$LATEST", "lastUpdatedAt": 1546541208.0 }, { "name": "MySuperRobot", "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MySuperRobot/1547663517377", "version": "$LATEST", "lastUpdatedAt": 1547663517.0 } ] }

下列程式碼範例會示範如何使用list-robots

AWS CLI

列出機器人

此範例列出自動機器人。最多將返回 20 個機器人。

命令:

aws robomaker list-robots --max-results 20

輸出:

{ "robots": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot100/1544035373264", "name": "Robot100", "status": "Available", "createdAt": 1544035373.0, "architecture": "X86_64" }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot101/1542146976587", "name": "Robot101", "status": "Available", "createdAt": 1542146976.0, "architecture": "X86_64" }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/Robot102/1540834232469", "name": "Robot102", "fleetArn": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711", "status": "Available", "createdAt": 1540834232.0, "architecture": "X86_64", "lastDeploymentJob": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-jb007b75gl5f", "lastDeploymentTime": 1550689533.0 }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1540829698778", "name": "MyRobot", "status": "Registered", "createdAt": 1540829698.0, "architecture": "X86_64" } ] }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考ListRobots中的。

下列程式碼範例會示範如何使用list-simulation-applications

AWS CLI

列出模擬應用程式

此範例列出了模擬應用程式。最多會傳回 20 個模擬應用程式。

命令:

aws robomaker list-simulation-applications --max-results 20

輸出:

{ "simulationApplicationSummaries": [ { "name": "AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq/1548959170096", "version": "$LATEST", "lastUpdatedAt": 1548959170.0 }, { "name": "RoboMakerHelloWorldSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerHelloWorldSimulation/1546541198985", "version": "$LATEST", "lastUpdatedAt": 1546541198.0 }, { "name": "RoboMakerObjectTrackerSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerObjectTrackerSimulation/1545846795615", "version": "$LATEST", "lastUpdatedAt": 1545847405.0 }, { "name": "RoboMakerVoiceInteractionSimulation", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/RoboMakerVoiceInteractionSimulation/1546537100507", "version": "$LATEST", "lastUpdatedAt": 1546540352.0 }, { "name": "AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerCloudWatch-1547663411642_0LIt6D1h6/1547663521470", "version": "$LATEST", "lastUpdatedAt": 1547663521.0 }, { "name": "AWSRoboMakerDeepRacer-1545848257672_1YZCaieQ-", "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/AWSRoboMakerDeepRacer-1545848257672_1YZCaieQ-/1545848370525", "version": "$LATEST", "lastUpdatedAt": 1545848370.0 } ] }

下列程式碼範例會示範如何使用list-simulation-jobs

AWS CLI

列出模擬工作的步驟

此範例列出模擬工作。

命令:

aws robomaker list-simulation-jobs

輸出:

{ "simulationJobSummaries": [ { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-66bbb3gpxm8x", "lastUpdatedAt": 1548959178.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerObjectTracker-1548959046124_NPvyfcatq" ], "robotApplicationNames": [ null ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-b27c4rkrtzcw", "lastUpdatedAt": 1543514088.0, "status": "Canceled", "simulationApplicationNames": [ "AWSRoboMakerPersonDetection-1543513948280_T8rHW2_lu" ], "robotApplicationNames": [ "AWSRoboMakerPersonDetection-1543513948280_EYaMT0mYb" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-51vxjbzy4q8t", "lastUpdatedAt": 1543508858.0, "status": "Canceled", "simulationApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_lFF9ZQyx6" ], "robotApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_axbYa3S3K" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-kgf1fqxflqbx", "lastUpdatedAt": 1543504862.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_lFF9ZQyx6" ], "robotApplicationNames": [ "AWSRoboMakerCloudWatch-1543504747391_axbYa3S3K" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-vw8lvh061nqt", "lastUpdatedAt": 1543441430.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341__yb_Jg96l" ], "robotApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341_lNbmKHvs9" ] }, { "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-txy5ypxmhz84", "lastUpdatedAt": 1543437488.0, "status": "Completed", "simulationApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341__yb_Jg96l" ], "robotApplicationNames": [ "AWSRoboMakerHelloWorld-1543437372341_lNbmKHvs9" ] } ] }

下列程式碼範例會示範如何使用list-tags-for-resource

AWS CLI

若要列出資源的標籤

此範例列出 AWS RoboMaker 資源的標籤。

命令:

aws robomaker list-tags-for-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/Robby_the_Robot/1544035373264"

輸出:

{ "tags": { "Region": "North", "Stage": "Initial" } }

下列程式碼範例會示範如何使用register-robot

AWS CLI

註冊機器人

此範例會將自動機制註冊至叢集。

命令:

aws robomaker register-robot --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907 --robot arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398

輸出:

{ "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1550771358907", "robot": "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1550772324398" }
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考RegisterRobot中的。

下列程式碼範例會示範如何使用restart-simulation-job

AWS CLI

重新啟動模擬的步驟

此範例會重新啟動模擬。

命令:

aws robomaker restart-simulation-job --job arn:aws:robomaker:us-west-2:111111111111:simulation-job/sim-t6rdgt70mftr

下列程式碼範例會示範如何使用sync-deployment-job

AWS CLI

若要同步部署工作

此範例會同步處理部署工作。

命令:

aws robomaker sync-deployment-job --fleet arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/Trek/1539894765711

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:deployment-job/deployment-09ccxs3tlfms", "fleet": "arn:aws:robomaker:us-west-2:111111111111:deployment-fleet/MyFleet/1539894765711", "status": "Pending", "deploymentConfig": { "concurrentDeploymentPercentage": 20, "failureThresholdPercentage": 25 }, "deploymentApplicationConfigs": [ { "application": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1546541208251", "applicationVersion": "1", "launchConfig": { "packageName": "hello_world_simulation", "launchFile": "empty_world.launch" } } ], "createdAt": 1551286954.0 }

下列程式碼範例會示範如何使用tag-resource

AWS CLI

若要標記資源

此範例會標記資源。它附加了兩個標籤:「區域」和「舞台」。

命令:

aws robomaker tag-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1544035373264" --tags Region=North,Stage=Initial
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考TagResource中的。

下列程式碼範例會示範如何使用untag-resource

AWS CLI

若要取消標記資源

此範例會從資源中移除標籤。它會移除「區域」標籤。

命令:

aws robomaker untag-resource --resource-arn "arn:aws:robomaker:us-west-2:111111111111:robot/MyRobot/1544035373264" --tag-keys Region
  • 如需 API 詳細資訊,請參閱AWS CLI 命令參考UntagResource中的。

下列程式碼範例會示範如何使用update-robot-application

AWS CLI

更新自動機制應用程式

此範例會更新自動機制應用程式。

命令:

aws robomaker update-robot-application --application arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821 --sources s3Bucket=my-bucket,s3Key=my-robot-application.tar.gz,architecture=X86_64 --robot-software-suite name=ROS,version=Kinetic

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:robot-application/MyRobotApplication/1551203485821", "name": "MyRobotApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-robot-application.tar.gz", "architecture": "X86_64" } ], "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "lastUpdatedAt": 1551287993.0, "revisionId": "20b5e331-24fd-4504-8b8c-531afe5f4c94" }

下列程式碼範例會示範如何使用update-simulation-application

AWS CLI

更新模擬應用程式的步驟

此範例會更新模擬應用程式。

命令:

aws robomaker update-simulation-application --application arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605 --sources s3Bucket=my-bucket,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

輸出:

{ "arn": "arn:aws:robomaker:us-west-2:111111111111:simulation-application/MySimulationApplication/1551203427605", "name": "MySimulationApplication", "version": "$LATEST", "sources": [ { "s3Bucket": "my-bucket", "s3Key": "my-simulation-application.tar.gz", "architecture": "X86_64" } ], "simulationSoftwareSuite": { "name": "Gazebo", "version": "7" }, "robotSoftwareSuite": { "name": "ROS", "version": "Kinetic" }, "renderingEngine": { "name": "OGRE", "version": "1.x" }, "lastUpdatedAt": 1551289361.0, "revisionId": "4a22cb5d-93c5-4cef-9311-52bdd119b79e" }