Robot Control using Raspberry Pi

Workshop - A minimal introduction to Minipupper V2

Li Bai

Temple University

Lillian Drasin

Temple University

Afreez Gan

Mangdang Inc.

April 6, 2024

A great appreciation to

 - $4,500 gifted to purchase mangdang robots for SAC 2024

http://bit.ly/mangdang24

Mangdang

A quadruped robot dog originating from a stanford project click here

  • A Mangdang v2
  • 32GB micro SD cards

  • AWS Robomaker and AWS Cloud 9
    • Virtualization, Docker, Linux, Python 3
    • Robot Operating System (ROS) and Gazebo
  • ReInvent Workshop 2022 for Dance Robot (Gan and Hansen 2022)

Cloud Computing

AWS Greengrass Deployment Process

Minipupper Setup Workflow

Launch AWS Lab

  • Click “start lab”
  • Wait for circle next to AWS to turn green

Cloud 9 (on AWS cloud)

  • Integrated development environment (IDE) provided by Amazon Web Services (AWS), allows code to be written, run, and debugged in the cloud
  • Docker: software that allows for building, testing, and deployment of applications
  • Cross compile: compiling code on host system to run on target system
  • Develop component; Robot Operating System (ROS) code
  • Create a piece of software that can run on devices connected to Greengrass

Cloud 9 Setup

  • Search Cloud9 in AWS console

  • Select “create environment”

  • Name the new instance minipupperv2
  • Select “New EC2 Instance”

  • Select additional instance types
  • Choose c4.xlarge from drop-down menu

  • Under “platform” drop-down menu, choose Ubuntu 22.04 (Jammy)
  • Select secure shell (ssh)

  • Create OS

  • click “open” to access Cloud9

Cloud 9 IDE

Install DCV, ROS, Docker and Gazebo ~10 mins

  • Run the following command in a terminal window
curl -fsSL "https://bit.ly/robomaker2204" | sudo -E bash -
  • Wait for 10 minutes, or until prompted to enter code
sudo reboot

Docker-compose build

  • Copy to terminal one line at one time
  • “enter” after each paste
  • To save time, we will run a docker container which takes about 1300 - 2200 seconds (~30 minutes)
git clone -b ieee-dev https://github.com/lbaitemple/mini-pupper-aws
cd mini-pupper-aws
docker-compose build

MinipupperV2 Setup Requirements

  • a Minipupper v2 robot

  • Minipupper v2 ubuntu prebuilt image, download here

  • a wireless.txt, in cloud 9 git repo - mini_pupper_aws/wireless folder

Setup Raspberry Pi - Balena Etcher (preflashed)

  • Check to ensure your SD card is selected to flash to SDHC, NOT your computer!

NOTE: the following step will not apply to you if you own a computer using Windows

Remove MicroSD Card and Reinsert

  • make sure you see a new driver system-boot

Generating a Password Hash

  • Passowrd Hash: cryptographic representation of a password

Generate your Password Hash

  • Now we open a new terminal to setup another docker image to setup wifi on the minipupper
cd mini-pupper-aws/wifipasswd
docker-compose build
docker image list

  • paste commands to open a new docker instance
docker run -it bionic-bai:latest /bin/bash

  • Paste command after the #
echo -n password | iconv -t UTF-16LE | openssl md4 
  • replace “password” in command line with your password used to log in to school organization email
  • enter to regenerate unique hash
  • “Ctrl +S” to save changes in wireless.txt file

  • save value for your WiFi access (in google doc or notebook)!

Revise the ID as eduroam in wireless.txt

  • Open downloaded Minipupper file
  • Open wireless.txt file at the bottom
  • “Ctrl + S” to save
  • Line 1: use your school email address
  • Line 2: use the hash passcode that you previously saved in a document or notebook
  • Line 5-6: backup solution to put WIFI_AP1=ieeer2 and WIFI_AP1_PWD=ieeer2r1
  • (see next slide for example)

Revising the ID

Copy the wifi password file

  • Drag and drop the wireless.txt into system-boot folder

Remove miniSD, connect it to Minipupper SD slot

