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

Robot Mode Control
------------------

The B2W supports various operational modes controlled via ROS 2 services.

**Available Modes:**

.. list-table::
   :header-rows: 1
   :widths: 25 50

   * - Mode
     - Description
   * - damp
     - Damping mode (safe state)
   * - stand_up
     - Stand up from lying position
   * - stand_down
     - Lie down safely
   * - recovery
     - Recovery mode for fault conditions
   * - stop_move
     - Stop all movement
   * - gait_idle
     - Idle gait (standing)
   * - gait_trot
     - Trotting gait
   * - gait_trot_running
     - Running trot gait
   * - gait_flatwalk
     - Flat terrain walking
   * - speed_low / speed_high
     - Speed settings
   * - body_height_low/mid/high
     - Body height settings

**Mode Control Examples:**

.. code-block:: bash

   # Stand up
   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'stand_up'}"

   # Stand down
   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'stand_down'}"

   # Enter damping mode
   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'damp'}"

Speed and Body Height Control
-----------------------------

**Speed Settings:**

.. code-block:: bash

   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'speed_low'}"

   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'speed_high'}"

**Body Height Settings:**

.. code-block:: bash

   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'body_height_low'}"

   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'body_height_mid'}"

   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'body_height_high'}"

Low-Level Control
-----------------

The low-level control for the B2 can be directly accessed via Unitree's provided
examples in their `documentation <https://support.unitree.com/home/en/B2_developer>`_.
