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

Draft: Parser warning message when <gazebo> reference does not exist in URDF #1392

Open
wants to merge 9 commits into
base: sdf14
Choose a base branch
from

Conversation

aagrawal05
Copy link

@aagrawal05 aagrawal05 commented Apr 5, 2024

🎉 New feature

Closes #1372

Summary

Added functionality to emit a warning when a reference to a link does not exists by adding a check in the InsertSDFExtensionLink method.

Test it

I've added the ParseGazeboRefDoesntExistWarningMessage test which adds the test case mentioned from #1372 with conflicting U+0069 and U+0456 characters.

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.

@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Apr 5, 2024
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

If you check the diff, the indentation in your changes is very wierd. Do you mind to fix it ?

@aagrawal05
Copy link
Author

aagrawal05 commented Apr 5, 2024

If you check the diff, the indentation in your changes is very wierd. Do you mind to fix it ?

Hi, I took a look at it—I think there was something wrong with my text editor, it showed a different output and I hadn't noticed earlier. Let me fix it now.

@aagrawal05
Copy link
Author

aagrawal05 commented Apr 5, 2024

Ok, sorry about the many commits—I think the formatting should be fixed now. I'll make sure everything fits with rigorously with codecheck afterwards.

aagrawal05 and others added 5 commits April 6, 2024 11:27
Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
Signed-off-by: Aditya Agrawal <58559719+aagrawal05@users.noreply.github.com>
Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
Signed-off-by: Aditya Agrawal <58559719+aagrawal05@users.noreply.github.com>
Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
Signed-off-by: Aditya Agrawal <58559719+aagrawal05@users.noreply.github.com>
Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
@aagrawal05 aagrawal05 requested a review from ahcorde April 8, 2024 12:44
@azeey azeey added the beta Targeting beta release of upcoming collection label Jul 29, 2024
@azeey
Copy link
Collaborator

azeey commented Aug 6, 2024

@traversaro would you be able to take a look at this?

@traversaro
Copy link
Contributor

Thanks @aagrawal05 ! I guess it could make sense to do something similar with joints as well, but even just with links this PR is already quite useful.

@aagrawal05
Copy link
Author

Thanks @aagrawal05 ! I guess it could make sense to do something similar with joints as well, but even just with links this PR is already quite useful.

Thanks @traversaro, I will take a look into it. Please let me know if anything further is to be done.

@aagrawal05 aagrawal05 closed this Aug 15, 2024
@azeey
Copy link
Collaborator

azeey commented Aug 15, 2024

@aagrawal05 did you mean to close this PR?

@aagrawal05
Copy link
Author

@aagrawal05 did you mean to close this PR?

Whoops yeah sorry, I must have clicked the wrong button!

@aagrawal05 aagrawal05 reopened this Aug 16, 2024
@aagrawal05
Copy link
Author

Ok I've added the other extensions and tests, please take a look.

Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
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 Show resolved Hide resolved
azeey and others added 2 commits August 16, 2024 15:54
@aagrawal05
Copy link
Author

aagrawal05 commented Aug 17, 2024

Ok all the above changes should be addressed—I was mistaken about how the reference works.

This passes all the tests now and should be ready. Please let me know if anything further is needed, @azeey.

Signed-off-by: Aditya Agrawal <agraw17107@gapps.uwcsea.edu.sg>
sdf::ParserConfig config;
parser.InitModelString(str, config, &sdfResult);

EXPECT_PRED2(sdf::testing::contains, buffer.str(),
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 here why the two link1s are not the same? I believe the і (https://www.compart.com/en/unicode/U+0456) in <gazebo reference="lіnk1"> is the issue.

parser.InitModelString(str, config, &sdfResult);

EXPECT_PRED2(sdf::testing::contains, buffer.str(),
"<link> tag reference[link1] does not exist"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the error message reference visual1?

Suggested change
"<link> tag reference[link1] does not exist"
"<link> tag reference[visual1] does not exist"

Copy link
Author

Choose a reason for hiding this comment

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

Yep looking into this. I'be tried using _elem->Attribute("name") but that doesn't give it either-often giving the link or something different. Similarly the sdfVisualName doesn't seem correct. I'm tracing the code to see if there's an easy way to get the refString from parseURDF but it's taking a bit longer because of my unfamiliarity with the codebase. Please let me know if my approach is correct.

parser.InitModelString(str, config, &sdfResult);

EXPECT_PRED2(sdf::testing::contains, buffer.str(),
"<link> tag reference[link1] does not exist"
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
"<link> tag reference[link1] does not exist"
"<link> tag reference[collision1] does not exist"

sdf::ParserConfig config;
parser.InitModelString(str, config, &sdfResult);

EXPECT_PRED2(sdf::testing::contains, buffer.str(),
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 comment why the two joint1s are different?

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.

Some syntax errors in the URDF.

Comment on lines +2526 to +2528
<box>
<size>1 1 1</size>
</box>
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
<box>
<size>1 1 1</size>
</box>
<box size="1 1 1"/>

Copy link
Author

Choose a reason for hiding this comment

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

Yep, will add to next commit

<size>1 1 1</size>
</box>
</geometry>
<material>
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
<material>
<material name="mat1">

"<joint> tag reference[joint1] does not exist"
" in the URDF model. Please ensure that the reference attribute"
" matches the name of a joint.");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've noticed with this PR that even properly working URDFs print a warning message. Do you mind adding a test with a URDF that has a correct reference and check that there is no warning printed.

Copy link
Author

Choose a reason for hiding this comment

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

Yep ran into this while addressing the previous point. Will do.

@aagrawal05
Copy link
Author

Apologies for the delay in resolving this PR. Finding a solution is taking longer than expected and I am currently traveling. I will try to push my changes by the end of this week.

@azeey azeey removed the beta Targeting beta release of upcoming collection label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

URDF to SDF conversion silently ignores <gazebo> tag with non-existing reference
4 participants