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

Enable StoreResolvedURIs when loading SDF #2349

Merged
merged 10 commits into from
Apr 19, 2024
Merged

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Mar 29, 2024

🎉 New feature

Summary

Replaces #2323 - see description in that PR.

This PR is needed so that bullet-featherstone plugin in gz-physics can load meshes with relative path URIs.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@iche033 iche033 requested a review from mjcarroll as a code owner March 29, 2024 00:02
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Mar 29, 2024
@iche033
Copy link
Contributor Author

iche033 commented Apr 6, 2024

The ServerFixture.LoadSdfModelRelativeUri test in UNIT_Server_Rendering_TEST.cc was failing because it contains a mesh uri pointing to a non-existent dae file. With SetStoreResolvedURIs set to true, it returns an error and so the server stops loading the model. This breaks current behavior. To resolve this, I added logic in ddf7f46 to allow the server to proceed with presence of URI_LOOKUP errors.

@iche033
Copy link
Contributor Author

iche033 commented Apr 11, 2024

The ServerFixture.LoadSdfModelRelativeUri test in UNIT_Server_Rendering_TEST.cc was failing because it contains a mesh uri pointing to a non-existent dae file. With SetStoreResolvedURIs set to true, it returns an error and so the server stops loading the model. This breaks current behavior. To resolve this, I added logic in ddf7f46 to allow the server to proceed with presence of URI_LOOKUP errors.

Looking for feedback on this. Any objections to allowing Server to continue loading with presence of URI errors?

@azeey
Copy link
Contributor

azeey commented Apr 11, 2024

I'm not sure this is a good idea. The URI_LOOKUP error is not just emitted for missing mesh files, but also when an included model is not found, which should be a blocker error IMO.

@iche033
Copy link
Contributor Author

iche033 commented Apr 11, 2024

The other option is to not return the URI_LOOKUP error in sdformat when resolving URIs but that's also not ideal.

So with SetStoreResolvedURIs now set to true, we'll just be more strict and stop the Server from loading if an URI is not found. How does that sound?

@azeey
Copy link
Contributor

azeey commented Apr 11, 2024

Maybe we can define a parameter in ServerConfig that determines if a SDF errors prevent the Server from loading. Or it could be an environment variable. Either way, we can just set that in the test without affecting end users.

@iche033
Copy link
Contributor Author

iche033 commented Apr 16, 2024

Maybe we can define a parameter in ServerConfig that determines if a SDF errors prevent the Server from loading.?

Added a new parameter in ServerConfig, blockOnSdfErrors to stop server from loading in presence of SDF errors. It can also be passed from the command line, gz sim -v 4 shapes.sdf --block-on-sdf-errors 1. fbddcb7

include/gz/sim/ServerConfig.hh Outdated Show resolved Hide resolved
include/gz/sim/ServerConfig.hh Outdated Show resolved Hide resolved
include/gz/sim/ServerConfig.hh Outdated Show resolved Hide resolved
@@ -178,6 +178,9 @@ COMMANDS = { 'sim' =>
" --version Print Gazebo version information. \n"\
"\n"\
" -z [arg] Update rate in Hertz. \n"\
"\n"\
" --block-on-sdf-errors [arg] Stop loading the server in presence of SDF \n"\
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if we should make this available for end users. When I was suggesting the feature, I only had our unit tests in mind where we would use it only in a narrowly scoped use case (invalid mesh path). My concern is that users can now use this flag and would be confused when things don't work as expected. Is there an actual use case for enabling this?

Copy link
Contributor Author

@iche033 iche033 Apr 16, 2024

Choose a reason for hiding this comment

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

More of a nice to have. I have sdf files with a few uri paths that don't exist on my filesystem and this lets me launch gazebo with only the models with valid URIs instead of exiting. I can also just comment them out.

I removed the changes here. We can revisit if we have a better or more common use case. afd6845

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

I think there's an unnecessary diff and DCO needs to be fixed. Otherwise, LGTM!

@@ -178,6 +178,7 @@ COMMANDS = { 'sim' =>
" --version Print Gazebo version information. \n"\
"\n"\
" -z [arg] Update rate in Hertz. \n"\
"\n"\
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

iche033 added 8 commits April 17, 2024 21:52
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
This reverts commit ddf7f46.

Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
@iche033 iche033 force-pushed the store_resolved_uris_8 branch from 8b9657b to 822ffcd Compare April 17, 2024 21:53
@iche033
Copy link
Contributor Author

iche033 commented Apr 18, 2024

DCO needs to be fixed.

fixed and force pushed

iche033 added 2 commits April 18, 2024 20:31
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
@iche033
Copy link
Contributor Author

iche033 commented Apr 19, 2024

fixed a couple of windows failures in 7488f7e.

@iche033 iche033 merged commit 4e50fab into gz-sim8 Apr 19, 2024
7 of 8 checks passed
@iche033 iche033 deleted the store_resolved_uris_8 branch April 19, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants