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

Use sdf::testing::contains instead of local contains functions #1251

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

aaronchongth
Copy link
Collaborator

@aaronchongth aaronchongth commented Mar 14, 2023

🎉 New feature

Related to #1238 where sdf::testing::contains and sdf::testing::notContains was added to test_utils.hh.

Summary

  • Replace all local declarations and use of bool contains(...) in tests with sdf::testing::contains

Test it

colcon build --merge-install --packages-up-to sdformat12
colcon test --merge-install --packages-select sdformat12

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

…ting

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #1251 (d525b4f) into aaron/urdf-inertia-handling (432a1cb) will not change coverage.
The diff coverage is n/a.

❗ Current head d525b4f differs from pull request most recent head 7371472. Consider uploading reports for the commit 7371472 to get more accurate results

@@                     Coverage Diff                      @@
##           aaron/urdf-inertia-handling    #1251   +/-   ##
============================================================
  Coverage                        92.10%   92.10%           
============================================================
  Files                               79       79           
  Lines                            13125    13125           
============================================================
  Hits                             12089    12089           
  Misses                            1036     1036           

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

@mjcarroll mjcarroll merged commit 774d86b into aaron/urdf-inertia-handling Mar 15, 2023
@mjcarroll mjcarroll deleted the aaron/test-utils-contains branch March 15, 2023 18:11
aaronchongth added a commit that referenced this pull request Mar 22, 2023
* Adding tests that catch warnings when urdf have no inertia element, or if mass is too small

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Promote link inertia and mass related urdf2sdf sdfdbg to sdfwarn with more verbose messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added flag for converting urdf links with small or no mass to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Converts urdf links with small or no mass to frames, added tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding warning when conversion happens, added tests for small masses, being explicit about epsilon in equal

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix cpplint errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding integration test

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use camelCase

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added URDFMinimumAllowedLinkMass

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix tests expecting warnings when converting to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding inline contains and notContains to test_utils

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using RedirectConsoleStream and ScopeExit

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactor to use Root::LoadSdfString

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing debug message when converted frame is from a root link

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added attached_to for frames during conversion, using < instead of math::equals

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update brief of URDFSetConvertLinkWithNoMassToFrame to mention case of no inertial frame

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove stale commentted code

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update comment about the errors we are expecting

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert to frame by default, remove minimal mass option, refactor implementation to handle lumping, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Only convert to frame when parent joint is fixed, attaches and transforms pose to parent link, leaves out the fixed joint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Rephrased conversion error, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* prints zero mass errors as well when conversion to frame fails

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* integration tests that mimic the unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added integration test with valid and invalid use of force torque sensor where massless child links occur

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix joint reduction logic, more specific error messages, more targeted unit tests for each case

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert joints to frames when converting links, attach them to converted links

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests with child fixed links as well

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Change sdferr to sdfwarn, no way to use ParserConfig::WarningsPolicy for now

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* sdferr to sdfwarn for the case where conversion to frame is attempted

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing case within converting to frame, where parent joint turns into revolute joint, that is not covered

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduced scope of implementation, more specific warning messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove mention of parser config in warning, since that is not typically used by workflows

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests revisited and modified, removed printouts

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Test case showing ParserConfig::URDFSetPreserveFixedJoint(true) overrides gazebo tags for joint lumping, warnings with more information and placeholder url

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use sdf::testing::contains instead of local contains functions in testing (#1251)

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove unused InitSDF, added TODO for warning when joints are converted/dropped

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Cleaned up if else cases

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using << operator of Errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Replacing placeholder url with expected URL for the documentation from sdf_tutorials#88

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* URL to tutorial as a constant, removing checking URL from test, just in case links change, we are not testing for that anyway

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactored fixed child joint logic as it is never reached

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduce number of if statements, renaming to only check if parent joint is reduced

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

---------

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
aaronchongth added a commit that referenced this pull request Mar 22, 2023
* Adding tests that catch warnings when urdf have no inertia element, or if mass is too small

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Promote link inertia and mass related urdf2sdf sdfdbg to sdfwarn with more verbose messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added flag for converting urdf links with small or no mass to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Converts urdf links with small or no mass to frames, added tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding warning when conversion happens, added tests for small masses, being explicit about epsilon in equal

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix cpplint errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding integration test

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use camelCase

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added URDFMinimumAllowedLinkMass

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix tests expecting warnings when converting to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding inline contains and notContains to test_utils

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using RedirectConsoleStream and ScopeExit

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactor to use Root::LoadSdfString

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing debug message when converted frame is from a root link

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added attached_to for frames during conversion, using < instead of math::equals

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update brief of URDFSetConvertLinkWithNoMassToFrame to mention case of no inertial frame

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove stale commentted code

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update comment about the errors we are expecting

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert to frame by default, remove minimal mass option, refactor implementation to handle lumping, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Only convert to frame when parent joint is fixed, attaches and transforms pose to parent link, leaves out the fixed joint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Rephrased conversion error, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* prints zero mass errors as well when conversion to frame fails

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* integration tests that mimic the unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added integration test with valid and invalid use of force torque sensor where massless child links occur

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix joint reduction logic, more specific error messages, more targeted unit tests for each case

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert joints to frames when converting links, attach them to converted links

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests with child fixed links as well

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Change sdferr to sdfwarn, no way to use ParserConfig::WarningsPolicy for now

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* sdferr to sdfwarn for the case where conversion to frame is attempted

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing case within converting to frame, where parent joint turns into revolute joint, that is not covered

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduced scope of implementation, more specific warning messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove mention of parser config in warning, since that is not typically used by workflows

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests revisited and modified, removed printouts

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Test case showing ParserConfig::URDFSetPreserveFixedJoint(true) overrides gazebo tags for joint lumping, warnings with more information and placeholder url

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use sdf::testing::contains instead of local contains functions in testing (#1251)

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove unused InitSDF, added TODO for warning when joints are converted/dropped

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Cleaned up if else cases

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using << operator of Errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Replacing placeholder url with expected URL for the documentation from sdf_tutorials#88

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* URL to tutorial as a constant, removing checking URL from test, just in case links change, we are not testing for that anyway

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactored fixed child joint logic as it is never reached

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduce number of if statements, renaming to only check if parent joint is reduced

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

---------

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
(cherry picked from commit 6ffe669)
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
aaronchongth added a commit that referenced this pull request Mar 22, 2023
* Adding tests that catch warnings when urdf have no inertia element, or if mass is too small

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Promote link inertia and mass related urdf2sdf sdfdbg to sdfwarn with more verbose messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added flag for converting urdf links with small or no mass to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Converts urdf links with small or no mass to frames, added tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding warning when conversion happens, added tests for small masses, being explicit about epsilon in equal

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix cpplint errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding integration test

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use camelCase

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added URDFMinimumAllowedLinkMass

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix tests expecting warnings when converting to frames

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Adding inline contains and notContains to test_utils

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using RedirectConsoleStream and ScopeExit

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactor to use Root::LoadSdfString

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing debug message when converted frame is from a root link

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added attached_to for frames during conversion, using < instead of math::equals

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update brief of URDFSetConvertLinkWithNoMassToFrame to mention case of no inertial frame

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove stale commentted code

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Update comment about the errors we are expecting

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert to frame by default, remove minimal mass option, refactor implementation to handle lumping, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Only convert to frame when parent joint is fixed, attaches and transforms pose to parent link, leaves out the fixed joint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Rephrased conversion error, modified unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* prints zero mass errors as well when conversion to frame fails

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* integration tests that mimic the unit tests

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Added integration test with valid and invalid use of force torque sensor where massless child links occur

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix lint

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Fix joint reduction logic, more specific error messages, more targeted unit tests for each case

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Convert joints to frames when converting links, attach them to converted links

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests with child fixed links as well

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Change sdferr to sdfwarn, no way to use ParserConfig::WarningsPolicy for now

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* sdferr to sdfwarn for the case where conversion to frame is attempted

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Removing case within converting to frame, where parent joint turns into revolute joint, that is not covered

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduced scope of implementation, more specific warning messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove mention of parser config in warning, since that is not typically used by workflows

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Integration tests revisited and modified, removed printouts

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Test case showing ParserConfig::URDFSetPreserveFixedJoint(true) overrides gazebo tags for joint lumping, warnings with more information and placeholder url

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Use sdf::testing::contains instead of local contains functions in testing (#1251)

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Remove unused InitSDF, added TODO for warning when joints are converted/dropped

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Cleaned up if else cases

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Using << operator of Errors

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Replacing placeholder url with expected URL for the documentation from sdf_tutorials#88

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* URL to tutorial as a constant, removing checking URL from test, just in case links change, we are not testing for that anyway

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Refactored fixed child joint logic as it is never reached

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

* Reduce number of if statements, renaming to only check if parent joint is reduced

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>

---------

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
(cherry picked from commit 6ffe669)
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants