Skip to content

Conversation

@Ashray4
Copy link

@Ashray4 Ashray4 commented Nov 2, 2025

Update joint-limits parsing to use urdf_parser_py

@Ashray4 Ashray4 changed the title updated to urdf parser from xmldom updated to urdf parser from xmldom (rqt_joint_trajectory_controller) Nov 2, 2025
Comment on lines +64 to +68
root = ET.fromstring(description)
for rc in root.findall("ros2_control"):
root.remove(rc)

cleaned_description = ET.tostring(root, encoding="unicode")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you comment on why we need to remove this?

Copy link
Author

@Ashray4 Ashray4 Nov 3, 2025

Choose a reason for hiding this comment

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

When i tested with ros2_control_demos , i got these unknown tags

ros2 run rqt_gui rqt_gui --force-discover -s rqt_joint_trajectory_controller
Waiting for the robot_description!
Waiting for the robot_description!
Waiting for the robot_description!
Unknown tag "ros2_control" in /robot[@name='2dof_robot']

also while testing with some robot descriptions with inertial tags as well

Unknown attribute "iyx" in /robot[@name='ur5e']/link[@name='robotiq_85_base_link']/inertial/inertia
Unknown attribute "izx" in /robot[@name='ur5e']/link[@name='robotiq_85_base_link']/inertial/inertia
Unknown attribute "izy" in /robot[@name='ur5e']/link[@name='robotiq_85_base_link']/inertial/inertia

Copy link
Contributor

@christophfroehlich christophfroehlich Nov 3, 2025

Choose a reason for hiding this comment

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

ok it seems that the parser is very strict with that. iyx/izx/izy does not exist in the spec, this really is an issue in the URDF.

Unless there isn't a possibility to switch to a robust mode in the urdf module, your fix seems to be fine!

Copy link
Author

Choose a reason for hiding this comment

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

i will check if there is a possibility of the robust mode, and also write the test case as you mentioned

# TODO: Use urdf_parser_py.urdf instead. I gave it a try, but got
# Exception: Required attribute not set in XML: upper
# upper is an optional attribute, so I don't understand what's going on
# See comments in https://github.com/ros/urdfdom/issues/36
Copy link
Contributor

Choose a reason for hiding this comment

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

if fixed, please remove L21-24

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

I have some comments.
Apart from that, I think we easily could write a unit test for this class. At least some sort of smoke test with a valid robot_description from the assets we have.

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 0% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.17%. Comparing base (2cd0d47) to head (36e869c).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...t_joint_trajectory_controller/joint_limits_urdf.py 0.00% 40 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1982      +/-   ##
==========================================
+ Coverage   85.11%   85.17%   +0.06%     
==========================================
  Files         143      143              
  Lines       13740    13730      -10     
  Branches     1201     1200       -1     
==========================================
  Hits        11695    11695              
+ Misses       1638     1628      -10     
  Partials      407      407              
Flag Coverage Δ
unittests 85.17% <0.00%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
...t_joint_trajectory_controller/joint_limits_urdf.py 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants