Skip to content

PX4 cannot bridge with Gazebo #3140

@dansyw91

Description

@dansyw91

I am trying to connect my PX4 with my Gazebo Harmonic with x500 model.
I am having issue launching with more complex worlds like baylands, forest, etc, and some custom maps downloaded elsewhere.
But simple worlds like default, windy, lawn that do not have any models works fine.
I'm programming with MAVSDK if that matters.

Ubuntu: 22.04
Gazebo version: 8.9.0 Harmonic

Currently in my ~/.bashrc

export GZ_SIM_RESOURCE_PATH=$HOME/PX4-Autopilot/Tools/simulation/gz/models:$HOME/.gz/fuel/fuel.gazebosim.org/openrobotics/models

export IGN_GAZEBO_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH

This is log when I ran PX4_GZ_WORLD=baylands make px4-sitl gz_x500

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=4001
INFO  [param] selected parameter default file parameters.bson
INFO  [param] importing from 'parameters.bson'
INFO  [parameters] BSON document size 521 bytes, decoded 521 bytes (INT32:15, FLOAT:10)
INFO  [param] selected parameter backup file parameters_backup.bson
INFO  [dataman] data manager file './dataman' size is 7872608 bytes
INFO  [init] Gazebo simulator
INFO  [init] Standalone PX4 launch, waiting for Gazebo
INFO  [init] PX4_GZ_MODEL_POSE set, spawning at: 0,0,0,0,0,0
INFO  [gz_bridge] world: baylands, model name: x500_0, simulation model: x500
INFO  [gz_bridge] Requested Model Position: 0,0,0,0,0,0
INFO  [gz_bridge] Model position z is less or equal 0.0, moving upwards
ERROR [gz_bridge] Service call timed out. Check GZ_SIM_RESOURCE_PATH is set correctly.
ERROR [gz_bridge] Task start failed (-1)
ERROR [init] gz_bridge failed to start and spawn model
ERROR [px4] Startup script returned with return value: 256
FAILED: src/modules/simulation/gz_bridge/CMakeFiles/gz_x500 /home/dan/PX4-Autopilot/build/px4_sitl_default/src/modules/simulation/gz_bridge/CMakeFiles/gz_x500
cd /home/dan/PX4-Autopilot/build/px4_sitl_default/src/modules/simulation/gz_bridge && /usr/bin/cmake -E env PX4_SIM_MODEL=gz_x500 /home/dan/PX4-Autopilot/build/px4_sitl_default/bin/px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:232: px4_sitl] Error 1

Then I tried running with export PX4_GZ_STANDALONE=1, result as follow (note the last log):

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=4001
INFO  [param] selected parameter default file parameters.bson
INFO  [param] importing from 'parameters.bson'
INFO  [parameters] BSON document size 521 bytes, decoded 521 bytes (INT32:15, FLOAT:10)
INFO  [param] selected parameter backup file parameters_backup.bson
INFO  [dataman] data manager file './dataman' size is 7872608 bytes
INFO  [init] Gazebo simulator
INFO  [init] Standalone PX4 launch, waiting for Gazebo
INFO  [init] PX4_GZ_MODEL_POSE set, spawning at: 0,0,0,0,0,0
INFO  [gz_bridge] world: baylands, model name: x500_0, simulation model: x500
INFO  [gz_bridge] Requested Model Position: 0,0,0,0,0,0
INFO  [gz_bridge] Model position z is less or equal 0.0, moving upwards
WARN  [gz_bridge] Service call timed out as Gazebo has not been detected.

I'm quite new to drone programming. Any help would highly be appreciated.
Let me know if you need more info I'll try my best to supply.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions