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

Simulation
----------

The B2W can be simulated using Gazebo.

.. image:: media/gifs/b2_gazebo.webp
    :alt: B2 Gazebo Simulation
    :width: 100%
    :class: mbsrounded

|

.. note::
   ROS 2 Foxy uses Gazebo 11 (classic). For Ignition Gazebo Fortress, please use ROS 2 Humble.

Gazebo Classic Launch
^^^^^^^^^^^^^^^^^^^^^

Launch the B2W in Gazebo 11:

.. code-block:: bash

   ros2 launch b2_gazebo spawn.launch.py

With Z1 arm:

.. code-block:: bash

   export B2_Z1=1
   ros2 launch b2_gazebo spawn.launch.py

World Selection
^^^^^^^^^^^^^^^

Specify a custom world:

.. code-block:: bash

   ros2 launch b2_gazebo spawn.launch.py \
     world:=warehouse.world

Simulation Controls
^^^^^^^^^^^^^^^^^^^

The simulated robot responds to the same topics as the real hardware:

.. code-block:: bash

   # Velocity commands
   ros2 topic pub /b2_unit_001/cmd_vel geometry_msgs/msg/Twist \
     "{linear: {x: 0.5, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"

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

Sensor Simulation
^^^^^^^^^^^^^^^^^

Simulated sensors publish to the same topics as the real robot:

- LiDAR point clouds
- Camera images
- IMU data
- Joint states
