.. _isaac_sim_app_tutorial_ros_docker_apriltag: =============================== Docker April Tags Detection =============================== Learning Objectives ======================= In this example, we show how to use a ROS docker container to connect to |isaac-sim_short| and run the :ref:`isaac_sim_app_tutorial_ros_apriltag` tutorial. **Prerequisites** - If running |isaac-sim_short| locally, follow the :ref:`isaac_sim_install_basic_requirements` guide on how to download, install and launch |isaac-sim_short|. - If running |isaac-sim_short| in a container, follow the :ref:`isaac_sim_setup_remote_headless_container` guide on how to pull and run the container and begin live streaming - Install `Rocker `_ to simplify GUI docker support for ROS. Setup ROS container =================== - Start the ROS container using rocker. .. code-block:: bash rocker --nvidia --x11 --privileged --network host --name ros_container osrf/ros:noetic-desktop-full-focal .. note:: Here ``--privileged`` and ``--network host`` let us communicate between the |isaac-sim_short| 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_short| ``noetic_ws`` folder to running ROS container. Assuming you've already cloned Isaac Sim ROS Workspace Repository from `here `_, navigate to the repository: .. code-block:: bash docker cp noetic_ws ros_container:/root/noetic_ws .. note:: The above commands assume that 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 .. code-block:: bash cd /root/noetic_ws apt-get update apt-get install ros-noetic-apriltag-ros rosdep install --from-paths src --ignore-src --rosdistro=noetic -y source /opt/ros/noetic/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 .. code-block:: bash docker exec -it ros_container bash source ~/noetic_ws/devel/setup.sh roscore Setup is now complete, next we will run the april tag detection sample Detect April Tags ============================= - In |isaac-sim_short|, either running locally or via the websocket client in the browser connected to the |isaac-sim_short| 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 then open the ActionGraph by right-clicking on the prim and selecting `Open Graph`. The ROS Clock publisher, TF publisher and Camera Helper nodes (for initiating the `camera_info` and `rgb` image publishers) should already be setup. - Press Play to start publishing data to ROS .. figure:: /content/images/isaac_ros_apriltag.png :align: center - In a new terminal start the apriltag detection node .. code-block:: bash docker exec -it ros_container bash source ~/noetic_ws/devel/setup.sh roslaunch isaac_tutorials apriltag_continuous_detection.launch You should see the following output in this terminal .. code-block:: bash 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. .. code-block:: bash docker exec -it ros_container bash source ~/noetic_ws/devel/setup.sh cd ~/ rviz -d noetic_ws/src/isaac_tutorials/rviz/apriltag_config.rviz .. figure:: /content/images/isaac_ros_apriltag_rviz.png :align: center 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 .. code-block:: bash docker exec -it ros_container bash source ~/noetic_ws/devel/setup.sh rostopic echo tag_detections And you should see the apriltag detection messages being published Summary ======================= This tutorial shows the basics of running a ROS docker image with |isaac-sim_short|. Next Steps ^^^^^^^^^^^^^^^^^^^^^^ Continue on to the next tutorial in our ROS Tutorials series, :ref:`isaac_sim_app_tutorial_ros_quadruped_vio`. Further Learning ^^^^^^^^^^^^^^^^^^^^^^ - More on `April Tags with ROS `_ - If you wish to attach your own April Tag to objects, instructions are in :ref:`isaac_sim_app_asset_april_tag` - For a full guide on ROS GUI docker usage see `this tutorial `_