sdformat icon indicating copy to clipboard operation
sdformat copied to clipboard

Offer an API option to display new warnings on problems with URDF to SDF conversions

Open j-rivero opened this issue 1 year ago • 1 comments

🎉 New feature

Should help providing an API option to have explicit warnings for https://github.com/gazebosim/sdformat/issues/199 and https://github.com/gazebosim/sdformat/issues/1007.

Summary

The PR tries to address the lack of the explicit information on decisions made that end up ignoring some link definitions in the user input which can lead to many problems see https://github.com/gazebosim/sdformat/issues/199 and https://github.com/gazebosim/sdformat/issues/1007.

For keeping backwards compatibility, no new warning is raised unless the consumer of sdformat readFile

The PR implements a new API function:

bool readFile(const std::string &_filename, SDFPtr _sdf, bool _enable_new_warnings);

that allows users of sdf to enable new extra warnings.

If the parameter is enabled, the problems with links being ignored silently (not really, but the issues were stored in the logs) are promoted to warnings using gzwarn in the CreateSDF function.

Test it

Should be fairly trivial to change Gazebo or other consumer of the readFile API to use the new parameter. Examples of code that triggers problems can be found in https://github.com/gazebosim/sdformat/issues/199 and https://github.com/gazebosim/sdformat/issues/1007.

Checklist

  • [x] Signed all commits for DCO
  • [x] 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)
  • [x] codecheck passed (See contributing)
  • [x] All tests passed (See test coverage)

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.

j-rivero avatar Sep 26 '22 23:09 j-rivero

Codecov Report

Merging #1171 (afbd18b) into sdf9 (b7f0cba) will increase coverage by 0.00%. The diff coverage is 76.19%.

:exclamation: Current head afbd18b differs from pull request most recent head 1d755ae. Consider uploading reports for the commit 1d755ae to get more accurate results

@@           Coverage Diff           @@
##             sdf9    #1171   +/-   ##
=======================================
  Coverage   87.82%   87.82%           
=======================================
  Files          64       65    +1     
  Lines       10095    10112   +17     
=======================================
+ Hits         8866     8881   +15     
- Misses       1229     1231    +2     
Impacted Files Coverage Δ
src/parser_urdf.cc 84.47% <72.41%> (+0.10%) :arrow_up:
src/parser.cc 78.88% <77.77%> (-0.18%) :arrow_down:
include/sdf/parser_urdf.hh 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Sep 26 '22 23:09 codecov[bot]