[rqt_jtc] Use urdf_parser_py#2254
Open
lakhmanisahil wants to merge 3 commits intoros-controls:masterfrom
Open
Conversation
This was referenced Mar 29, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2254 +/- ##
==========================================
+ Coverage 84.68% 84.78% +0.10%
==========================================
Files 153 153
Lines 15319 15224 -95
Branches 1332 1315 -17
==========================================
- Hits 12973 12908 -65
+ Misses 1858 1841 -17
+ Partials 488 475 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Member
christophfroehlich
left a comment
There was a problem hiding this comment.
Thank you! I think it is time for adding unittest with #2253 first, then it's easier to check if this PR is not causing any troubles.
| robot = xml.dom.minidom.parseString(description).getElementsByTagName("robot")[0] | ||
| try: | ||
| # urdf_parser_py does not recognize non-URDF tags such as | ||
| # <ros2_control> and raises an AssertionError. |
Member
There was a problem hiding this comment.
are <gazebo> tags fine here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #891
Description
This PR replaces the manual XML DOM parsing in
joint_limits_urdf.pywithurdf_parser_py.urdf.Robot, resolving the long-standing TODO in the code.This is a fresh implementation inspired by the stale PR #1982. It incorporates the review feedback and also fixes an additional bug that was not handled in that earlier attempt.
Why this change?
The previous implementation used
xml.dom.minidomto manually parse URDF XML, extract attributes, and handle missing values using exceptions. This approach was fragile and unnecessarily complex.The code already had a TODO suggesting migration to
urdf_parser_py, but an earlier attempt failed due to:Required attribute not set in XML: upper.This issue has now been resolved in newer versions ofurdf_parser_py, making the migration possible.What changed?
joint_limits_urdf.pyReplaced manual XML parsing (
xml.dom.minidom) withurdf_parser_py(using
Robot.from_xml_string()androbot.joints)Added preprocessing to remove
<ros2_control>tags before parsing(needed because
urdf_parser_pythrows an error on unknown tags)Fixed how missing joint limits are handled
0.0minval >= maxvalRemoved the old TODO comment.
package.xmlHow to reproduce and test
Setup with RRBot example 1
Expected output should show:
joint_trajectory_position_controllerasactivejoint_state_broadcasterasactiveforward_position_controllerasinactiveLaunch the GUI
# Terminal 3 ros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controllerExpected behavior
After this PR
urdf_parser_py.