Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Gazebo does not start #368

Open
ooeygui opened this issue Apr 21, 2022 · 2 comments
Open

Gazebo does not start #368

ooeygui opened this issue Apr 21, 2022 · 2 comments
Assignees
Labels
bug Something isn't working Foxy ROS2 ROS2 related issues
Milestone

Comments

@ooeygui
Copy link
Member

ooeygui commented Apr 21, 2022

Describe the bug
With a default foxy chocolatey install, gazebo does not start from the command line using gzserver/gzclient.

Cause
During the build, gazebo sources try to capture the install location during a cmake pass. This install location is set in a variable which is injected directly into a source file. However, it is not escaped. Windows uses backslashes for path separation, which the C++ interpreter will try to escape. you end up with c:ptrosfoxy...

AB#509368

@ooeygui ooeygui added the Foxy label Apr 21, 2022
@ooeygui
Copy link
Member Author

ooeygui commented Apr 21, 2022

This can be worked around by setting the follow environment variables:
set HOME=%HOMEDRIVE%\%HOMEPATH%
set GAZEBO_RESOURCE_PATH=c:\opt\ros\foxy\x64\share\gazebo-10
set GAZEBO_PLUGIN_PATH=c:\opt\ros\foxy\x64\bin

@ooeygui ooeygui self-assigned this Dec 2, 2022
@IoTDan IoTDan added bug Something isn't working ROS2 ROS2 related issues labels Jan 23, 2023
@IoTDan IoTDan added this to the P2 milestone Jan 23, 2023
@anion0278
Copy link

Attempting to start Gazebo 10.2.0 from other drives that C:/ causes it to freeze at spashscreen.

After setting up the env variables:

c:\opt\ros\foxy\x64\share\gazebo\setup.bat
set SDF_PATH=c:\opt\ros\foxy\x64\share\sdformat\1.6

The following errors appear after launching Gazebo via its gazebo_ros launch files:
ros2 launch gazebo_ros gazebo.launch.py
(gzserver is in verbose mode, even though, for some reason, the output shows gzclient in verbose mode):

[Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\gui\GuiIface.cc:526] Unable to save INI file["\Users\Admin\.gazebo\gui.ini"]
W:\colcon_ws>ros2 launch gazebo_ros gazebo.launch.py
[INFO] [launch]: All log files can be found below C:\Users\Admin\.ros\log\2023-02-16-08-28-09-595108-D122-KATEDRA-10428
[INFO] [launch]: Default logging verbosity is set to INFO
KILLING GAZEBO PROCESSES
[INFO] [gzserver-1]: process started with pid [876]
[INFO] [gzclient --verbose  -2]: process started with pid [11316]
[gzserver-1] Gazebo multi-robot simulator, version 10.2.0
[gzserver-1] Copyright (C) 2012 Open Source Robotics Foundation.
[gzserver-1] Released under the Apache 2 License.
[gzserver-1] http://gazebosim.org/
[gzserver-1]
[gzclient --verbose  -2] Gazebo multi-robot simulator, version 10.2.0
[gzclient --verbose  -2] Copyright (C) 2012 Open Source Robotics Foundation.
[gzclient --verbose  -2] Released under the Apache 2 License.
[gzclient --verbose  -2] http://gazebosim.org/
[gzclient --verbose  -2]
[gzclient --verbose  -2] [Msg] Waiting for master.
[gzclient --verbose  -2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345/
[gzclient --verbose  -2] [Msg] Publicized address: 158.196.26.69
[gzclient --verbose  -2] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\gui\GuiIface.cc:526] Unable to save INI file["\Users\Admin\.gazebo\gui.ini"]
[gzclient --verbose  -2] [Wrn] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\gui\GuiIface.cc:297] Couldn't locate specified .ini. Creating file at "\Users\Admin\.gazebo\gui.ini"
[gzclient --verbose  -2] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\gui\GuiIface.cc:308] Unable to read configuration file "\Users\Admin\.gazebo\gui.ini"
[gzserver-1] [Msg] Waiting for master.
[gzserver-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345/
[gzserver-1] [Msg] Publicized address: 158.196.26.69
[gzserver-1] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:388] Unable to initialize sdf
[gzserver-1] [Wrn] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:338] Falling back on worlds/empty.world
[gzserver-1] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:388] Unable to initialize sdf
[gzserver-1] [foonathan::memory] Allocator foonathan::memory::new_allocator (at 0000000000000000) leaked 2432 bytes.
[gzserver-1] [foonathan::memory] Allocator foonathan::memory::heap_allocator (at 0000000000000000) leaked 16376 bytes.
[gzserver-1] [ERROR] [1676532492.544184000] [gazebo.rclcpp]: Error in destruction of rcl subscription handle: failed to remove subscriber, at C:\a\1\s\ws\src\rmw_fastrtps\rmw_fastrtps_shared_cpp\src\subscription.cpp:53, at C:\a\1\s\ws\src\rcl\rcl\src\rcl\subscription.c:243
[gzserver-1] [ERROR] [1676532492.544227700] [gazebo.rclcpp]: Error in destruction of rcl subscription handle: failed to remove subscriber, at C:\a\1\s\ws\src\rmw_fastrtps\rmw_fastrtps_shared_cpp\src\subscription.cpp:53, at C:\a\1\s\ws\src\rcl\rcl\src\rcl\subscription.c:243

