Get Started Guide

  • 2021.3
  • 10/21/2021
  • Public Content

Run a ROS 2 Sample Application in the Docker* Container

Run the Sample Application

  1. To easily start running the containers, the SDK provides the
    run_interactive_docker.sh
    launch tool. Call the script like this:
    $>>./run_interactive_docker.sh usage: Interactive-Mode: ./run_interactive_docker.sh <docker_image:tag> <user> [-c|--container_name <container_name>] [-e|--extra_params <extra_params_to_docker_run_cmd>] Non-Interactive-Mode: ./run_interactive_docker.sh <docker_image:tag> <user> [-s|--script_to_run <script_to_run>] [-c|--container_name <container_name>] [-e|--extra_params <extra_params_to_docker_run_cmd>] user: eiforamr = default user pre-defined inside docker images - sudo access: without passord is already enabled. root = by default all commands should work as root. local = current user is forwarded to docker. sudo access: if given by sys-admin. To avoid password need for sudo commands: /etc/sudoers file should have below entry: <local-user> ALL=(ALL) NOPASSWD:ALL script_to_run: the script to run inside the container (default: interactive bash prompt) If user provides script, it will run in non-interactive mode, i.e. container will exit after running script. container_name: the name of the container (default: amr_sdk_docker) extra_params: User can provide extra parameters to docker run cmd. Example: "--volume \mnt\sdb:\mnt\sdb\ --volume abc:xyz:ro" etc
  2. Go to the
    AMR_containers
    folder and give permissions to run the interactive Docker script:
    cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_<version>/AMR_containers
    Where the
    <version>
    string is similar to:
    2021.3
    as shown below:
    cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_2021.3/AMR_containers sudo chmod 755 run_interactive_docker.sh
  3. Run a ROS 2 sample application inside the EI for AMR Docker container.
    Run the command below to start the Docker container:
    ./run_interactive_docker.sh amr-ubuntu2004-full-flavour-sdk:<TAG> eiforamr
    Where the
    <TAG>
    string is similar to:
    2021.3
    as shown below:
    ./run_interactive_docker.sh amr-ubuntu2004-full-flavour-sdk:2021.3 eiforamr
    When Docker* opens successfully, you should see the below messages.
    If you encounter the following error, see Troubleshooting.
  4. Run the turtlesim ROS 2 sample application:
    ros2 run turtlesim turtlesim_node & ros2 topic list
    As a result, the turtlesim app is opened. The console output contains the available topics for the turtle:
    /turtle1/cmd_vel /turtle1/color_sensor /turtle1/pose
  5. Run the rqt application and control the turtle via rqt.
    rqt & ros2 run turtlesim turtlesim_node &
  6. Go to
    Plugins > Services > Service Caller
    : Choose to move turtle1 by choosing (from the Service drop-down list ): /turtle1/teleport_absolute and make sure you changed x and y coordinates for the original values. Press
    Call
    . The turtle should have moved. Close the service caller window by pressing the “
    x
    ” button. Then press
    CTRL+C
    .

Troubleshooting

If you encounter the preceding error when trying to open one of the Docker* images (for the full_flavour image):
cd AMR_containers/ sudo chmod +x amr_ubuntu2004_full_flavour_sdk_env/docker_entrypoint.sh docker build --build-arg base_image=amr-ubuntu2004-openvino-sdk:2021.3 --build-arg http_proxy=<http_proxy> --build-arg https_proxy=<https_proxy> --tag amr-ubuntu2004-full-flavour-sdk:2021.3 --file amr_ubuntu2004_full_flavour_sdk_env/Dockerfile amr_ubuntu2004_full_flavour_sdk_env
This process does not rebuild the image and finishes in under five minutes.
Verify that it now works:
./run_interactive_docker.sh amr-ubuntu2004-full-flavour-sdk:2021.3 eiforamr
The same logic works if you encounter the preceding error when trying to open one of the other Docker* images.
For amr_ubuntu2004_ros2_foxy_sdk_env:
cd AMR_containers/ sudo chmod +x amr_ubuntu2004_ros2_foxy_sdk_env/docker_entrypoint.sh docker build --tag amr-ubuntu2004-ros2-foxy-sdk:2021.3 --build-arg http_proxy=<http_proxy> --build-arg https_proxy=<https_proxy> --no-cache --file amr_ubuntu2004_ros2_foxy_sdk_env/Dockerfile amr_ubuntu2004_ros2_foxy_sdk_env
For amr_ubuntu2004_openvino_sdk_env:
cd AMR_containers/ sudo chmod +x amr_ubuntu2004_openvino_sdk_env/docker_entrypoint.sh docker build --build-arg base_image=amr-ubuntu2004-ros2-foxy-sdk:2021.3 --tag amr-ubuntu2004-openvino-sdk:2021.3 --build-arg http_proxy=<http_proxy> --build-arg https_proxy=<https_proxy> --file amr_ubuntu2004_openvino_sdk_env/Dockerfile amr_ubuntu2004_openvino_sdk_env

Summary and Next Steps

In this tutorial, you learned how to run a ROS 2 sample application inside the AMR Docker container, start the rqt application, and control the turtle using rqt.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.