Skip to content

ROS2 + Gazebo Example - #40

Open
levlaz wants to merge 2 commits into
mainfrom
ros2_gazebo
Open

levlaz wants to merge 2 commits into
mainfrom
ros2_gazebo

Conversation

@levlaz

@levlaz levlaz commented Sep 11, 2026

Copy link
Copy Markdown

Changelog

This PR adds an updated version of our Gazebo blog post to use ROS2 running inside of Docker so that anyone with any computer can test this out. We also allow you to hook directly up to Foxglove remote access to access gazebo running on a remote computer.

Docs

None

Description

Will be used in support of an upcoming blog post that I am also working on.

@levlaz
levlaz requested a review from msadowski September 11, 2026 22:45

@msadowski msadowski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I love how the whole world loads in Foxglove! I mainly checked the readme and run the simulation. Here are some recommendations:

  1. The depth wrist camera point cloud seems to be rotated about 90 degrees and is not behaving as expected:
Image
  1. I commented on it in the README, but I would drop the references to the old ROS 1 tutorial

  2. I would consider changing the package structure to follow ROS best practices more closely:

integrations/ros2/gazebo/                 # tutorial root (not the ROS package)
  README.md
  docker-compose.yml
  .env.example
  .dockerignore
  docker/
    Dockerfile
    entrypoint.sh
  fg_gazebo_example/                      # the actual ROS 2 package
    package.xml
    CMakeLists.txt
    setup.cfg                             # if you add ament_cmake_python
    fg_gazebo_example/                    # Python package, same name as the ROS pkg
      __init__.py
      teleop_arm_bridge.py                # same code as today
      move_viewpoints.py
    launch/
      simulation.launch.py
      view_robot.launch.py
    urdf/                                 # unchanged
      robot.xacro
      camera_macro.xacro
      static_camera.urdf.xacro
      foxglove_box.urdf
      room.urdf
    meshes/
      foxglove_box.dae
    worlds/
      foxglove_demo.sdf
    models/
      workcell/
    config/
      gazebo_bridge.yaml                  # moved from bridge/
      Gazebo_Tutorial.json                # Foxglove layout, now installed
      view_robot.rviz                     # optional, for view_robot.launch.py
    test/                                 # optional lint/launch tests

Other than that, all looks good! Looking forward to the blog post!


# ROS 2 Gazebo simulation demo

A ROS 2 port of the [ROS 1 Gazebo simulation tutorial](../../ros1/gazebo/README.md). Gazebo Classic (used by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this paragraph. No need to reference the old stuff, let's just say that it targets Gazebo Harmonic and Jazzy Jalisco

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We mention System dependencies lower down, so we can skip mentioning the ROS2 and Gazebo versions here

via the [`ros_gz`](https://github.com/gazebosim/ros_gz) bridge packages, targeting **ROS 2 Jazzy Jalisco**.

This `ament_cmake` package contains launch, URDF/xacro, and world files for a simple simulated robot arm with
a wrist-mounted RGB-D camera and a separate world-fixed RGB camera, plus a Foxglove-branded box for the camera

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the box contains an old logo. Can we see if it can upgrade to the latest one?

to look at. The arm sits on a table inside a warehouse "workcell" building (walls, storage racks, pallets,
a conveyor line, a control panel) reused from
[`warehouse_simulation_toolkit`](https://github.com/wh200720041/warehouse_simulation_toolkit)
(`models/workcell`, BSD-3 licensed -- see `models/workcell/LICENSE`); that toolkit's AGV robot, pedestrian

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove all this text:

that toolkit's AGV robot, pedestrian
actors, and workcell_bin prop model weren't pulled in, since this tutorial's arm replaces the AGV and the
actors use a Gazebo-Classic-only collision plugin that doesn't exist in Gazebo Sim. It's set up to run
headless (no GUI, no GPU) so it can run inside Docker -- including on a Mac, where you'd otherwise have no
way to run Gazebo's GUI or access a GPU -- with the Foxglove desktop app on your host
machine as the UI, connected over foxglove_bridge.

And just mention:

This example runs Gazebo in headless mode to make it more portable and work seamlessly in Docker. We are running foxglove_bridge to visualize the simulation world in Foxglove.

way to run Gazebo's GUI or access a GPU -- with the [Foxglove](https://foxglove.dev/) desktop app on your host
machine as the UI, connected over `foxglove_bridge`.

Differences from the ROS1 tutorial, and why:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the differences. Almost noone cares about ROS1 anymore. Let's treat this tutorial as it's own thing

`robot_state_publisher`, `joint_state_publisher_gui`, `rviz2`, `xacro`, and `foxglove_bridge`.

1. Create a [colcon workspace](https://docs.ros.org/en/jazzy/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html)
2. Clone this repository into the workspace's `src` folder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's ask to only copy the ros2/gazebo directory for a cleaner workspace?

because the Teleop panel always publishes Twist-shaped messages, and the arm's joints expect an absolute
`std_msgs/Float64` angle -- see the comment at the top of `teleop_arm_bridge.py` for the exact field mapping.

**2. Sweep through a few preset viewpoints** (replaces the original's MoveIt-driven `move_viewpoints.py`):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**2. Sweep through a few preset viewpoints** (replaces the original's MoveIt-driven `move_viewpoints.py`):
**2. Sweep through a few preset viewpoints**:

Software rendering is noticeably slower than a GPU, so expect the camera topics to publish at a low framerate --
that's expected, not a bug.

### Remote access

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an awesome idea to include it. Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants