Manage Robot Deployment from External Applications with AWS | Amazon IXD – VGT2 Las Vegas

Manage Robot Deployment from External Applications with AWS | Amazon IXD - VGT2 Las VegasMore Info

This blog post references AWS RoboMaker Fleet Management, a feature that has been deprecated. You should now utilize AWS IoT Greengrass V2 for deploying and managing your robot software. For a deeper understanding of this process, check out another insightful blog post here.

Introduction

Every day, a growing number of companion robots, cleaning robots, delivery drones, and inspection devices are being sold to consumers or deployed in various fields. Nowadays, any robotics developer or organization can leverage AWS RoboMaker’s fleet management capabilities to deploy applications and application updates to their robots, managing fleets of any size. One common request from our users has been the need for enhanced control over when application deployments occur on specific robots. This is particularly relevant in the consumer robotics sector, where a robot is often paired with a companion mobile application that necessitates explicit user approval for deployments.

To cater to this need, we are introducing Conditional OTA in AWS RoboMaker. This feature enables users to set multiple conditions (e.g., battery level above 50%, robot not in motion, etc.) before our service attempts to deploy an application update to a robot. If these conditions aren’t met, the deployment will be postponed and retried until successful or until the user-defined timeout is reached. With this new conditional OTA feature, you can ensure that your robot is in an optimal state before the AWS RoboMaker service proceeds with downloading, installing, and rebooting the robot. If the specified conditions for an update are not met, the robot will continue operating with the previously deployed application.

In this post, I’ll detail how to utilize the Conditional OTA feature of AWS RoboMaker alongside AWS IoT to manage your deployment from any external applications (like a mobile app, laptop, or cloud-based application) to your robot. We’ll demonstrate how to deploy a ROS application to a robot using a conditional script in AWS RoboMaker. This script publishes a message to a topic via the IoT message broker and listens for a response from your application to initiate the deployment.

How It Works

AWS RoboMaker Fleet Management employs AWS IoT Greengrass to deploy applications to robots within a fleet. After a user creates a deployment job that specifies the application to be deployed, RoboMaker Fleet Management will start deploying that application across all robots in the fleet. Once the deployment job is initiated, the conditional script will execute to check the robot’s status. The sample script in this article publishes a deployment message to the IoT Topic. As the user’s application subscribes to that same topic in the IoT message broker, it receives a notification identifying the robot designated for deployment. The user can then decide whether to proceed with the robot deployment. If approved, the current ROS processes on the robot will be terminated, AWS IoT Greengrass will download the application, and then the new application will be started. If the application cannot be deployed within the configured timeout, the deployment will fail, citing a reason (failure code) of DownloadConditionFailure.

Step-by-Step Guide

To create an external application for managing your robot deployment in AWS RoboMaker, follow these steps:

  1. Create a robot in AWS RoboMaker.
  2. Create a fleet and register your robot to the fleet in AWS RoboMaker.
  3. Create a robot application in AWS RoboMaker.
  4. Create an IoT thing in AWS IoT.
  5. Create a conditional file and upload it to your S3.
  6. Start your external application process.
  7. Create a deployment job with conditional OTA.
  8. Monitor the robot deployment status according to your application input.

Prerequisites

You will need a robot with Greengrass installed. If you don’t have a physical robot, you can set up an EC2 instance.

Step 1: Create a Robot

To begin, create a robot in the AWS RoboMaker service, ensuring you have SSH access to the robot.

  • In the AWS RoboMaker console, select Robot, then Create Robot.
  • Enter the name and choose the architecture for your robot.
  • Opt to Create New GreengrassGroup and provide the Greengrass prefix.
  • Create a new IAM Role.
  • Download the GreengrassCore and certificates, then follow the console instructions to install them on your robot.

Step 2: Create a Fleet and Register Robot

Next, establish a robot fleet and register your robot within it.

  • In the AWS RoboMaker console, click Fleet, then Create Fleet.
  • Enter the name and create the fleet.
  • Choose Register New and select the robot you just created.

Step 3: Create a Robot Application

Create a robot application in AWS RoboMaker. You can find the source code in the robot_ws directory of the aws-robotics GitHub repository. To use your own robot application, replace the Amazon S3 link with the location of your application bundle. For more details, see the guide on Creating a Robot Application.

  • Upload your Robot Application into your Amazon S3.
  • In the AWS RoboMaker console, select Robot applications, then Create robot application.
  • Fill in the name and select the correct ROS version for your Robot Application.
  • Under Sources, enter the S3 location for the robot architecture source file.

Step 4: Create an IoT Thing in AWS IoT

Create a thing in AWS IoT by navigating to IoT Core -> Manage -> Thing -> Create.

  • Download the IoT certificates, which are needed for both the external application and the robot.
  • Attach an IoT policy to the thing, allowing operations on relevant topic resources.

The policy should permit the following operations: Publish, Subscribe, and Receive on topics deployment/condition and deployment/condition/confirmed. Also, allow Connect on used in the external process and conditional script.

Sample Policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iot:Publish",
        "iot:Subscribe",
        "iot:Receive"
      ],
      "Resource": [
        "arn:aws:iot:<region>:<account-id>:topic/deployment/condition",
        "arn:aws:iot:<region>:<account-id>:topic/deployment/condition/confirmed"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "iot:Connect"
      ],
      "Resource": [
        "arn:aws:iot:<region>:<account-id>:client/<client_id>"
      ]
    }
  ]
}

Step 5: Create a Conditional File and Upload to Your S3

Develop your conditional file, which will execute on your robot before deployment begins. This sample Python script uses AWS IoT to:

  • Send a deployment message to the topic deployment/condition, notifying the external app.
  • Listen on the topic deployment/condition/confirmed to receive acceptance from the external app.
#!/usr/bin/env python
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
import logging
import time
import os
import sys
import threading
import json

host = "<iot_host_endpoint>"
rootCAPath = "<path_to_root_CA>"

For more information on managing robot deployments, be sure to check out this excellent resource here.

Location: Amazon IXD – VGT2, 6401 E Howdy Wells Ave, Las Vegas, NV 89115.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *