Giter Site home page Giter Site logo

allangagnon / aws-robomaker-jetbot-ros Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lbaitemple/aws-robomaker-jetbot-ros

0.0 1.0 0.0 25.51 MB

The JetBot ROS Application with AWS RoboMaker Workshops

Dockerfile 0.01% Shell 0.02% JavaScript 29.63% CSS 0.01% HTML 0.01% CMake 0.03% Python 0.14% Roff 70.17%

aws-robomaker-jetbot-ros's Introduction

Building a Robot Application with RoboMaker

Files below need to be updated through either CFN/script or manually

Prerequisites - must have the following information before continue the lab - IAM role arn, IoT endpoint, Public VPC Subnet IDs (2), security group, S3 bucket, region, accessKeyId, secretAccessKey

  1. roboMakerSettings.json (IAM role arn, IoT endpoint, Public VPC Subnet IDs (2), security group, S3 bucket)
  2. assets/teleop/awscreds.js (IoT endpoint, region, accessKeyId, secretAccessKey)

Clone the Robot Application

  1. Open the RoboMaker IDE and navigate to the terminal and clone this Git repo to the development machine:
    # change to the environment directory
    $ cd ~/environment
    
    $ git clone URL jetbot
    

Install Dependencies [~15 mins]

  1. Open the RoboMaker IDE and navigate to the terminal.

  2. In the terminal window, change to the jetbot/assets directory

    # Run install_dep.sh to install prerequisite
    $ cd ~/environment/jetbot/assets/scripts
    
    $ chmod +x compile_arm64.sh install_deps.sh 
    
    $ sudo ./install_deps.sh
    
    
  3. Wait for previous step to complete and in the same terminal window, run the following command to update ROS dependencies

    #  Make sure previous step is complete first
    $ rosdep update
    
    

Run in Simulation and Explore [~30 mins]

  1. Open the roboMakerSetting.json file in the jetbot directory and input S3 bucket, IAM role, MQTT endpoint and VPC public subnet ids and security group ids.

  2. Click Run, Add or Edit Configurations, select the roboMakerSettings.json file from jetbot directory

  3. Click Run, Workflow, select JetBot Simulation - Build and Bundle (this process takes about 10 minutes)

  4. Click Run, Launch Simulation, JetBot Circle Simulation - This will launch the application in simulation enviornment with the Jetbot rotating in circles. When simulation status displays (running), explore the enviornment in Gazebo.

  5. Stop the simulation

  6. Click Run, Launch Simulation, JetBot Teleop Simulation - This will launch the application in simulation enviornment where you can drive the Jetbot with the teleop client app. When simulation status displays (running), explore the enviornment in Gazebo.

  7. Zip the teleop client app

    # Make sure you are in the jetbot directory
    $ cd ~/environment/jetbot
    $ zip teleop.zip assets/teleop/*
    
  8. Download the zip file in the file explorer and unzip it on the desktop

  9. Open the robogui.html file in a browser and make sure the connection status states Connected

  10. Use your mouse to move the joy stick and watch the Jetbot move in the Gazebo window

  11. Stop the simulation

Build, Bundle and Deploy Robot Application in ARM64 Architecture [~15 mins]

  1. Open the RoboMaker IDE and navigate to the terminal

  2. Change to the jetbot directory and build & bundle the ROS application in a docker container

    # Make sure you are in the jetbot directory
    $ cd ~/environment/jetbot
    
    # IMPORTANT: Make sure you are in the jetbot directory
    # Build and bundle the robot application
    $ docker run --rm -ti -v $(pwd):/environment/jetbot jetbot-ros
    
    # You will be dropped into the shell of the docker container
    # the prompt will be similar to the following root@83afb0b35322:/environment/jetbot# 
    
    (docker)$ ./assets/scripts/compile_arm64.sh 
    
    # Wait until shell script is completed 
    #Type exit or Ctrl-D, to exit the container
    (docker)$ exit
    
  3. Back in the RoboMaker IDE and navigate to the terminal

    # Make sure you exited out of the container in previous step
    # Copy the robot application to S3
    $ aws s3 cp ./robot_ws/arm64_bundle/output.tar s3://<S3-BUCKET-NAME>/jetbot/aarch64/output.tar
    

Deploying with RoboMaker

When a robot application is deployed to a physical robot, AWS RoboMaker does the following:

  • AWS RoboMaker creates or updates a custom Lambda in your account. The Lambda contains the logic needed for deployment. This includes robot application bundle download, ROS launch, pre- and post-checks, and other logic.

  • AWS RoboMaker begins deployment to the fleet using the parallelization specified in the deployment configuration.

  • AWS RoboMaker notifies AWS IoT Greengrass to run the custom Lambda on the target robot. The daemon running on the robot receives the command and runs the Lambda. If a Lambda is running when the command is received, it and all ROS process on the robot are terminated.

  • The Lambda downloads and uncompresses the robot application bundle from Amazon S3. If a pre-launch script was specified, it is run. Then the Lambda starts ROS using the launch file and package specified. If a post-launch script was specified, it is run after ROS is started. Finally, the status of the deployment is updated.

Create a Robot Application

  1. Open the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/

  2. In the left pane, choose Development, and then choose Robot applications.

  3. Select Create robot application.

  4. In the Create robot application page, type a Name for the robot application. Choose a name that helps you identify the robot.

  5. Select the Robot software suite used by your robot application

    • Select ROS Melodic
  6. Provide the Amazon S3 path to your bundled robot application file in ARM64 source file field. If this robot application is used only in simulations, specify a bundle built for the ARM64 platform. If you use this robot application in a fleet deployment, specify one or more bundles that represent the architectures of the robots in your fleet.

  7. Choose Create.

Create a Robot Application Version

  1. Open the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/

  2. In the left navigation pane, choose Development, and then choose Robot applications.

  3. Choose the robot application name.

  4. In the Robot applications details page, choose Create new version, and then choose Create.

Create a Robot

To create a robot:

  1. Open the AWS RoboMaker console at https://console.aws.amazon.com/robomaker/

  2. In the left navigation pane, choose Fleet Management, and then choose Robots.

  3. Choose Create robot.

  4. In the Create robot page, type a name for the robot.

  5. Select the Architecture of the robot.

  6. Select the ARM64 architecture for the Sparkfun Robot

  7. Under AWS IoT Greengrass group defaults, select a Create new to create a new AWS IoT Greengrass group for the robot. Optionally, you can select an existing AWS IoT Greengrass group. Each robot must have its own AWS IoT Greengrass group.

    1. If you use an existing AWS IoT Greengrass group, it must have an IAM role associated with it. To create the role, see Create deployment role.
  8. Select a IAM role to assign to the AWS IoT Greengrass group created for the robot. It grants permissions for AWS IoT Greengrass to access your robot application in Amazon S3 and read update status from AWS RoboMaker.

  9. Choose Create.

  10. In the Download your Core device page, choose Download to download and store your robot's security resources.

Configure Robot with Certificates

AWS RoboMaker uses X.509 certificates, managed subscriptions, AWS IoT policies, and IAM policies & roles to secure the applications that run on robots in your deployment environment.

An AWS RoboMake robot is also a Greengrass core. Core devices use certificates and policies to securely connect to AWS IoT. The certificates and policies also allow AWS IoT Greengrass to deploy configuration information, Lambda functions, connectors, and managed subscriptions to core devices

  1. On your local machine, open a terminal and navigate to the location of the dowloaded security resources from the previous step.

  2. Locate the IP address of robot on the OLED Sparkfun Jetbot OLED display

  3. Unzip your device certificates to the robot:

    # Copy the local security resources to the robot
    $ scp /path/to/downladed-zip/<robot-certs>.zip jetbot@<ip-addres>:/home/jetbot/robomaker-robot-certs.zip
    
    # SSH to the robot
    $ ssh jetbot@<ip-address>
    
    # Switch to the root user
    $ sudo su -s /bin/bash
    
    # Unzip the jetbot security credentials to greengrass certificate store
    $ unzip /home/jetbot/<greengrass-certs>.zip -d /greengrass
    
    # update the CA certificate used by RoboMaker
    $ cd /greengrass/certs/
    $ wget -O root.ca.pem https://www.amazontrust.com/repository/AmazonRootCA1.pem
    
    # start greengrass core
    $ sudo /greengrass/ggc/core/greengrassd start
    
    # Exit the root shell
    $ exit # or Ctrl-d
    
    # Terminate the ssh connection
    $ exit # or Ctrl-d
    

Create a Fleet

  1. Sign in to the AWS RoboMaker

  2. In the left navigation pane, under Fleet Management, and then choose Fleets.

  3. Select Create fleet.

    • In the Create fleet page, type a name for the fleet.
  4. Click Create to create the fleet.

Register a Robot

  1. In the left navigation pane, choose Fleet Management, and then choose Fleets.

  2. Select the Name of the fleet you want to modify.

  3. In the Fleet details page, select Register.

  4. In the Register robots page, select the robot you want to register, then select Register robots.

Create a Deployment

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

  2. In the left navigation pane, choose Fleet Management, and then choose Deployments.

  3. Click Create deployment.

  4. In the Create deployment page, under Configuration, select a Fleet.

  5. Select a Robot application.

  6. Select the Robot application version to deploy. The robot application must have a numbered applicationVersion for consistency reasons. If there are no versions listed, or to create a new version, see Creating a Robot Application Version.

  7. Under Deployment launch config, specify the Package name: jetbot

  8. Specify the Launch file: rc.launch

  9. Environment variables, type in an environment Name and Value. Environment variable names must start with A-Z or underscore and consist of A-Z, 0-9 and underscore. Names beginning with โ€œAWSโ€ are reserved.

    • Add the following environment variables:
      • Key = MOTOR_CONTROLLER(key must be in all caps exactly as MOTOR_CONTROLLER) Value = qwiic
  10. Specify a Robot deployment timeout. Deployment to an individual robot will stop if it does not complete before the amount of time specified.

  11. Click Create to create the deployment job.


Keep track of the progress of the deployment, when copying and extracting completes, the status will change to Launching.

Congratulations, you can now control your robot with the virtual joystick!

aws-robomaker-jetbot-ros's People

Contributors

jerwallace avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.