Skip to content

Make the Gazebo GUI work on macOS and keep the robot upright - #27

Merged
Arcod7 merged 1 commit into
feat-pixifrom
aes/macos-gazebo
Sep 1, 2026
Merged

Make the Gazebo GUI work on macOS and keep the robot upright#27
Arcod7 merged 1 commit into
feat-pixifrom
aes/macos-gazebo

Conversation

@Arcod7

@Arcod7 Arcod7 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

OP#188

Three separate reasons the simulator never appeared on macOS.

  1. gz sim refuses to run server and GUI in one process. Cocoa requires the Qt GUI on the main thread, so the ruby entry point exits(-1) unless given -s or -g (Ign gazebo render window does not work in same process as server on macOS gazebosim/gz-sim#44):

    On macOS gz sim currently only works with either the -s argument
    or the -g argument, you cannot run both server and gui in one terminal.

    The launch passed plain "-r ", so the server died instantly and the spawner sat in an endless "Requesting list of worlds" loop. On Darwin, run the server with -s and start gz sim -g as a second, delayed process.

  2. The robot lay on the ground. true does not survive urdf->sdf conversion — sdformat honours on the model, not on a link — so the stand stayed dynamic, and the robot was spawned at -z 0.5, in midair. Gravity did the rest. Anchor base_node to a world link with a fixed joint and spawn at -z 0.0. Upper body joints stay dynamic. The file is included only under use_gazebo_sim:=true, so the real/mock TF tree is untouched (verified: the world link appears in the sim description and not in the mock one).

  3. filename="libmock_sensor.so" is hardcoded, but the plugin builds as libmock_sensor.dylib on macOS. A bare "mock_sensor" lets Gazebo resolve the platform extension, which is the usual convention for gz plugins anyway.

Verified end to end: server and GUI both alive, spawner loop gone (8+ retries to 0), and the model reports Pose XYZ [0 0 0] RPY [0 -0 0] with the GUI rendering the robot standing on its stand.

Three separate reasons the simulator never appeared on macOS.

1. gz sim refuses to run server and GUI in one process. Cocoa requires the Qt
   GUI on the main thread, so the ruby entry point exits(-1) unless given -s or
   -g (gazebosim/gz-sim#44):

     On macOS `gz sim` currently only works with either the -s argument
     or the -g argument, you cannot run both server and gui in one terminal.

   The launch passed plain "-r <world>", so the server died instantly and the
   spawner sat in an endless "Requesting list of worlds" loop. On Darwin, run
   the server with -s and start `gz sim -g` as a second, delayed process.

2. The robot lay on the ground. <gazebo reference="base_node"><static>true
   </static></gazebo> does not survive urdf->sdf conversion — sdformat honours
   <static> on the model, not on a link — so the stand stayed dynamic, and the
   robot was spawned at -z 0.5, in midair. Gravity did the rest. Anchor
   base_node to a `world` link with a fixed joint and spawn at -z 0.0. Upper
   body joints stay dynamic. The file is included only under
   use_gazebo_sim:=true, so the real/mock TF tree is untouched (verified: the
   world link appears in the sim description and not in the mock one).

3. filename="libmock_sensor.so" is hardcoded, but the plugin builds as
   libmock_sensor.dylib on macOS. A bare "mock_sensor" lets Gazebo resolve the
   platform extension, which is the usual convention for gz plugins anyway.

Verified end to end: server and GUI both alive, spawner loop gone (8+ retries to
0), and the model reports Pose XYZ [0 0 0] RPY [0 -0 0] with the GUI rendering
the robot standing on its stand.
@Arcod7 Arcod7 self-assigned this Sep 1, 2026

<gazebo>
<plugin filename="libmock_sensor.so" name="mock_sensor::MockSensorSystem">
<plugin filename="mock_sensor" name="mock_sensor::MockSensorSystem">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A tester

<gazebo reference="base_node">
<static>true</static>
</gazebo>
<!-- Anchor the stand to the world so the robot does not fall over.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment too long

Comment thread launch/gazebo.launch.py
# When headless: server-only (-s) with EGL rendering (--headless-rendering)
# so OGRE2 still renders camera sensors without an X display. Otherwise:
# normal GUI launch.
# macOS cannot run the gz server and the Qt GUI in one process: Cocoa needs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment too long

@Arcod7
Arcod7 merged commit f83f818 into feat-pixi Sep 1, 2026
1 check passed
@Arcod7
Arcod7 deleted the aes/macos-gazebo branch September 1, 2026 15:37
Arcod7 added a commit that referenced this pull request Sep 7, 2026
* fix(gazebo): NixOS EGL env, spawn delay, and conditional GPU setup

Signed-off-by: Charles Madjeri <80175305+charlesmadjeri@users.noreply.github.com>

* Merge pull request #27 from Sentience-Robotics/aes/macos-gazebo

Make the Gazebo GUI work on macOS and keep the robot upright

---------

Signed-off-by: Charles Madjeri <80175305+charlesmadjeri@users.noreply.github.com>
Co-authored-by: Charles Madjeri <80175305+charlesmadjeri@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants