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

Migrate to using TinyXML2 #264

Merged
merged 28 commits into from
Jul 17, 2020
Merged

Migrate to using TinyXML2 #264

merged 28 commits into from
Jul 17, 2020

Conversation

mjcarroll
Copy link
Contributor

This is the forward port of #241 for the current master branch sdf10.

@scpeters
Copy link
Member

there are some conflicts here, partially due to deprecation of the API's in parser_urdf.hh in the following bitbucket PR:

@azeey, we marked it as deprecated as of 9.2, and I think we are planning to remove it in 10.0? let's make a separate PR to move that header file from include to src, and then it will clarify the API impact of this PR

@scpeters
Copy link
Member

PR to not install parser_urdf.hh: #276

@scpeters
Copy link
Member

I just merged #276, which makes parser_urdf.hh a private header in the src/ folder, so I recommend rebasing on top of master

@EricCousineau-TRI
Copy link
Collaborator

@mjcarroll Do you know if you need a stable release for Ignition Dome (libsdformat10), or will y'all be fine with using master?

Asking in the context of #278, whether we should target libsdformat11 instead of libsdformat10.

@mjcarroll mjcarroll requested a review from scpeters June 1, 2020 14:12
@mjcarroll mjcarroll marked this pull request as ready for review June 1, 2020 14:12
@mjcarroll
Copy link
Contributor Author

@EricCousineau-TRI I would like to target dome.

@EricCousineau-TRI
Copy link
Collaborator

OK, thanks!

@scpeters
Copy link
Member

scpeters commented Jun 2, 2020

do you mind rebasing on top of sdf10 and changing the target of this PR?

@mjcarroll mjcarroll changed the base branch from master to sdf10 June 2, 2020 20:58
@mjcarroll
Copy link
Contributor Author

do you mind rebasing on top of sdf10 and changing the target of this PR?

Done! Thanks for getting that set up.

@scpeters
Copy link
Member

scpeters commented Jun 2, 2020

this PR is huge, but I'm not sure if there's a way to split up the changes. once you start parsing with tinyxml2, all the functions are going to need to read those data structures

Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

I'd like to see unit tests for XmlUtils

@mjcarroll
Copy link
Contributor Author

this PR is huge, but I'm not sure if there's a way to split up the changes.

One thing to reduce the size could be to do the conversion, and then the removal of the vendored TinyXML in a followup PR

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.

Looks good on first pass. I'll look into failing tests.

src/XmlUtils.hh Outdated Show resolved Hide resolved
src/parser.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.hh Outdated Show resolved Hide resolved
src/parser_urdf.hh Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
src/parser_urdf_TEST.cc Outdated Show resolved Hide resolved
src/parser.cc Outdated Show resolved Hide resolved
@mjcarroll
Copy link
Contributor Author

@scpeters How do I go about updating sdformat-ci-pr_any-ubuntu_auto-amd64 to install tinyxml2?

@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2020

Codecov Report

Merging #264 into sdf10 will decrease coverage by 0.19%.
The diff coverage is 78.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##            sdf10     #264      +/-   ##
==========================================
- Coverage   87.69%   87.50%   -0.20%     
==========================================
  Files          59       60       +1     
  Lines        9048     9085      +37     
==========================================
+ Hits         7935     7950      +15     
- Misses       1113     1135      +22     
Impacted Files Coverage Δ
src/SDFExtension.hh 100.00% <ø> (ø)
src/XmlUtils.cc 62.50% <62.50%> (ø)
src/parser_urdf.cc 79.43% <74.13%> (-0.78%) ⬇️
src/parser.cc 78.48% <83.82%> (-0.05%) ⬇️
src/Converter.cc 91.57% <92.94%> (+0.11%) ⬆️
src/Types.cc 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd119e5...7155942. Read the comment docs.

@mjcarroll
Copy link
Contributor Author

It appears that the example is failing due to a trailing quote in the simple.sdf file: https://github.com/osrf/sdformat/blob/master/examples/simple.sdf#L6

Is this intentional, or is it that TinyXML2 happens to be a bit more strict?

@scpeters
Copy link
Member

How do I go about updating sdformat-ci-pr_any-ubuntu_auto-amd64 to install tinyxml2?

the logic for the ubuntu build is in release-tools:

for homebrew, we'll need a new formula with different dependencies; I'll work on that

@scpeters
Copy link
Member

for homebrew, we'll need a new formula with different dependencies; I'll work on that

osrf/homebrew-simulation#1054

Signed-off-by: Michael Carroll <michael@openrobotics.org>
src/XmlUtils.cc Outdated Show resolved Hide resolved
src/XmlUtils.hh Outdated Show resolved Hide resolved
src/urdf/urdf_parser/joint.cpp Outdated Show resolved Hide resolved
src/urdf/urdf_parser/link.cpp Outdated Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
src/parser_urdf.cc Show resolved Hide resolved
src/parser_urdf.cc Show resolved Hide resolved
src/parser_urdf.cc Outdated Show resolved Hide resolved
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
@scpeters
Copy link
Member

@osrf-jenkins run tests please

@scpeters
Copy link
Member

the build farm is backed up, but I expect it to pass, so I'll approve

let's wait to merge until the last job finishes

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
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.

LGTM!

@scpeters
Copy link
Member

ok, it looks it just needs an update to the migration guide and changelog, and then we can squash and merge

@mjcarroll do you want me to update these?

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member

ok, it looks it just needs an update to the migration guide and changelog, and then we can squash and merge

@mjcarroll do you want me to update these?

updated in 7155942

@scpeters scpeters merged commit db28ef2 into sdf10 Jul 17, 2020
@scpeters scpeters deleted the tinyxml2_sdf10 branch July 17, 2020 17:11
scpeters added a commit to scpeters/sdformat that referenced this pull request Jul 17, 2020
* Remove vendored TinyXML
* Add FindTinyXML2 CMake Logic
* Add XmlUtils with test
* Update CI dependencies
* Allow trim to remove newlines as well
* Remove trailing quote in example sdf
* Make internal URDF parser use tinyxml2

Signed-off-by: Michael Carroll <michael@openrobotics.org>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
scpeters added a commit to gazebo-release/sdformat10-release that referenced this pull request Jul 18, 2020
This has changed recently:
gazebosim/sdformat#264
@scpeters
Copy link
Member

updating dependency in release repo: gazebo-release/sdformat10-release#1

scpeters added a commit that referenced this pull request Jul 21, 2020
* Remove vendored TinyXML
* Add FindTinyXML2 CMake Logic
* Add XmlUtils with test
* Update CI dependencies
* Allow trim to remove newlines as well
* Remove trailing quote in example sdf
* Make internal URDF parser use tinyxml2

Signed-off-by: Michael Carroll <michael@openrobotics.org>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
scpeters added a commit that referenced this pull request Nov 12, 2021
There is special handling in the parser_urdf code to
update plugin fields when links are merged together
during fixed joint reduction. A test for this was
added to sdf6 in #500. A portion of this test is
applied directly to the sdf10 branch to illustrate
a problem with ReduceSDFExtensionPluginFrameReplace
in parser_urdf.cc.

The original migration to use tinyxml2 in #264 changed
the data structure used in SDFExtension to store
XMLDocuments instead of XMLPointers, which requires
an extra call to FirstChildElement, but the
ReduceSDFExtension*FrameReplace functions did not
receive this update. The fix here refactors the function
arguments to pass the first child element directly,
which simplifies the helper function implementation.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants