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

WIP: Implement gz sdf as standalone executable #1465

Draft
wants to merge 5 commits into
base: sdf15
Choose a base branch
from

Conversation

scpeters
Copy link
Member

🎉 New feature

Part of gazebosim/gz-tools#7.

Summary

This is a work-in-progress to implement the gz sdf functionality in a standalone executable (similar to gazebosim/gz-transport#216). The standalone executable has added alongside the existing approach. Once the standalone executable is complete and functioning, the old approach should be removed.

This is not targeting the first release of Gazebo Ionic.

Test it

Use UNIT_gz_TEST as the guide.

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.

@scpeters
Copy link
Member Author

scpeters commented Oct 3, 2024

this is in progress. as of d823820, the src/gz.cc and src/gz.hh files are duplicated into the src/cmd folder and a standalone executable is built and installed into libexec but not yet called by the src/cmd/cmdsdformat.in ruby file. At the time, I found it easier to test this way, but now that Ionic has been released, it may be a good time to update the ruby file to invoke the standalone executable (see cmdplugin.rb.in) so that UNIT_gz_TEST will invoke the standalone executable. That test is pretty thorough and should be able to guide most of the conversion effort

@sauk2
Copy link

sauk2 commented Oct 14, 2024

this is in progress. as of d823820, the src/gz.cc and src/gz.hh files are duplicated into the src/cmd folder and a standalone executable is built and installed into libexec but not yet called by the src/cmd/cmdsdformat.in ruby file. At the time, I found it easier to test this way, but now that Ionic has been released, it may be a good time to update the ruby file to invoke the standalone executable (see cmdplugin.rb.in) so that UNIT_gz_TEST will invoke the standalone executable. That test is pretty thorough and should be able to guide most of the conversion effort

@scpeters I raised a PR into this branch with the pending changes. If you could take a look at #1489

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why we're adding these files when they're already in src.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had initially added them separately while prototyping so that I could run the standalone executable side-by-side with the ruby script. My goal was to eventually match the file layout used by gz-transport with gz.* in src/cmd/:

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, moving them here makes sense to be consistent, but we should move gz_TEST.cc here as well then right?

Also, it would be best if we can git mv the files to preserve history.

sauk2 and others added 2 commits January 23, 2025 17:40
* Fixed cmake to find source file for FrameSemantics
* Updated exe location in ruby script
* Add a dependency on gz-sdformat-sdf to the sdf_descriptions target
* Updated cmd line arguments in executable tests
* Added dummy flags to make tests pass

---------

Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Copy link
Collaborator

@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.

@scpeters I've merged #1489 into this PR. I've a few more comments, but I think this is almost there.

PROPERTIES
ENVIRONMENT
"GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>"
# "GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>;LD_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\":$ENV{LD_LIBRARY_PATH}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove commented out code?

Comment on lines +193 to +194
app.add_flag("--force-version", "Use a specific library version.");
app.add_flag("--versions", "Show the available versions.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a comment that these flags are actually handled by gz-tools?

/// \brief External hook to execute 'gz sdf -k' from the command line.
/// \param[in] _path Path to the file to validate.
/// \return Zero on success, negative one otherwise.
extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that we're calling these functions from C++, we don't need the extern "C" anymore.


#include <sdf/sdf_config.h>
#include "sdf/system_util.hh"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add namespace sdf

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, moving them here makes sense to be consistent, but we should move gz_TEST.cc here as well then right?

Also, it would be best if we can git mv the files to preserve history.

@@ -0,0 +1,199 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Copyright (C) 2021 Open Source Robotics Foundation
* Copyright (C) 2025 Open Source Robotics Foundation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

3 participants