Insert MicroSD Card to Minipupper

  • If the IP address does not show up on first time boot up, wait for power on sound and screen flash, then disconnect power and reconnect

  • If you see the IP address on the screen in the second time power on, type http://[ipaddress]:8080 for a web remote control

Minipupper Powered On

Jupyter Lab on Minipupper

  • Open a browser, type http://[ipaddress]:8888
  • password mangdang

  • Open a new terminal

  • Download mangdang folder
  • Refresh page for folder to appear
git clone https://github.com/lbaitemple/mangdang
  • Find files in the mangdang folder
  • Do NOT run first block (remove docker) !

  • Open the minipupper.ipynb python notebook
    1. move cursor down to line
    2. click “run” button

  • Run the second block to install greengrass

Find AWS Credentials

  • Log into AWS Academy
  • Check AWS Details

  • Find the login credential

Return to Jupyter Lab

  • Return to Jupyter Lab on RPi4
  • http://[ipaddress]:8888
  • AWS academy credentials one at a time to appropriate fields

  • Thing ROS2_Minipupper and thing group ROS2_Minipuppers

  • Run the block

  • Ensure a thing and a thing group created

  • Ensure things are added on IoT Core

  • Run the next block, add a greengrass user ggc_user
  • Should only be done after the docker image build is completed

  • ensure the Greengrass user ggc_user is added
  • DO NOT run the last step yet, this will be run after deployment

Checking on AWS IoT Core

  • these steps ensure that all things and thing groups have been created in AWS
    • Thing (two places): Physical objects that are embedded with sensors, software, and other technologies
    • Thing group: you can put multiple things in one group
    • Deployments: load docker ECR container to Things in a Thing group

Check IoT Core Things

  • Find Things on IoT in the drop down menu under “Manage”

  • Find thing on Greengrass under drop down menu
  • Select core devices and find the thing group

  • Find Thing Group on IoT
  • thing group is the ROS2_Minipupper

  • Find Deployment on IoT

ECR setup

When the docker image is completed (30 minutes), set up a repository to store docker instances

What is a Docker Instance?

  • a virtual computer that runs on your computer
  • contains everything needed to run only specific piece of software,
  • application service including the code, libraries, and other dependencies
  • can be transferred from cloud to device, device to cloud (using green grass)

Create an ECR

  • Search and open ECR in AWS
ros-humble-greengrass-minipupper-v2

  • Select repository name

  • open “view push commands”

  • Return to a new terminal in Cloud 9
  • Paste each push command one line at a time

S3 Setup on AWS Cloud

What is S3?

  • Simple Storage Service (S3)
  • Moves configuration files from cloud to device, device to cloud (generally storage files)
  • Make sure the name is unique

S3 setup

  • Search for S3 on AWS Console, select first option

  • Setup a S3 by selecting “create bucket”

  • Use name and date for S3 bucket repo naming
  • Remember your created name!

  • Deselect “block permission”
  • Acknowledge settings

  • Create the S3 bucket

Cloud9 Final Setup

Once the docker image build is complete, return to Cloud9…

  • Select mini-pupper-aws drop-down menu
  • Double click awsgreengrass.sh
  • Substitute your S3 repository name in line 4

Run a Bash Script to create a component

bash ./awsgreengrass.sh

Greengrass Deployment to Mini Pupper v2

  • Find deployments in left drop down menu
  • Select and open deployment

Deployment on IoT and Mini Pupper v2

  • Wait for up to 15 minutes

Jupyter Lab on MiniPupper v2

  • check what docker images are available
docker image list

  • paste command to check what docker process are available
docker ps -a

MQTT

  • try demo in message payload to see minipupper dance

  • Also, try my_demo

Demo Code

AWS Robomaker - (Simulation)

Acknowledgments

Thank for technical supports from the AWS Robomaker team!

References

Gan, Afreez, and Matt Hansen. 2022. “Dance of the Cloud Connected Robots.” 2022. https://catalog.us-east-1.prod.workshops.aws/workshops/511d7599-73bd-4142-bd6b-fa83dbe3d8ce/en-US.