PX4 Sitl Gazebo hangs

Hi all. I’m having trouble getting “make px4_sitl gazebo” to run. Everything compiles fine, but gazebo hangs on launch. The gazebo launcher says “Preparing your world” and the gazebo gui screen is black. The terminal output is attached at the bottom.

Some things to note:
Operating System Ubuntu 18.04
ecl/EKF never starts, which may be related to the problem
running “gazebo” by itself works (pulls open an empty world)
I echoed a couple path variables at the start of the output - i believe they are set correctly.

`asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ echo $ROS_PACKAGE_PATH
/home/asl/catkin_ws/src/mavlink:/home/asl/catkin_ws/src/mavros/libmavconn:/home/asl/catkin_ws/src/mavros/mavros_msgs:/home/asl/catkin_ws/src/covid/covid_slam:/home/asl/catkin_ws/src/mavros/mavros:/home/asl/catkin_ws/src/mavros/mavros_extras:/home/asl/catkin_ws/src/covid/Firmware:/home/asl/catkin_ws/src/covid/robot_localization:/home/asl/catkin_ws/src/mavros/test_mavros:/home/asl/catkin_ws/src/covid/trajectory_gen:/opt/ros/melodic/share:/home/asl/catkin_ws/src/covid/Firmware:/home/asl/catkin_ws/src/covid/Firmware/Tools/sitl_gazebo:/home/asl/catkin_ws/src/covid/Firmware/Tools/sitl_gazebo/models/rotors_description
asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ echo $GAZEBO_MODEL_PATH
:/home/asl/catkin_ws/src/covid/Firmware/Tools/sitl_gazebo/models
asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ echo $GAZEBO_RESOURCE_PATH

asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ echo $GAZEBO_PLUGIN_PATH
:/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo
asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ echo $LD_LIBRARY_PATH
/home/asl/catkin_ws/devel/lib:/opt/ros/melodic/lib:/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo
asl@asl-desktop:~/catkin_ws/src/covid/Firmware$ make px4_sitl gazebo
[0/4] Performing build step for ‘sitl_gazebo’
ninja: no work to do.
[3/4] cd /home/asl/catkin_ws/src/covid…/covid/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
src_path: /home/asl/catkin_ws/src/covid/Firmware
build_path: /home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo:/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/asl/catkin_ws/src/covid/Firmware/Tools/sitl_gazebo/models:/home/asl/catkin_ws/src/covid/Firmware/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/asl/catkin_ws/devel/lib:/opt/ros/melodic/lib:/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo:/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/build_gazebo
Gazebo multi-robot simulator, version 9.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.10.47
[Wrn] [gazebo_barometer_plugin.cpp:66] [gazebo_barometer_plugin] Using default home altitude of 488 m
[Dbg] [gazebo_mavlink_interface.cpp:135] <joint_name> not found for channel[0] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135] <joint_name> not found for channel[1] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135] <joint_name> not found for channel[2] no joint control will be performed for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135] <joint_name> not found for channel[3] no joint control will be performed for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::propeller_joint] not found for channel[4] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::flap_left_joint] not found for channel[5] no joint control for this channel.
[Wrn] [gazebo_mavlink_interface.cpp:124] joint [zephyr_delta_wing::flap_right_joint] not found for channel[6] no joint control for this channel.
[Dbg] [gazebo_mavlink_interface.cpp:135] <joint_name> not found for channel[7] no joint control will be performed for this channel.
[Msg] Connecting to PX4 SITL using TCP
[Msg] Lockstep is enabled
[Msg] Speed factor set to: 1
SITL COMMAND: “/home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/bin/px4” “/home/asl/catkin_ws/src/covid/Firmware”/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t “/home/asl/catkin_ws/src/covid/Firmware”/test_data
INFO [px4] Creating symlink /home/asl/catkin_ws/src/covid/Firmware/ROMFS/px4fmu_common → /home/asl/catkin_ws/src/covid/Firmware/build/px4_sitl_default/tmp/rootfs/etc
0 WARNING: setRealtimeSched failed (not run as root?)


| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /
| |
| | / /^\ \ ___ |
_| / / |_/

px4 starting.

INFO [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
SYS_AUTOSTART: curr: 0 → new: 10016
BAT_N_CELLS: curr: 0 → new: 3
CAL_ACC0_ID: curr: 0 → new: 1311244
CAL_ACC_PRIME: curr: 0 → new: 1311244
CAL_GYRO0_ID: curr: 0 → new: 2294028
CAL_GYRO_PRIME: curr: 0 → new: 2294028
CAL_MAG0_ID: curr: 0 → new: 197388
CAL_MAG_PRIME: curr: 0 → new: 197388
CAL_BARO_PRIME: curr: 0 → new: 6620172
COM_DISARM_LAND: curr: 2.0000 → new: 0.1000
COM_OBL_ACT: curr: 0 → new: 2
COM_OF_LOSS_T: curr: 0.0000 → new: 5.0000
COM_RC_IN_MODE: curr: 0 → new: 1
EKF2_ANGERR_INIT: curr: 0.1000 → new: 0.0100
EKF2_GBIAS_INIT: curr: 0.1000 → new: 0.0100
EKF2_REQ_GPS_H: curr: 10.0000 → new: 0.5000
MC_PITCH_P: curr: 6.5000 → new: 6.0000
MC_PITCHRATE_P: curr: 0.1500 → new: 0.2000
MC_ROLL_P: curr: 6.5000 → new: 6.0000
MC_ROLLRATE_P: curr: 0.1500 → new: 0.2000
MPC_HOLD_MAX_Z: curr: 0.6000 → new: 2.0000
MPC_Z_VEL_I: curr: 0.1000 → new: 0.1500
MPC_Z_VEL_P: curr: 0.2000 → new: 0.6000
MPC_XY_P: curr: 0.9500 → new: 0.8000
MPC_XY_VEL_P: curr: 0.0900 → new: 0.2000
MPC_XY_VEL_D: curr: 0.0100 → new: 0.0160
MPC_JERK_MIN: curr: 8.0000 → new: 10.0000
MPC_ACC_HOR_MAX: curr: 5.0000 → new: 3.0000
NAV_ACC_RAD: curr: 10.0000 → new: 2.0000
NAV_DLL_ACT: curr: 0 → new: 2
RTL_DESCEND_ALT: curr: 30.0000 → new: 5.0000
RTL_LAND_DELAY: curr: -1.0000 → new: 5.0000
RTL_RETURN_ALT: curr: 60.0000 → new: 30.0000
SDLOG_MODE: curr: 0 → new: 1
SDLOG_PROFILE: curr: 3 → new: 131
SDLOG_DIRS_MAX: curr: 0 → new: 7
SENS_BOARD_X_OFF: curr: 0.0000 → new: 0.0000
SENS_DPRES_OFF: curr: 0.0000 → new: 0.0010
TRIG_INTERFACE: curr: 4 → new: 3

  • RTL_DESCEND_ALT: curr: 5.0000 → new: 10.0000
  • RTL_LAND_DELAY: curr: 5.0000 → new: 0.0000
    PWM_MAX: curr: 2000 → new: 1950
    PWM_MIN: curr: 1000 → new: 1075
    INFO [dataman] Unknown restart, data manager file ‘./dataman’ size is 11798680 bytes
    INFO [simulator] Waiting for simulator to connect on TCP port 4560
    Gazebo multi-robot simulator, version 9.0.0
    Copyright (C) 2012 Open Source Robotics Foundation.
    Released under the Apache 2 License.
    http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.10.47
INFO [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0
INFO [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 14570 remote port 14550
INFO [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO [logger] logger started (mode=all)
INFO [logger] Start file log (type: full)
INFO [logger] Opened full log file: ./log/2020-08-08/19_32_43.ulg
INFO [mavlink] MAVLink only on localhost (set param MAV_BROADCAST = 1 to enable network)
INFO [px4] Startup script returned successfully
pxh> [Err] [REST.cc:205] Error in REST request

libcurl: (51) SSL: no alternative certificate subject name matches target host name ‘api.ignitionfuel.org

Exiting…
pxh> Shutting down
ninja: build stopped: interrupted by user.
Makefile:200: recipe for target ‘px4_sitl’ failed
make: *** [px4_sitl] Interrupt`

The same happens to me also.
I observed that if I do:
make px4_sitl jmavsim
and the do:
make px4_sitl gazebo
gazebo starts to work after a few tries.
However this is problematic behaviour and what I proposed is not an actual fix.

Thanks ramp for the comment.

Unfortunately the solution you proposed is not working for me - I’m still getting the same behavior I described originally. Does anyone have any ideas how to fix this?

Hello, I am having the same problem (Gazebo 9, Ubuntu 18.04). When I launch “make px4_sitl gazebo” I have the GUI and the black screen, but if I launch just gazebo with an empty world it works fine.
Did you by chance manage to solve this problem ?

A workaround that works for me is to run a different gazebo model, kill it, and then to run mine again. That seems to work every time Gazebo hangs.
e.g.
make px4_sitl gazebo_iris
Press Ctrl + C
make px4_sitl gazebo_<my_model_name>

However, for a lot of these type of errors which seems to be out of nowhere, I run
make distclean
And then run
make px4_sitl gazebo_<modelname>

Which mostly solves it.

You may also need to run
git submodule update
incase distclean removed the submodule directories.

However it will be great if somebody releasises the actual cause of this

Have you tried disabling lockstep in the simulation?

Ok small update if it can help someone, I managed to solve the black screen problem by updating my nvidia drivers. However, I also did several other steps that I do not remember precisely, so that might not be the only reason.
I find it quite unfortunate that the 3 times I had to install px4/gazebo/mavros/ros (“the full package”), even by following the instructions on the px4 website, I had to do 3 different manual installations with different issues.

@a_jegourel Probably already too late, but It would be helpful if you could share each of the failures, so we can improve the installation procedures.

Unfortunately I don’t remember exactly what happened, but I will try to report future installation issues if I encounter some.

1 Like

Beware that make distclean deletes your submodules, so you may want to git commit any changes to sitl_gazebo before running this otherwise you will lose those changes