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

removal of PX4_GZ_MODEL env variable and fix of ground glitching #22400

Merged
merged 2 commits into from Nov 29, 2023

Conversation

frede791
Copy link
Contributor

Solved Problem

This PR solves two problems:

  1. Reduces the number of environmental variables. Currently there exists PX4_GZ_MODEL and its alias PX4_SIM_MODEL. By replacing all instances PX4_GZ_MODEL with PX4_SIM_MODEL#*gz_ we can eliminate the need for PX4_GZ_MODEL.
  2. When using the env variable PX4_GZ_MODEL_POSE (which previously could not be used with PX4_SIM_MODEL) the undefined pose position elements were filled up with 0. This leads to cases where models would clip into the ground, as described in [Bug] Vehicles glitching into the ground in Gazebo  #22214. This PR addresses this by checking whether the z-coordinate is less or equal to 0 and if that is the case, it will release the model at 1m above.

Question for @dagar and/or @beniaminopozzan: There are currently two instancees of PX4_GZ_MODEL being used in a debug file in platforms/posix/Debug/launch_sitl.json.in. Can you explain how removing the environmental variable PX4_GZ_MODEL would affect this?

Fixes #22214 (properly this time).

Solution

Replace PX4_GZ_MODEL with PX4_SIM_MODEL#*gz_

Changelog Entry

For release notes:

Removed/deprecated parameter: `PX4_GZ_MODEL`

Alternatives

We could also do a fancier pose calculation by reading it out of the sdf file that is provided. This may be more costly in terms of start up time.

Signed-off-by: frederik <frederik@auterion.com>
@frede791 frede791 marked this pull request as ready for review November 17, 2023 14:17
@dagar
Copy link
Member

dagar commented Nov 23, 2023

Question for @dagar and/or @beniaminopozzan: There are currently two instancees of PX4_GZ_MODEL being used in a debug file in platforms/posix/Debug/launch_sitl.json.in. Can you explain how removing the environmental variable PX4_GZ_MODEL would affect this?

Honestly I'm not even sure anymore, I was hoping we could fully clean this up after the split between PX4 and model/gzserver as discussed.

Copy link
Member

@beniaminopozzan beniaminopozzan left a comment

Choose a reason for hiding this comment

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

Thanks @frede791

Regarding your question, the instance of PX4_GZ_MODEL in platforms/posix/Debug/launch_sitl.json.in will not be affected by your changes. It is there just to let the user choose the GZ model they want to debug with.

ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator Outdated Show resolved Hide resolved
Improvement based upon comment.

Co-authored-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
@frede791
Copy link
Contributor Author

@beniaminopozzan Thanks for the catch.

Copy link
Member

@beniaminopozzan beniaminopozzan left a comment

Choose a reason for hiding this comment

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

Thanks @frede791 , LGTM.

Now, could you update the documentation too please?
https://docs.px4.io/main/en/sim_gazebo_gz/#syntax needs to be adjusted

@frede791
Copy link
Contributor Author

@beniaminopozzan The user guide update is ready to go and @hamishwillee is just waiting for this to be merged.

@beniaminopozzan
Copy link
Member

Thanks @frede791 !

@beniaminopozzan beniaminopozzan merged commit f00d97d into PX4:main Nov 29, 2023
86 of 87 checks passed
@frede791 frede791 deleted the rc_sim_declutter branch November 29, 2023 09:18
frede791 added a commit to frede791/PX4-Autopilot that referenced this pull request Nov 30, 2023
…#22400)

Removal of PX4_GZ_MODEL env variable and fix of ground glitching

Signed-off-by: frederik <frederik@auterion.com>
Co-authored-by: frederik <frederik@auterion.com>
Co-authored-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
frede791 added a commit to frede791/PX4-Autopilot that referenced this pull request Nov 30, 2023
…#22400)

Removal of PX4_GZ_MODEL env variable and fix of ground glitching

Signed-off-by: frederik <frederik@auterion.com>
Co-authored-by: frederik <frederik@auterion.com>
Co-authored-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
frede791 added a commit to frede791/PX4-Autopilot that referenced this pull request Nov 30, 2023
…#22400)

Removal of PX4_GZ_MODEL env variable and fix of ground glitching

Signed-off-by: frederik <frederik@auterion.com>
Co-authored-by: frederik <frederik@auterion.com>
Co-authored-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Vehicles glitching into the ground in Gazebo
3 participants