Robot Application (ROS Kinetic) Deployments from AWS RoboMaker

Deploying to Qualcomm® Robotics RB5 Platform to drive the Turtlebot 3 Burger

AWS RoboMaker is a cloud service that provides a development environment for robotics applications. Developers can use RoboMaker to create and deploy ROS Kinetic applications on physical robots, then simulate and test applications without the need for a real robot. RoboMaker also provides analytics-related ROS packages that you can integrate with your robot applications for posting data to AWS.

Step-by-step instructions for deploying to the Qualcomm Robotics RB5 are given in the AWS article Deploy Robotic Applications Using AWS RoboMaker. However, the cross-compilation and bundling instructions in that article are specific to armhf architectures. The procedure below modifies those instructions for the Docker file and the ARM64 architecture of the Qualcomm Robotics RB5 single-board computer (SBC). It also includes a shortcut designed to help make the final step of application deployment hassle-free.

Prerequisites

Follow these steps before deploying a RoboMaker application:

  1. Set up the Qualcomm Robotics RB5 with a Docker container with ROS Kinetic installed, as described in How to Install Docker on the Qualcomm Robotics RB3 development platform

  2. Connect the Turtlebot 3 Burger to the Qualcomm Robotics RB5.

  3. Sign into the Amazon S3 console. Create and name an Amazon S3 bucket.

  4. Install Java 8 to the Docker container. See Install Java to a Docker container on the Qualcomm Robotics RB3 for instructions.

  5. Install ARM64-based AWS Greengrass to the Docker container. See Install AWS Greengrass to a Docker container on the Qualcomm Robotics RB3 for instructions.

Cross-compilation and bundling for the Qualcomm Robotics RB5

Open the AWS article Deploy Robotic Applications Using AWS RoboMaker. Note that the Qualcomm Robotics RB5 fulfills the stated prerequisite of “a physical robot that is already set up and configured with ROS Kinetic/Melodic, SSH, SFTP/SCP and internet access.”

  1. In the article, scroll down to the subheading “Build a robot application with AWS RoboMaker.”

  2. Follow the instructions. When creating a new development environment on RoboMaker, you will come to the field “Pre-installed ROS Distribution.” Select “ROS Kinetic.”

  3. Continue through step 13 of the procedure.

Substitute instructions for step 14

Step 14 shows a sequence of commands (from cd /opt/robomaker/cross-compilation-dockerfile/ to exit)for bundling a robot application through a cross-compilation Docker container. The commands apply to the armhf architecture.

Instead, follow the procedure below to install packages for bundling applications (colcon) on the Qualcomm Robotics RB5. (For more details, refer to AWS RoboMaker Cross-compilation for ARM64.)

  1. Run these commands on the Qualcomm Robotics RB5 (Ubuntu host):

    $ sudo apt-get install qemu-user
    $ sudo apt install qemu-user-static
    $ sudo cp /usr/bin/qemu-aarch64-static /opt/robomaker/cross-compilation-dockerfile/
    $ cd /opt/robomaker/cross-compilation-dockerfile/
    $ mv Dockerfile Dockerfile.armhf
  2. Create a modified version of the original armhf Dockerfile for ARM64. Use the following code to create a new file and save it as Dockerfile.

    ARG ROS_VERSION=kinetic
    ARG UBUNTU_VERSION=xenial
    FROM arm64v8/ros:kinetic-ros-base-xenial

    ENV PATH="/root/.local/bin:${PATH}"

    # Copy qemu from the host machine.
    COPY qemu-aarch64-static /usr/bin

    RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

    # Installed for convenience
    RUN apt-get update && apt-get install -y vim

    # Add raspicam_node sources to apt

    RUN apt-get update && apt-get install -y apt-transport-https \
      && echo "deb https://packages.ubiquityrobotics.com/ubuntu/ubiquity xenial main" > /etc/apt/sources.list.d/ubiquity-latest.list \
      && apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C3032ED8

    # Install Raspberry Pi package sources and libraries
    #RUN apt-get update && apt-get install -y gnupg lsb-release software-properties-common \
    #  && add-apt-repository -y ppa:ubuntu-pi-flavour-makers/ppa \
    #  && apt-get update && apt-get install -y libraspberrypi0

    # Install Python and colcon
    RUN apt-get update && apt-get install -y \
       python \
       python3-apt \
       curl \
      && curl -O https://bootstrap.pypa.io/get-pip.py \
      && python3 get-pip.py \
      && python2 get-pip.py \
      && python3 -m pip install -U colcon-ros-bundle

    # Add custom rosdep rules
    # COPY custom-rosdep-rules/raspicam-node.yaml /etc/ros/rosdep/custom-rules/raspicam-node.yaml
    # RUN echo "yaml file:/etc/ros/rosdep/custom-rules/raspicam-node.yaml" > /etc/ros/rosdep/sources.list.d/22-raspicam-node.list \
    RUN echo "yaml https://s3-us-west-2.amazonaws.com/rosdep/python.yaml" > /etc/ros/rosdep/sources.list.d/18-aws-python.list \
       && rosdep update

    # Add custom pip rules
    COPY custom-pip-rules.conf /etc/pip.conf

    # Add custom apt sources for bundling
    COPY xenial-sources-arm64.yaml /opt/cross/apt-sources.yaml
  3. Save the following code into a file called xenial-sources-arm64.yaml. It lists ARM64 packages for bundling the robot application.

    # ARM Support

    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe multiverse
    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe multiverse
    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse

    # ROS
    deb [arch=arm64] http://packages.ros.org/ros/ubuntu xenial main
  4. Once Dockerfile is saved, run the following commands:

    $ sudo docker build -t ros-cross-compile:arm64 .
    $ cd ~/environment/HelloWorld/robot_ws
    $ sudo docker run -v $(pwd):/ws -it ros-cross-compile:arm64
    $ cd ws
    $ apt update
    $ rosdep install -–from-paths src -–ignore-src -r -y
    $ colcon build
    $ colcon bundle --apt-sources-list /opt/cross/apt-sources.yaml
    $ exit
  5. Resume the instructions in steps 15 and 16 of “Build a robot application with AWS RoboMaker.” Step 15 creates build and install folders under the robot_ws directory, and step 16 copies the robot application (output.tar) to the S3 bucket already created.

Deploying the application

The last section of that same AWS article is titled “Create and deploy the robot application with AWS RoboMaker.” Step 16 of that procedure creates the deployment.

To deploy the robot application successfully on the Qualcomm Robotics RB5, AWS Greengrass group settings need to be toggled after step 16. Follow the procedure in the video “AWS RoboMaker onto RB3” to change the AWS Greengrass group setting (Default Lambda function containerization) first to “Greengrass Container,” then back to “No Container” and “Redeploy.”

Once the bundle is successfully deployed on Qualcomm Robotics RB5, deployment status in the AWS RoboMaker Dashboard is updated to “Successfully Deployed.”

Running the application

The colcon bundle contains the complete development environment to execute the ROS sample application, including the ROS framework and python (in this case, Kinetic). When the bundle is installed on the Qualcomm Robotics RB5, the workspace is unzipped and installed; however, the dependencies are not installed. (This is a one-time activity.)

If you do not have ROS Kinetic on the Qualcomm Robotics RB5, follow these steps to install it from the colcon bundle:

  1. Download output.tar (the bundle made in the steps above) from S3 bucket to your development host.

  2. adb-push the bundle to the Qualcomm Robotics RB5.

  3. Unzip the bundle. Locate the file dependencies.tar.gz

  4. Create a new folder; for example, /home/RMKinetic

  5. Unzip dependencies.tar.gz to /home/RMKinetic

  6. The folder /home/RMKinetic/dependencies is created, containing all the dependencies needed to run ROS application rotate.

  7. Open /home/RMKinetic/dependencies/setup.sh and append :$BUNDLE_CURRENT_PREFIX/usr/lib/aarch64-linux-gnu to the LD_LIBRARY_PATH environment variable. The result should resemble the following:

    $ export LD_LIBRARY_PATH="$BUNDLE_CURRENT_PREFIX/lib:$BUNDLE_CURRENT_PREFIX/usr/lib:$BUNDLE_CURRENT_PREFIX/lib/x86_64-linux-gnu:$BUNDLE_CURRENT_PREFIX/usr/lib/x86_64-linux-gnu:$BUNDLE_CURRENT_PREFIX/usr/lib/x86_64-linux-gnu/mesa:$LD_LIBRARY_PATH:$BUNDLE_CURRENT_PREFIX/lib/arm-linux-gnueabihf:$BUNDLE_CURRENT_PREFIX/usr/lib/arm-linux-gnueabihf:$BUNDLE_CURRENT_PREFIX/usr/lib/aarch64-linux-gnu"
  8. Source your ROS framework environment as follows:

    1. Set environment variable BUNDLE_CURRENT_PREFIX to /home/RMKinetic/dependencies (assuming that you unzipped dependencies to /home/RMKinetic in step 5 above).

    2. Source setup.sh from /dependencies using this command:

      $ source /home/RMKinetic/dependencies/setup.sh
  9. Overlay the application environment on top of the framework environment.

    1. Go to the folder where bundle was installed. This is usually located under /home/ggc_user/. Greengrass gives this folder a unique (long) name for each deployment (for example, 0123456abcd).

    2. Set BUNDLE_CURRENT_PREFIX to the folder for the latest deployment (Note that the BUNDLE_CURRENT_PREFIX environment variable is being changed again. This is OK.)

      BUNDLE_CURRENT_PREFIX = /home/ggc_user/0123456abcd/
    3. Source the setup.sh in /home/ggc_user/0123456abcd/

      $ source /home/ggc_user/0123456abcd/setup.sh
  10. Run the command roslaunch turtlebot3_bringup turtlebot3_core.launch

  11. Run the deployed application using the command ./rotate

For more information on the colcon bundle and bundle installation, refer to https://github.com/colcon/colcon-bundle.


Qualcomm Robotics RB5 is a product of Qualcomm Technologies, Inc. and/or its subsidiaries.