Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ign gazebo render window does not work in same process as server on macOS #44

Open
osrf-migration opened this issue Dec 10, 2019 · 6 comments
Labels
bug Something isn't working GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering

Comments

@osrf-migration
Copy link

Original report (archived issue) by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:

Description

The ign gazebo render window (scene3d plugin) fails to render the scene on macOS.

This is likely a QtQuick + Ogre2 integration issue.

Steps to Reproduce

  1. Run ign gazebo on macOS

Expected behavior:

See the 3D scene in the render window

Actual behavior:

Nothing is rendered

Reproduces how often:

All the time

Versions

All versions

@osrf-migration osrf-migration added major bug Something isn't working labels Apr 15, 2020
@chapulina chapulina added GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering and removed major labels Apr 29, 2020
@scpeters
Copy link
Member

Here's some more info with macOS 10.14 (mojave) and blueprint:

# use brew ruby instead of disabling SIP
$ export PATH=/usr/local/opt/ruby/bin:$PATH
$ ign gazebo -s -v
[Msg] Ignition Gazebo Server v2.25.0
[Msg] Loading default world.
[Msg] Create service on [/world/default/create]
[Msg] Remove service on [/world/default/remove]
[Msg] Pose service on [/world/default/set_pose]
[Msg] Loaded level [3]
[Msg] Serving world controls on [/world/default/control] and [/world/default/playback/control]
[Msg] Serving GUI information on [/world/default/gui/info]
[Msg] World [default] initialized with [default_physics] physics profile.
[Msg] Serving world SDF generation service on [/world/default/generate_world_sdf]
[Msg] Serving world names on [/gazebo/worlds]
[Msg] Resource path interfaces on [/gazebo/resource_paths/add], [/gazebo/resource_paths/get], and [/gazebo/resource_paths].
[Msg] Found no publishers on /stats, adding root stats topic
[Msg] Found no publishers on /clock, adding root clock topic
[Msg] Serving scene information on [/world/default/scene/info]
[Msg] Serving graph information on [/world/default/scene/graph]
[Msg] Serving full state on [/world/default/state]
[Msg] Publishing scene information on [/world/default/scene/info]
[Msg] Publishing entity deletions on [/world/default/scene/deletion]
[Msg] Publishing state changes on [/world/default/state]
[Msg] Publishing pose messages on [/world/default/pose/info]
[Msg] Publishing dynamic pose messages on [/world/default/dynamic_pose/info]
[Wrn] [Component.hh:144] Trying to serialize component with data type [N3sdf2v85WorldE], which doesn't have `operator<<`. Component will not be serialized.

in a separate terminal:

# use brew ruby instead of disabling SIP
$ export PATH=/usr/local/opt/ruby/bin:$PATH
$ ign gazebo -g -v
[Msg] Ignition Gazebo GUI    v2.25.0
[GUI] [Wrn] [Application.cc:649] [QT] Populating font family aliases took 916 ms. Replace uses of missing font family "Roboto" with one that exists to avoid this cost. 
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] qrc:/qml/StyleDialog.qml:112:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] qrc:/qml/StyleDialog.qml:105:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] qrc:/qml/StyleDialog.qml:98:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] qrc:qml/Main.qml:75:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] qrc:/qml/PluginMenu.qml:23:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Wrn] [Application.cc:649] [QT] file::/Gazebo/GazeboDrawer.qml:237:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Msg] Loading config [/Users/scpeters/.ignition/gazebo/gui.config]
[GUI] [Wrn] [Application.cc:649] [QT] file::/GzScene3D/GzScene3D.qml:58:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Msg] Transform mode service on [/gui/transform_mode]
[GUI] [Msg] Record video service on [/gui/record_video]
[GUI] [Msg] Move to service on [/gui/move_to]
[GUI] [Msg] Follow service on [/gui/follow]
[GUI] [Msg] View angle service on [/gui/view_angle]
[GUI] [Msg] Added plugin [3D View] to main window
[GUI] [Msg] Loaded plugin [GzScene3D] from path [/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ign-gazebo-2/plugins/gui/libGzScene3D.dylib]
[GUI] [Wrn] [Application.cc:649] [QT] file::/WorldControl/WorldControl.qml:30:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:649] [QT] file::/WorldControl/WorldControl.qml:88:3: QML RoundButton: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
[GUI] [Msg] Using world control service [/world/default/control]
[GUI] [Msg] Listening to stats on [/world/default/stats]
[GUI] [Msg] Added plugin [World control] to main window
[GUI] [Msg] Loaded plugin [WorldControl] from path [/usr/local/Cellar/ignition-gui2/2.3.3_1/lib/ign-gui-2/plugins/libWorldControl.dylib]
[GUI] [Msg] Listening to stats on [/world/default/stats]
[GUI] [Msg] Added plugin [World stats] to main window
[GUI] [Msg] Loaded plugin [WorldStats] from path [/usr/local/Cellar/ignition-gui2/2.3.3_1/lib/ign-gui-2/plugins/libWorldStats.dylib]
[GUI] [Wrn] [Application.cc:649] [QT] file::/TransformControl/TransformControl.qml:26:1: QML TransformControl (parent or ancestor of Material): Binding loop detected for property "foreground"
[GUI] [Wrn] [Application.cc:649] [QT] file::/TransformControl/TransformControl.qml:26:1: QML TransformControl (parent or ancestor of Material): Binding loop detected for property "foreground"
[GUI] [Msg] Added plugin [Transform control] to main window
[GUI] [Msg] Loaded plugin [TransformControl] from path [/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ign-gazebo-2/plugins/gui/libTransformControl.dylib]
[GUI] [Wrn] [Application.cc:649] [QT] file::/Shapes/Shapes.qml:25:1: QML Shapes (parent or ancestor of Material): Binding loop detected for property "foreground"
[GUI] [Wrn] [Application.cc:649] [QT] file::/Shapes/Shapes.qml:25:1: QML Shapes (parent or ancestor of Material): Binding loop detected for property "foreground"
[GUI] [Msg] Added plugin [Shapes] to main window
[GUI] [Msg] Loaded plugin [Shapes] from path [/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ign-gazebo-2/plugins/gui/libShapes.dylib]
[GUI] [Msg] Added plugin [Component inspector] to main window
[GUI] [Msg] Loaded plugin [ComponentInspector] from path [/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ign-gazebo-2/plugins/gui/libComponentInspector.dylib]
[GUI] [Wrn] [Application.cc:649] [QT] file:///usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls/TableViewColumn.qml:66:1: QML TableViewColumn: Accessible must be attached to an Item
[GUI] [Msg] Added plugin [Entity tree] to main window
[GUI] [Msg] Loaded plugin [EntityTree] from path [/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ign-gazebo-2/plugins/gui/libEntityTree.dylib]
[GUI] [Wrn] [Application.cc:649] [QT] file::/ComponentInspector/Vector3d.qml:93:9: QML Image: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
[GUI] [Wrn] [Application.cc:649] [QT] file::/WorldStats/WorldStats.qml:53:3: QML RowLayout: Binding loop detected for property "x"
[GUI] [Wrn] [Application.cc:649] [QT] file::/WorldControl/WorldControl.qml:88:3: QML RoundButton: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
[GUI] [Wrn] [Application.cc:649] [QT] Could not create NSOpenGLContext with shared context, falling back to unshared context.
/usr/local/Cellar/ignition-gazebo2/2.25.0/lib/ruby/ignition/cmdgazebo2.rb:388: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

I've copied a portion of the Crash Report to the following gist:

@scpeters
Copy link
Member

I think the key line is:

[GUI] [Wrn] [Application.cc:649] [QT] Could not create NSOpenGLContext with shared context, falling back to unshared context.

@scpeters
Copy link
Member

scpeters commented Dec 9, 2020

I'm proposing to disable ign gazebo and ign gazebo -g on macOS in #477, so that only ign gazebo -s would be allowed, since the other commands are broken.

scpeters added a commit to scpeters/ign-gazebo that referenced this issue Dec 15, 2020
@srmainwaring
Copy link
Contributor

ign gazebo can be made to work on macOS (gazebosim/gz-gui#145 (comment)) but there are some caveats and a bit of work will be required to support it fully.

I've been working through the list of examples worlds in ign-gazebo/examples/worlds. Many work well on macOS but others fail and the reasons fall into a few general patterns.

  1. Running a combined server and gui session does not work on macOS (and probably won't on windows either)

    This is because cmdgazebo.rb uses Process.fork which has been disabled on macOS and doesn't work on windows.
    An alternative that will work on all platforms is to use Process.spawn but this will involve some work.

  2. Issues with using the ogre2 render engine (when set in the gui.config and world sdf files)

    To get ign gazebo running on macOS the QSurfaceFormat needs to be set to use OpenGL 4.1. In Scene3D there is a
    conditional check for ogre2 that attempts to reset the surface format and this will conflict with the global default which
    needs to be set in the main application (before any windows are created). If the ogre render engine is selected, but is not
    available then the gui will work because the code resetting the surface format is not called and the fall back to ogre2
    happens after this. A solution is to remove the conditional check if the global default is set.

  3. Issues with camera sensors and so on:

    These are arising because the camera sensors and other plugins that require another renderer to be created (RTT etc) are
    requesting a new render window on a non-main thread. This causes a hard crash on macOS. The solution is to ensure all
    such calls are run from the main thread. It will take further investigation to understand how much work will be involved to
    implement this.

@traversaro
Copy link
Contributor

fyi @wolfv @Tobias-Fischer

@scpeters scpeters changed the title Ign gazebo render window does not work on macOS Ign gazebo render window does not work in same process as server on macOS Oct 29, 2022
@scpeters
Copy link
Member

the gz sim error message was updated in #1225 to indicate that the server and gui can only be run from separate processes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering
Projects
None yet
Development

No branches or pull requests

5 participants