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

URDF->SDF handle links with no inertia or small mass #1238

Merged
merged 47 commits into from
Mar 22, 2023

Conversation

aaronchongth
Copy link
Collaborator

@aaronchongth aaronchongth commented Feb 10, 2023

🦟 Bug fix

Related to #199, and #1007.

Summary

(edited)

Current behavior

When a URDF link has no <inertial> block or has a mass of less than or eqaul to 1e-6 it is considered a link without mass, and if joint lumping does not help convert it to a frame, it will be ignored during the conversion to sdf, with debug messages instead of warnings or errors, which is easily missed and users might be surprised when a large part of their model disappears.


Changes

Tests

./build/sdformat12/bin/UNIT_parser_urdf_TEST
./build/sdformat12/bin/INTEGRATION_urdf_to_sdf

Example of suggesting removal of <gazebo> tag

Intermediate joint with zero mass, fixed parent link, but joint lumping and reduction disabled with gazebo tag,

<robot name='test_robot'>
  <link name='link1'>
    <inertial>
      <mass value='0.1' />
      <origin rpy='1.570796326794895 0 0' xyz='0.123456789123456 0 0.0' />
      <inertia ixx='0.01' ixy='0' ixz='0' iyy='0.01' iyz='0' izz='0.01' />
    </inertial>
  </link>
  <link name='link2'/>
  <joint name='joint1_2' type='fixed'>
    <parent link='link1' />
    <child  link='link2' />
    <origin xyz='0.0 0.0 0.0' rpy='0.0 0.0 1.57'/>
  </joint>
  <link name='link3'>
    <inertial>
      <mass value='0.1' />
      <origin rpy='1.570796326794895 0 0' xyz='0.123456789123456 0 0.0' />
      <inertia ixx='0.01' ixy='0' ixz='0' iyy='0.01' iyz='0' izz='0.01' />
    </inertial>
  </link>
  <joint name='joint2_3' type='continuous'>
    <parent link='link2' />
    <child  link='link3' />
    <origin xyz='0.0 0.0 0.0' rpy='0.0 0.0 1.57'/>
  </joint>
  <gazebo reference='joint1_2'>
    <disableFixedJointLumping>true</disableFixedJointLumping>
  </gazebo>
</robot>

Warnings expected:

urdf2sdf: link[link3] has no <inertial> block defined.
urdf2sdf: allowing joint lumping by removing the <disableFixedJointLumping> tag or setting it to false
on fixed parent joint[joint1_2] could help resolve this warning.
urdf2sdf: parent joint[joint2_3] ignored
urdf2sdf: link[link3] is not modeled in sdf

Resulting sdf will have everything below joint1_2 ignored,

<sdf version="1.7">
    <model name="test_robot">
        <link name="link1">
            <inertial>
                <pose>0.123456789123456 0 0 1.570796326794895 0 0</pose>
                <mass>0.1</mass>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
            </inertial>
        </link>
    </model>
</sdf>

Removing it, we get

<robot name='test_robot'>
  <link name='link1'>
    <inertial>
      <mass value='0.1' />
      <origin rpy='1.570796326794895 0 0' xyz='0.123456789123456 0 0.0' />
      <inertia ixx='0.01' ixy='0' ixz='0' iyy='0.01' iyz='0' izz='0.01' />
    </inertial>
  </link>
  <link name='link2'/>
  <joint name='joint1_2' type='fixed'>
    <parent link='link1' />
    <child  link='link2' />
    <origin xyz='0.0 0.0 0.0' rpy='0.0 0.0 1.57'/>
  </joint>
  <link name='link3'>
    <inertial>
      <mass value='0.1' />
      <origin rpy='1.570796326794895 0 0' xyz='0.123456789123456 0 0.0' />
      <inertia ixx='0.01' ixy='0' ixz='0' iyy='0.01' iyz='0' izz='0.01' />
    </inertial>
  </link>
  <joint name='joint2_3' type='continuous'>
    <parent link='link2' />
    <child  link='link3' />
    <origin xyz='0.0 0.0 0.0' rpy='0.0 0.0 1.57'/>
  </joint>
