[RQT_JTC] add unit tests for parse_joint_limits#2281
Open
lakhmanisahil wants to merge 2 commits intoros-controls:masterfrom
Open
[RQT_JTC] add unit tests for parse_joint_limits#2281lakhmanisahil wants to merge 2 commits intoros-controls:masterfrom
lakhmanisahil wants to merge 2 commits intoros-controls:masterfrom
Conversation
8 tasks
8 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2281 +/- ##
==========================================
+ Coverage 84.72% 85.18% +0.46%
==========================================
Files 153 154 +1
Lines 15362 15462 +100
Branches 1332 1335 +3
==========================================
+ Hits 13016 13172 +156
+ Misses 1858 1798 -60
- Partials 488 492 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
christophfroehlich
requested changes
Apr 11, 2026
Member
christophfroehlich
left a comment
There was a problem hiding this comment.
This looks very good, I only have some questions..
Comment on lines
+133
to
+134
| # Joint is not managed by this controller — skip silently | ||
| continue |
Member
There was a problem hiding this comment.
isn't this a behavior change?
| @@ -0,0 +1,339 @@ | |||
| # Copyright 2024 ros2_control Development Team | |||
Member
There was a problem hiding this comment.
Suggested change
| # Copyright 2024 ros2_control Development Team | |
| # Copyright 2026 ros2_control Development Team |
Comment on lines
+148
to
+155
| def test_fixed_joint_not_in_result(): | ||
| result = parse_joint_limits(_robot(_fixed("camera_mount")), []) | ||
| assert "camera_mount" not in result | ||
|
|
||
|
|
||
| def test_urdf_with_only_fixed_joints_returns_empty_dict(): | ||
| result = parse_joint_limits(_robot(_fixed("j1"), _fixed("j2")), []) | ||
| assert result == {} |
Member
There was a problem hiding this comment.
isn't the first test irrelevant if the result == {} acc. to the second test?
| continue | ||
|
|
||
| if name in dependent_joints: | ||
| continue |
Member
There was a problem hiding this comment.
this line has no coverage acc to codecov, isn't this valid and never reached as per the continue one line above?
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 #2253
What this PR does
get_joint_limits()read from a globaldescriptionvariable set only by a ROS topic subscription — impossible to unit test without a live node.This PR extracts all parsing logic into a new pure function
parse_joint_limits(urdf_string, ...)that takes the URDF directly as a string with no ROS dependency.get_joint_limits()becomes a thin wrapper that reads the global and delegates to it. The minidom parsing logic itself is unchanged.Files changed
joint_limits_urdf.pyparse_joint_limits()fromget_joint_limits()test/test_joint_limits_urdf.pytest/__init__.pypackage.xmlpython3-pytesttest dependencyTests (23 total, all passing)
safety_controllersoft limits — narrowed when flag isTrue, ignored whenFalsefree_joints<limit>for a required joint → raises with clear messagelower/upperon revolute → raises (minidom returns"", our code raises)velocity→ raises (same reason — our logic, not minidom's)