
.. warning::
   ROS 2 Foxy Fitzroy reached end-of-life in June 2023. We recommend upgrading to ROS 2 Humble for continued support.

Z1 Arm Control
--------------

.. important::
   **EXPERIMENTAL:** The Z1 driver is under active development.

If your B2W is equipped with the Unitree Z1 arm:

**Enable the arm:**

.. code-block:: bash

   ros2 service call /b2_unit_001/z1/enable std_srvs/srv/Trigger

**Send trajectory command:**

.. code-block:: bash

   ros2 topic pub --once /b2_unit_001/z1/joint_trajectory \
     trajectory_msgs/msg/JointTrajectory "{
       joint_names: ['joint1', 'joint2', 'joint3',
         'joint4', 'joint5', 'joint6', 'jointGripper'],
       points: [{
         positions: [0.0, 1.57, -1.57, 0.0, 0.0, 0.0, 0.0],
         time_from_start: {sec: 3, nanosec: 0}
       }]
     }"

**Disable the arm:**

.. code-block:: bash

   ros2 service call /b2_unit_001/z1/disable std_srvs/srv/Trigger

Topics and Services
^^^^^^^^^^^^^^^^^^^

.. list-table::
   :header-rows: 1
   :widths: 30 35 25

   * - Name
     - Type
     - Description
   * - z1/joint_states
     - sensor_msgs/JointState
     - Joint positions, velocities, efforts
   * - z1/joint_trajectory
     - trajectory_msgs/JointTrajectory
     - Trajectory commands
   * - z1/enable
     - std_srvs/Trigger
     - Enable arm control
   * - z1/disable
     - std_srvs/Trigger
     - Disable arm

URDF Integration
^^^^^^^^^^^^^^^^

Enable Z1 in the robot description:

.. code-block:: bash

   export B2_Z1=1
   ros2 launch b2_description display.launch.py
