Skip to content

Follow model in gz GUI#22808

Merged
dagar merged 2 commits intomainfrom
pr-gz-camera-follow
Aug 21, 2024
Merged

Follow model in gz GUI#22808
dagar merged 2 commits intomainfrom
pr-gz-camera-follow

Conversation

@Jaeyoung-Lim
Copy link
Copy Markdown
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Feb 27, 2024

Solved Problem

When running the simulation in gz, the model is not being followed by default.

@frede791 FYI

Solution

Start gz with a follow mode engaged to the model

Changelog Entry

For release notes:

Feature/Bugfix Gazebo gui follows model by default

Alternatives

We could also create a custom plugin to follow the model

Test coverage

make px4_sitl gz_x500

Screencastfrom02-27-2024104558AM-ezgif com-video-to-gif-converter

Context

@Jaeyoung-Lim Jaeyoung-Lim requested a review from dagar February 27, 2024 09:50
@Jaeyoung-Lim Jaeyoung-Lim changed the title Follow model in gz Follow model in gz GUI Feb 27, 2024
Comment thread ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator Outdated
Comment thread ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator Outdated
@Jaeyoung-Lim
Copy link
Copy Markdown
Member Author

Jaeyoung-Lim commented Feb 27, 2024

@frede791 I kind of liked the dramatic rotation, but as you wish :)

The vehicle is a bit too small to see what is going on with 6 m (fo example control surfaces actuating), but we can keep it like that until gazebosim/gz-gui#515 is in

Comment thread ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator Outdated
@Jaeyoung-Lim Jaeyoung-Lim force-pushed the pr-gz-camera-follow branch 3 times, most recently from 7cbb84c to 81e8303 Compare March 2, 2024 06:21
@fredmarkus
Copy link
Copy Markdown
Contributor

@Jaeyoung-Lim It doesn't latch onto the model for me. I still have to click "follow" for the model to actually be tracked from the requested camera perspective.

Copy link
Copy Markdown
Contributor

@fredmarkus fredmarkus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stringmsg doesn't seem to refer to the specific model that it is supposed to attach to in the way the old version had it.

Comment thread src/modules/simulation/gz_bridge/GZBridge.cpp Outdated
Comment thread src/modules/simulation/gz_bridge/GZBridge.cpp Outdated
Comment thread src/modules/simulation/gz_bridge/GZBridge.hpp Outdated
@Jaeyoung-Lim
Copy link
Copy Markdown
Member Author

The stringmsg doesn't seem to refer to the specific model that it is supposed to attach to in the way the old version had it.

Could you elaborate?

@fredmarkus
Copy link
Copy Markdown
Contributor

In your previous version you used PX4_SIM_MODEL:

gz service -s /gui/follow --reqtype gz.msgs.StringMsg --reptype gz.msgs.Boolean --timeout 2000 --req "data: \"${PX4_SIM_MODEL#*gz_}_0\""

Since the call is now in GzBridge it is now set in the follow_msg, but it doesn't seem to be working correctly on my machine.

@Jaeyoung-Lim
Copy link
Copy Markdown
Member Author

@frede791 Have you tried changing the sleep just to see if it is working?

The problem is that the follow service seems to always return true, even if the model does not exist in gz sim

This commit makes the gz bridge follow the spawned model

F
Update src/modules/simulation/gz_bridge/GZBridge.cpp

Co-authored-by: Frederik Markus <80588263+frede791@users.noreply.github.com>
Cleanup
@Jaeyoung-Lim
Copy link
Copy Markdown
Member Author

Jaeyoung-Lim commented Aug 16, 2024

@frede791 @dagar I have removed the timeouts and detect whether the scene is created by checking if it is possible to query a scene message.

@DronecodeBot
Copy link
Copy Markdown

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-aug-21-2024/40268/2

@DronecodeBot
Copy link
Copy Markdown

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-aug-21-2024/40268/1

@dagar dagar merged commit ae16556 into main Aug 21, 2024
@dagar dagar deleted the pr-gz-camera-follow branch August 21, 2024 15:41
@dakejahl
Copy link
Copy Markdown
Contributor

dakejahl commented Aug 21, 2024

unused variable
image
and sim throws an error
image

@Claudio-Chies
Copy link
Copy Markdown
Member

unused variable image and sim throws an error image

jup, I have the same issue

@dirksavage88
Copy link
Copy Markdown
Contributor

dirksavage88 commented Sep 21, 2024

Shows errors but still works despite the error printout
#23705

Ali-barari pushed a commit to Ali-barari/AvesAID that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Bug] px4_sitl gz_standard_vtol spawns with camera under the world

7 participants