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

Add Support for SDF #1763

Merged
merged 16 commits into from
Nov 7, 2024
Merged

Conversation

Amronos
Copy link
Contributor

@Amronos Amronos commented Sep 25, 2024

Fixes #632
I have modified hardware_interface/src/component_parser.cpp to add support for SDF models.

To test this out the demos being added through ros-controls/gz_ros2_control#427 can be used.

Signed-off-by: Aarav Gupta <[email protected]>
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.99%. Comparing base (d714e8b) to head (26b7f3b).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hardware_interface/src/component_parser.cpp 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1763      +/-   ##
==========================================
- Coverage   88.01%   87.99%   -0.02%     
==========================================
  Files         121      121              
  Lines       12403    12411       +8     
  Branches     1108     1108              
==========================================
+ Hits        10916    10921       +5     
- Misses       1083     1085       +2     
- Partials      404      405       +1     
Flag Coverage Δ
unittests 87.99% <80.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
hardware_interface/test/test_component_parser.cpp 98.83% <100.00%> (+0.01%) ⬆️
hardware_interface/src/component_parser.cpp 94.47% <66.66%> (+0.04%) ⬆️

... and 1 file with indirect coverage changes

@Amronos Amronos requested a review from saikishor September 27, 2024 13:52
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

@Amronos The changes look good to me. Can you add that SDF parsing is also supported through robot_description topic in the release_notes.rst?.

Sorry for not pointing out earlier

Signed-off-by: Aarav Gupta <[email protected]>
@Amronos Amronos requested a review from saikishor September 27, 2024 16:01
saikishor
saikishor previously approved these changes Sep 27, 2024
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM

@azeey
Copy link

azeey commented Oct 3, 2024

This is great! Thanks @Amronos

@Amronos
Copy link
Contributor Author

Amronos commented Oct 7, 2024

Are there any updates on when this PR can be reviewed and merged?

@christophfroehlich
Copy link
Contributor

Are there any updates on when this PR can be reviewed and merged?

Maintainers were busy with big PRs being merged the last days. We have so many other (older) PRs waiting for reviews, you can speed up the process by also reviewing them.

@Amronos
Copy link
Contributor Author

Amronos commented Oct 8, 2024

The test successfully_parse_valid_sdf is passing for me when running colcon test, but failing in the GitHub checks. Any idea why this is the case?

@bmagyar
Copy link
Member

bmagyar commented Oct 10, 2024

Do you have a non-standard URDF library installed? The CI errors come from this segment

  // parse full URDF for mimic options
  urdf::Model model;
  if (!model.initString(urdf))
  {
    throw std::runtime_error("Failed to parse URDF file");
}

located here https://github.com/ros-controls/ros2_control/pull/1763/files#diff-ae927ba56161377a082def3ca0417c1052c37949d94e27a7713e3f9f798e790eR853
and the other print comes directly from within the initString() call from here

Seems legit to me but I'm wondering how it worked for you :D

@Amronos
Copy link
Contributor Author

Amronos commented Oct 17, 2024

Do you have a non-standard URDF library installed?

I don't have a non-standard URDF library installed and the test is passing for me.
I did try rebuilding with colcon and testing multiple times. I also tried re-cloning the repo.
I also tested with a regular ROS launch file, in which I passed the SDF file to robot_state_publisher.
Is it possible that something in the CI is outdated?

@christophfroehlich
Copy link
Contributor

Is it possible that something in the CI is outdated?

I don't think so, it fails on debian, RHEL and ubuntu

@Amronos
Copy link
Contributor Author

Amronos commented Oct 17, 2024

ros-controls/gz_ros2_control#427 should help in testing this PR.

@christophfroehlich
Copy link
Contributor

christophfroehlich commented Oct 30, 2024

I am confused. Debian and RHEL are compiling fine now, but the test fails on these systems. What could be different here compared to the ubuntu jobs?
on ubuntu it reports

6: Warning [Utils.cc:132] [/sdf/model[@name="my_robot"]/ros2_control[@name="GazeboSimSystem"]:<data-string>:L191]: XML Element[ros2_control], child of element[model], not defined in SDF. Copying[ros2_control] as children of [model].

which is fine I guess?

@azeey
Copy link

azeey commented Oct 30, 2024

@christophfroehlich in ros-controls/ros2_debian#11, even though sdformat_urdf was added to the .repos file, looking at the build logs shows that it was not built. Taking a closer look, I see that the set of packages to be built in the docker image is set in
https://github.com/ros-controls/ros2_debian/blob/ecfe2c5d801e0521f21402c3d8c88704df381c18/Dockerfile.debian12#L137-L144

and
https://github.com/ros-controls/ros2_debian/blob/ecfe2c5d801e0521f21402c3d8c88704df381c18/Dockerfile.debian11#L137-L144

but I don't see sdformat_urdf in there.

@christophfroehlich
Copy link
Contributor

christophfroehlich commented Oct 30, 2024

@azeey you are totally right, i fixed that and CI is happy now.

still on RHEL

dnf: Failed to detect successful installation of [ros-jazzy-sdformat-urdf]

I was on the wrong track again, because it compiles but behaves differently during runtime.

the gz_tools_vendor are merged but failed to build and sdformat_urdf still deactivated.

@azeey
Copy link

azeey commented Oct 31, 2024

the gz_tools_vendor are merged but failed to build and sdformat_urdf still deactivated.

It looks like an issue with the build infrastructure. I'm working with @cottsay to get it resolved.

@christophfroehlich
Copy link
Contributor

It looks like an issue with the build infrastructure. I'm working with @cottsay to get it resolved.

https://build.ros2.org/job/Jbin_rhel_el964__sdformat_vendor__rhel_9_x86_64__binary/
https://build.ros2.org/job/Rbin_rhel_el964__sdformat_vendor__rhel_9_x86_64__binary/

it seems this fails because tinyxml was not installed for urdf_parser as part of urdfdom

07:24:44 DEBUG: /usr/include/urdf_parser/urdf_parser.h:44:10: fatal error: tinyxml.h: No such file or directory
07:24:44 DEBUG:    44 | #include <tinyxml.h>
07:24:44 DEBUG:       |          ^~~~~~~~~~~

maybe not related to infrastructure, but only a missing dependency on rhel?

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

Thanks to all involved for pushing this!

@cottsay
Copy link
Contributor

cottsay commented Nov 4, 2024

The infrastructure issue was resolved, the build failure you're seeing now is legitimate.

maybe not related to infrastructure, but only a missing dependency on rhel?

Seems like a bug in sdformat or the rosdep rules at first glance. The CMakeLists.txt finds tinyxml2, but tinyxml.h is provided by tinyxml (not 2). There completely separate packages.

@cottsay
Copy link
Contributor

cottsay commented Nov 4, 2024

Ohh, wait - the include is referenced from the urdfdom-devel system package.

That's a missing dependency from the system package. I'll try to get it fixed upstream.

@azeey
Copy link

azeey commented Nov 4, 2024

The version of liburdfdom-dev in Ubuntu is 4.0.0 whereas in RHEL, it is 1.0.4, so there seems to be a significant difference. I'm not sure what the timeline would be to get the update upstream, so I'll do the the alternative thing and use the urdfdom package from packages.ros.org in sdformat_vendor.

@cottsay
Copy link
Contributor

cottsay commented Nov 4, 2024

I'm not sure what the timeline would be to get the update upstream

The same ABI stability we rely on to keep our builds turning over is the source of friction for getting this package updated. It's possible, but intentionally difficult to make such a large jump within a RHEL major.

Here's the bugfix to urdfdom in RHEL 9: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2024-2c516e302e

We can work around the problem in the rosdep DB until the update goes stable next week, but it will require re-blooming to take the new rule. If you think that urdfdom 1.0.4 is likely to work and you don't want to wait until next week, I can start that process.

@azeey
Copy link

azeey commented Nov 5, 2024

@cottsay and I spoke offline and agreed that using the ROS package urdfdom is the best option. New releases of sdformat_vendor are on their way:

@saikishor
Copy link
Member

@azeey Thank you for following up. Once these PRs are merged, we can trigger the CI.

I see that these are released to Rolling and Jazzy. Out of curiosity, with the Humble version of sdformat_urdf these tests are going to fail or would they work?.

We are making sure when the rolling is compiled from the source, it is compatible on Humble. That's the reason, I'm asking this question.

@azeey
Copy link

azeey commented Nov 5, 2024

I see that these are released to Rolling and Jazzy. Out of curiosity, with the Humble version of sdformat_urdf these tests are going to fail or would they work?.

We've changed how Gazebo packages (e.g. sdformat) are released into ROS in Jazzy, that's why these releases are necessary. For Humble, sdformat_urdf should work fine on Ubuntu without any of these changes. I'm not sure about RHEL though. Do you in RHEL for the rolling/humble compatibility?

@saikishor
Copy link
Member

We've changed how Gazebo packages (e.g. sdformat) are released into ROS in Jazzy, that's why these releases are necessary. For Humble, sdformat_urdf should work fine on Ubuntu without any of these changes. I'm not sure about RHEL though. Do you in RHEL for the rolling/humble compatibility?

For now, mainly focusing on the Ubuntu part. @christophfroehlich am I right?

@christophfroehlich
Copy link
Contributor

For now, mainly focusing on the Ubuntu part. @christophfroehlich am I right?

We have only Ubuntu CI jobs for that. But I'm personally interested in having this running on Debian (I use that in my main project). But if its compilable from source, then everything fine.

@Amronos
Copy link
Contributor Author

Amronos commented Nov 7, 2024

Can the checks be run again? I think they should pass now.
Thanks a lot everyone for all the help!

@azeey
Copy link

azeey commented Nov 7, 2024

RHEL is ✅ 🎉

I'm not sure why the Jazzy and Rolling Binary Build checks are failing. The error messages don't seem related to this PR.

@bmagyar
Copy link
Member

bmagyar commented Nov 7, 2024

Thank you! Those tests are failing because we have a new function recently released in real-time_tools that isn't in main yet. Good thing we have all the variations of CI setup ;) we are good to merge this as soon as it gets a second approval

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM

@saikishor saikishor merged commit 93a2a68 into ros-controls:master Nov 7, 2024
19 of 21 checks passed
@Amronos Amronos deleted the sdf-compatibility branch November 8, 2024 01:10
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.

Use ros2 control with sdf model
6 participants