|
1 | 1 | How To Command Simulated Isaac Robot |
2 | 2 | ==================================== |
3 | 3 |
|
4 | | -This How To Guide has been moved, please see the `updated tutorial <https://moveit.picknik.ai/main/doc/how_to_guides/isaac_panda/isaac_panda_tutorial.html>`_. |
| 4 | +This tutorial requires a machine with ``Isaac Sim 4.5`` (recommended) or higher installed. |
| 5 | +For Isaac Sim requirements and installation please see the `Omniverse documentation <https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/requirements.html>`_. |
| 6 | +To configure Isaac Sim to work with ROS 2 please see `this guide <https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/install_ros.html#>`_. |
| 7 | + |
| 8 | +This tutorial has the following assumptions on system configuration: |
| 9 | + |
| 10 | +1. NVIDIA Isaac Sim is installed in the default location. Docker based installations of Isaac sim are also supported but it is up to the user to configure the system. |
| 11 | +2. Docker is installed. |
| 12 | + If you plan to use your GPU with MoveIt, you will need to install `nvidia-docker <https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-on-ubuntu-and-debian>`_. |
| 13 | +3. You clone this repo so that you can build a Ubuntu 22.04 Humble based Docker image that can communicate with Isaac and run this tutorial. |
| 14 | + |
| 15 | +Introduction to ros2_control |
| 16 | +---------------------------- |
| 17 | + |
| 18 | +One of the recommended ways to execute trajectories calculated by MoveIt is to use the `ros2_control <https://control.ros.org/master/index.html>`_ |
| 19 | +framework to manage and communicate with your robot, real or simulated. It comes highly recommended because it offers a developers a common API that |
| 20 | +allows your software to switch between many different robot types, and the sensors they have built in, by simply changing some launch arguments. |
| 21 | +For example if we inspect the Panda Robot's ``ros2_control.xacro`` we can see it uses a flag ``use_fake_hardware`` to switch between being |
| 22 | +simulated or connecting to a physical robot. |
| 23 | + |
| 24 | +.. code-block:: XML |
| 25 | +
|
| 26 | + <hardware> |
| 27 | + <xacro:if value="${use_fake_hardware}"> |
| 28 | + <plugin>mock_components/GenericSystem</plugin> |
| 29 | + </xacro:if> |
| 30 | + <xacro:unless value="${use_fake_hardware}"> |
| 31 | + <plugin>franka_hardware/FrankaHardwareInterface</plugin> |
| 32 | + <param name="robot_ip">${robot_ip}</param> |
| 33 | + </xacro:unless> |
| 34 | + </hardware> |
| 35 | +
|
| 36 | +
|
| 37 | +`Hardware Components <https://control.ros.org/master/doc/getting_started/getting_started.html#hardware-components>`_ |
| 38 | +can be of different types, but the plugin ``<plugin>mock_components/GenericSystem</plugin>`` is very a simple ``System`` |
| 39 | +that forwards the incoming ``command_interface`` values to the tracked ``state_interface`` of the joints (i.e., perfect control of the simulated joints). |
| 40 | + |
| 41 | +For us to expand our Panda robot to Isaac Sim we first have to introduce `topic_based_ros2_control <https://github.com/PickNikRobotics/topic_based_ros2_control>`_. |
| 42 | +This Hardware Interface is a ``System`` that subscribes and publishes on configured topics. |
| 43 | +For this tutorial the topic ``/isaac_joint_states`` will contain the robot's current state and ``/isaac_joint_commands`` will be used to actuate it. |
| 44 | +The `moveit_resources_panda_moveit_config <https://github.com/moveit/moveit_resources/blob/humble/panda_moveit_config/config/panda.ros2_control.xacro#L7>`_ |
| 45 | +we are using in this tutorial does not support connecting to hardware, so our ``ros2_control.xacro`` is now |
| 46 | +updated to load the ``TopicBasedSystem`` plugin when the flag ``ros2_control_hardware_type`` is set to ``isaac``. |
| 47 | + |
| 48 | +.. code-block:: XML |
| 49 | +
|
| 50 | + <xacro:if value="${ros2_control_hardware_type == 'mock_components'}"> |
| 51 | + <plugin>mock_components/GenericSystem</plugin> |
| 52 | + </xacro:if> |
| 53 | + <xacro:if value="${ros2_control_hardware_type == 'isaac'}"> |
| 54 | + <plugin>topic_based_ros2_control/TopicBasedSystem</plugin> |
| 55 | + <param name="joint_commands_topic">/isaac_joint_commands</param> |
| 56 | + <param name="joint_states_topic">/isaac_joint_states</param> |
| 57 | + </xacro:if> |
| 58 | +
|
| 59 | +In this tutorial we have included a Python script that loads a Panda robot |
| 60 | +and builds an `OmniGraph <https://docs.isaacsim.omniverse.nvidia.com/5.1.0/introduction/quickstart_isaacsim_robot.html>`_ |
| 61 | +to publish and subscribe to the ROS topics used to control the robot. |
| 62 | +The OmniGraph also contains nodes to publish RGB and Depth images from the camera mounted on the hand of the Panda. |
| 63 | +The RGB image is published to the topic ``/rgb``, the camera info to ``/camera_info``, and the depth image to ``/depth``. |
| 64 | +The frame ID of the camera frame is ``/sim_camera``. |
| 65 | +To learn about configuring your Isaac Sim robot to communicate with ROS 2 please see the |
| 66 | +`Joint Control tutorial https://docs.isaacsim.omniverse.nvidia.com/latest/ros2_tutorials/tutorial_ros2_manipulation.html>`_ |
| 67 | +on Omniverse. |
| 68 | + |
| 69 | +Computer Setup |
| 70 | +-------------- |
| 71 | + |
| 72 | +1. Install `Isaac Sim <https://docs.isaacsim.omniverse.nvidia.com/5.1.0/installation/quick-install.html>`_. |
| 73 | + |
| 74 | +2. Perform a shallow clone of the MoveIt 2 Tutorials repo. |
| 75 | + |
| 76 | +.. code-block:: bash |
| 77 | +
|
| 78 | + git clone https://github.com/moveit/moveit2_tutorials.git -b main |
| 79 | +
|
| 80 | +3. Go to the folder in which you cloned the tutorials and then switch to the following directory. |
| 81 | + |
| 82 | +.. code-block:: bash |
| 83 | +
|
| 84 | + cd moveit2_tutorials/doc/how_to_guides/isaac_panda |
| 85 | +
|
| 86 | +4. Build the Docker image. This docker image also contains ``pytorch``. |
| 87 | + |
| 88 | +.. code-block:: bash |
| 89 | +
|
| 90 | + docker compose build base |
| 91 | +
|
| 92 | +
|
| 93 | +Running the MoveIt Interactive Marker Demo with Mock Components |
| 94 | +--------------------------------------------------------------- |
| 95 | + |
| 96 | +This section tests out the ``mock_components/GenericSystem`` hardware interface, as opposed to using Isaac Sim. |
| 97 | + |
| 98 | +1. To test out the ``mock_components/GenericSystem`` hardware interface run: |
| 99 | + |
| 100 | +.. code-block:: bash |
| 101 | +
|
| 102 | + docker compose up demo_mock_components |
| 103 | +
|
| 104 | +This will open up RViz with the Panda robot using ``mock_components`` to simulate the robot and execute trajectories. |
| 105 | + |
| 106 | +Please see the :doc:`Quickstart in RViz </doc/tutorials/quickstart_in_rviz/quickstart_in_rviz_tutorial>` |
| 107 | +tutorial if this is your first time using MoveIt with RViz. |
| 108 | + |
| 109 | +After you are done testing press ``Ctrl+C`` in the terminal to stop the container. |
| 110 | + |
| 111 | +Running the MoveIt Interactive Marker Demo with Isaac Sim |
| 112 | +--------------------------------------------------------- |
| 113 | + |
| 114 | +1. On the host computer, go to the tutorials launch directory. |
| 115 | + |
| 116 | +.. code-block:: bash |
| 117 | +
|
| 118 | + cd moveit2_tutorials/doc/how_to_guides/isaac_panda/launch |
| 119 | +
|
| 120 | +2. Then run the following command to load the Panda Robot pre-configured to work with this tutorial. |
| 121 | + |
| 122 | +.. note:: This step assumes that a compatible version of Isaac Sim is installed on the host in the ``$HOME/isaacsim`` directory for Isaac Sim 4.5 or in the ``$HOME/.local/share/ov/pkg/`` directory for Isaac Sim 4.2 and older. |
| 123 | + This step also takes a few minutes to download the assets and setup Isaac Sim so please be |
| 124 | + patient and don't click the ``Force Quit`` dialog that pops up while the simulator starts. |
| 125 | + |
| 126 | +.. code-block:: bash |
| 127 | +
|
| 128 | + ./python.sh isaac_moveit.py |
| 129 | +
|
| 130 | +3. From the ``moveit2_tutorials/doc/how_to_guides/isaac_panda`` directory start a container that connects to Isaac Sim using the ``topic_based_ros2_control/TopicBasedSystem`` hardware interface. |
| 131 | + |
| 132 | +.. code-block:: bash |
| 133 | +
|
| 134 | + docker compose up demo_isaac |
| 135 | +
|
| 136 | +This will open up RViz with the Panda robot using the ``TopicBasedSystem`` interface to communicate with the simulated robot and execute trajectories. |
| 137 | + |
| 138 | +.. raw:: html |
| 139 | + |
| 140 | + <div style="position: relative; padding-bottom: 5%; height: 0; overflow: hidden; max-width: 100%; height: auto;"> |
| 141 | + <iframe width="700px" height="400px" src="https://www.youtube.com/embed/EiLaJ7e4M-4" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> |
| 142 | + </div> |
0 commit comments