12. Docker April Tags Detection

12.1. Learning Objectives

In this example, we show how to use a ROS docker container to connect to Isaac Sim and run the April Tags tutorial.

Prerequisites

  • If running Isaac Sim locally, follow the Workstation Setup guide on how to download, install and launch Isaac Sim.

  • If running Isaac Sim in a container, follow the Container Deployment guide on how to pull and run the container and begin live streaming

  • Install Rocker to simplify GUI docker support for ROS.

12.2. Setup ROS container

  • Start the ROS container using rocker.

    rocker --nvidia --x11 --privileged --network host  --name ros_container osrf/ros:melodic-desktop-full-bionic
    

    Note

    Here --privileged and --network host let us communicate between the Isaac Sim and ros docker containers, while also allowing us to launch rviz. --name ros_container allows us to refer to the container with a fixed name for this tutorial.

    Note

    VPN might need to be disabled on first run of this command so rocker can properly build the docker container and download/install apt-get dependencies.

  • Copy Isaac Sim ros_workspace folder to running ROS container

    • If running locally via launcher, navigate to the package path shown in the Isaac Sim App Selector and then copy the ros_workspace folder into the container

      docker cp ros_workspace ros_container:/root/ros_workspace
      
    • if running via docker you can copy the ros_workspace folder from the running isaac sim container to a local folder and then into the ROS container

      docker cp isaac-sim:isaac-sim/ros_workspace /tmp/
      docker cp /tmp/ros_workspace ros_container:/root/ros_workspace
      

    Note

    The above commands assume that the Isaac Sim container is named isaac-sim and the ros container is named ros_container which should be the case if no changes are made to the commands when running

  • In the ROS container bash terminal run the following to install dependencies and build the ROS workspace

    cd /root/ros_workspace
    apt-get update
    apt-get install ros-melodic-apriltag-ros
    rosdep install --from-paths src --ignore-src --rosdistro=melodic -y
    source /opt/ros/melodic/setup.sh
    catkin_make
    
  • Open a new terminal and connect to the running ROS container to start the ros master node. The same method can be used to open additional terminals for running more ROS commands

    docker exec -it ros_container bash
    source ~/ros_workspace/devel/setup.sh
    roscore
    

Setup is now complete, next we will run the april tag detection sample

12.3. Detect April Tags

  • In Isaac Sim, either running locally or via the websocket client in the browser connected to the Isaac Sim docker container.

    • Open the April Tag example by going to Isaac Examples -> ROS -> April Tag. Three April Tags will show up in the viewport. Open up the Stage Tree, and you should see a ROS_camera and ROS_PoseTree have already been added.

    • Press Play to start publishing data to ROS

../_images/isaac_ros_apriltag.png
  • In a new terminal start the apriltag detection node

    docker exec -it ros_container bash
    source ~/ros_workspace/devel/setup.sh
    roslaunch isaac_tutorials apriltag_continuous_detection.launch
    

    You should see the following output in this terminal

    process[apriltag_ros_continuous_node-1]: started with pid [2199]
    [ INFO] [1639621422.356067231]: Initializing nodelet with 24 worker threads.
    [ INFO] [1639621422.407887915]: Loaded tag config: 0, size: 0.5, frame_name: tag_0
    [ INFO] [1639621422.407936997]: Loaded tag config: 1, size: 0.5, frame_name: tag_1
    [ INFO] [1639621422.407963206]: Loaded tag config: 2, size: 0.5, frame_name: tag_2
    
  • In a new terminal start rviz to visualize the detections.

    docker exec -it ros_container bash
    source ~/ros_workspace/devel/setup.sh
    cd ~/
    rviz -d ros_workspace/src/isaac_tutorials/rviz/apriltag_config.rviz
    
    ../_images/isaac_ros_apriltag_rviz.png

    The rviz window should appear if there is an accelerated X server on the local machine

  • To see raw data, in a new terminal, echo the detections

    docker exec -it ros_container bash
    source ~/ros_workspace/devel/setup.sh
    rostopic echo tag_detections
    

    And you should see the apriltag detection messages being published

12.4. Summary

This tutorial shows the basics of running a ROS docker image with Isaac Sim.

12.4.1. Next Steps

Continue on to the next tutorial in our ROS Tutorials series, ROS Navigation.

12.4.2. Further Learning