
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_visualwalk
     - Visual walking mode
   * - 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 (safe shutdown position)
   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'}"

   # Set trotting gait
   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'gait_trot'}"

   # Recovery mode
   ros2 service call /b2_unit_001/hardware/modes \
     b2_interface/srv/B2Modes "{request_data: 'recovery'}"

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

**Speed Settings:**

.. code-block:: bash

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

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

**Body Height Settings:**

.. code-block:: bash

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

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

   # High body height
   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>`_.
Running the provided **qre_b2** driver with the low-level commands from Unitree examples should work concurrently.