</robot>

Resulting in no warnings or errors, and a valid sdf,

<sdf version="1.7">
    <model name="test_robot">
        <link name="link1">
            <inertial>
                <pose>0.123456789123456 0 0 1.570796326794895 0 0</pose>
                <mass>0.1</mass>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
            </inertial>
        </link>
        <joint type="revolute" name="joint2_3">
            <pose relative_to="link1">0 0 0 0 0 3.14</pose>
            <parent>link1</parent>
            <child>link3</child>
            <axis>
                <xyz>1 0 0</xyz>
                <limit/>
                <dynamics/>
            </axis>
        </joint>
        <link name="link3">
            <pose relative_to="joint2_3"/>
            <inertial>
                <pose>0.123456789123456 0 0 1.570796326794895 0 0</pose>
                <mass>0.1</mass>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
            </inertial>
        </link>
        <frame name="joint1_2" attached_to="link1">
            <pose>0 0 0 0 -0 1.57</pose>
        </frame>
        <frame name="link2" attached_to="joint1_2"/>
    </model>
</sdf>

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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.

…r if mass is too small

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
… more verbose messages

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
… being explicit about epsilon in equal

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Feb 10, 2023
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #1238 (32da52c) into sdf12 (d9d5d75) will increase coverage by 0.10%.
The diff coverage is 100.00%.

❗ Current head 32da52c differs from pull request most recent head 6aa625c. Consider uploading reports for the commit 6aa625c to get more accurate results

@@            Coverage Diff             @@
##            sdf12    #1238      +/-   ##
==========================================
+ Coverage   92.03%   92.14%   +0.10%     
==========================================
  Files          79       79              
  Lines       13090    13120      +30     
==========================================
+ Hits        12047    12089      +42     
+ Misses       1043     1031      -12     
Impacted Files Coverage Δ
src/parser_urdf.cc 88.63% <100.00%> (+0.82%) ⬆️

... and 1 file with indirect coverage changes

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

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
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.

The main issue that we have to resolve is what to assign the attached_to attribute of the created frame. In thinking about that I've come to realize there will be some use cases we can't/shouldn't support as they will cause more confusion. My conclusion so far is, for the link->frame conversion, the link has have a parent or child joint with a "fixed" type.

src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Outdated Show resolved Hide resolved
test/integration/urdf_to_sdf.cc Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Show resolved Hide resolved
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
include/sdf/ParserConfig.hh Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Outdated Show resolved Hide resolved
…th::equals

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
…f no inertial frame

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@aaronchongth aaronchongth requested a review from azeey February 21, 2023 14:02
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
…ides gazebo tags for joint lumping, warnings with more information and placeholder url

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

Per VC,