After a little investigation, it seems that for Windows systems Gazebo 10 tries to retrieve the location of the settings from HOMEPATH env var https://github.com/gazebosim/gazebo-classic/blob/18b729b39dd6f3c0b8e0edfc0d8e00e25587f356/gazebo/gui/GuiIface.cc#L46

Thus next attempt was to change HOMEPATH to C:/Users/UserName.
However, now gazebo prints errors about initializing SDF 'Unable to initialize sdf':

[Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:388] Unable to initialize sdf
W:\colcon_ws>ros2 launch gazebo_ros gazebo.launch.py
[INFO] [launch]: All log files can be found below C:\Users\Admin\.ros\log\2023-02-16-08-29-03-595093-D122-KATEDRA-9964
[INFO] [launch]: Default logging verbosity is set to INFO
KILLING GAZEBO PROCESSES
[INFO] [gzserver-1]: process started with pid [2376]
[INFO] [gzclient --verbose  -2]: process started with pid [10004]
[gzclient --verbose  -2] Gazebo multi-robot simulator, version 10.2.0
[gzclient --verbose  -2] Copyright (C) 2012 Open Source Robotics Foundation.
[gzclient --verbose  -2] Released under the Apache 2 License.
[gzclient --verbose  -2] http://gazebosim.org/
[gzclient --verbose  -2]
[gzserver-1] Gazebo multi-robot simulator, version 10.2.0
[gzserver-1] Copyright (C) 2012 Open Source Robotics Foundation.
[gzserver-1] Released under the Apache 2 License.
[gzserver-1] http://gazebosim.org/
[gzserver-1]
[gzserver-1] [Msg] Waiting for master.
[gzserver-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345/
[gzserver-1] [Msg] Publicized address: 158.196.26.69
[gzserver-1] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:388] Unable to initialize sdf
[gzserver-1] [Wrn] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:338] Falling back on worlds/empty.world
[gzserver-1] [Err] [C:\a\1\s\ws\src\gazebo\gazebo10\gazebo\Server.cc:388] Unable to initialize sdf
[gzserver-1] [foonathan::memory] Allocator foonathan::memory::new_allocator (at 0000000000000000) leaked 2432 bytes.
[gzserver-1] [foonathan::memory] Allocator foonathan::memory::heap_allocator (at 0000000000000000) leaked 16376 bytes.
[gzserver-1] [ERROR] [1676532546.301026000] [gazebo.rclcpp]: Error in destruction of rcl subscription handle: failed to remove subscriber, at C:\a\1\s\ws\src\rmw_fastrtps\rmw_fastrtps_shared_cpp\src\subscription.cpp:53, at C:\a\1\s\ws\src\rcl\rcl\src\rcl\subscription.c:243
[ERROR] [gzserver-1]: process has died [pid 2376, exit code 3221225477, cmd 'gzserver       --verbose
                                             -s libgazebo_ros_init.so   -s libgazebo_ros_factory.so   -s libgazebo_ros_force_system.so       '].

The root cause of the problem is probably in the Gazebo itself: #386, #363, however, maybe someone knows a solution (besides creating an alias with the first command cd /d C:/) ?

ROS2 Foxy installed according to https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html
Tested on three machines with Win10 - same behaviour.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Foxy ROS2 ROS2 related issues
Projects
None yet
Development

No branches or pull requests

3 participants