Make the Gazebo GUI work on macOS and keep the robot upright - #27
Merged
Conversation
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.
Mael-RABOT
approved these changes
Sep 1, 2026
m-brl
approved these changes
Sep 1, 2026
|
|
||
| <gazebo> | ||
| <plugin filename="libmock_sensor.so" name="mock_sensor::MockSensorSystem"> | ||
| <plugin filename="mock_sensor" name="mock_sensor::MockSensorSystem"> |
Arcod7
commented
Sep 1, 2026
| <gazebo reference="base_node"> | ||
| <static>true</static> | ||
| </gazebo> | ||
| <!-- Anchor the stand to the world so the robot does not fall over. |
Arcod7
commented
Sep 1, 2026
| # 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 |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OP#188
Three separate reasons the simulator never appeared on macOS.
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 simcurrently only works with either the -s argumentor 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 -gas a second, delayed process.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
worldlink 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).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.