…ting (#1251)

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
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.

Just a few minor comments, otherwise, this looks great! Thanks a lot for iterating and for the through tests. This was a doozy!

test/integration/urdf_to_sdf.cc Outdated Show resolved Hide resolved
test/integration/urdf_to_sdf.cc Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Show resolved Hide resolved
…ed/dropped

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
…m sdf_tutorials#88

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

I've also committed the expected URL of gazebosim/sdf_tutorials#88, we can wait for that to be merged before hitting the green button then

src/parser_urdf.cc Outdated Show resolved Hide resolved
Comment on lines 2734 to 2735
jointReductionHappens = true;
break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Codecov says these two lines are not covered. Is it a false negative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe so! This test will cause the break, https://github.com/gazebosim/sdformat/pull/1238/files#diff-fc2484863e209b4368da90c08381488ec4b010f386c642b1ea1e8bcf82cf6f02R2141-R2190

Could this be due to the code only checking !jointReductionHappens and not do anything if jointReductionHappens is true?

I'm not too sure how to see if this gets reported again, is it just https://app.codecov.io/gh/gazebosim/sdformat/pull/1238? Looks alright at the moment

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tested with gdb, and looks like it really isn't covered. Apparently, a massless link with a non-fixed parent joint and a fixed child joint is reduced before CreateSDF is ever called :

sdformat/src/parser_urdf.cc

Lines 3385 to 3398 in ba52e6f

if (g_reduceFixedJoints)
{
ReduceFixedJoints(robot, urdf::const_pointer_cast<urdf::Link>(rootLink));
}
if (rootLink->name == "world")
{
// convert all children link
for (std::vector<urdf::LinkSharedPtr>::const_iterator
child = rootLink->child_links.begin();
child != rootLink->child_links.end(); ++child)
{
CreateSDF(robot, (*child));
}

This means, the massless link now has mass from the lumped child links. So, I guess if we encounter a massless link here, it would only be if:

  • it's parent joint is reduced (i.e, the link has been lumped into it's parent link) or
  • it's child joint is fixed, but could not be reduced because joint lumping is disabled.

Can you verify my logic? Does that maybe simplify anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, I can recreate it with gdb too, it doesn't even allow me to set a breakpoint there, probably got optimized away by the compiler. Looking at the code, I can verify that is the intended behavior too.

94382d7, 6aa625c, I've refactored the fixed child joint logic and reduced the number of checks we are doing overall (only if parent joint is reduced)

I kept the use of Errors, instead of using sdfwarn << Error(...) directly, to make easier when we do introduce passing Errors into these functions in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@azeey, per VC, regarding whether or not a similar situation for reduced parent joints is a bug, I don't believe it is a bug, just that checks happen after . Before this PR, joints are lumped recursively onto their parents with L3387 (shared by you above), and relies on https://github.com/gazebosim/sdformat/pull/1238/files#diff-2bc5ca23bcfc66fe173f513399bec8065b1cb4e607d741566517d7368e6bce0fL2705 to not create the link (whose's inertia has been lumped) if the parent joint is reduced, but the urdf link still contains the mass values

so there will be cases where CreateSDF is called on a massless link, https://github.com/gazebosim/sdformat/pull/1238/files#diff-2bc5ca23bcfc66fe173f513399bec8065b1cb4e607d741566517d7368e6bce0fL2713, where the parent has already been reduced, hence the need to check if the parent has been reduced.

on the otherhand, as you surmised, a massless link A with a fixed child joint, and child link B with mass, will already have B's mass lumped into it in CreateSDF, so it should always have mass unless joint lumping was turned off.

…in case links change, we are not testing for that anyway

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
…t is reduced

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
@aaronchongth aaronchongth merged commit 6ffe669 into sdf12 Mar 22, 2023
@aaronchongth aaronchongth deleted the aaron/urdf-inertia-handling branch March 22, 2023 02:39
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>
scpeters added a commit that referenced this pull request May 10, 2023
When converting from URDF to SDFormat, some links without
an <inertial> block or a small mass may be dropped with only
debug messages in a log file, which are easily missed.
This makes the following changes:

* When a massless link in the middle of a kinematic chain is
  successfully merged to its parent by fixed joint reduction,
  fix bug that was dropping the massless link's child links and
  joints.
* Print no warnings or debug messages when a massless link
  is successfully merged to a parent by fixed joint reduction.
* Promote debug messages to warnings / errors when links
  are dropped to improve visibility. Improve message clarity
  and suggest fixes to the user.
* Change massless threshold test to `> 0` instead of being
  within a 1e-6 tolerance of 0.
* Add unit and integration tests.

Related to #199 and #1007.

(cherry picked from commit 6ffe669)

Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
Co-authored-by: Steve Peters <scpeters@openrobotics.org>
@azeey azeey mentioned this pull request May 22, 2023
@azeey azeey mentioned this pull request Sep 1, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants