-
Notifications
You must be signed in to change notification settings - Fork 407
fix issue of not listing new JTCs #1891
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
fix issue of not listing new JTCs #1891
Conversation
the problem was that we initially load only the joints limits for the joints used in active JTCs. Then in the future when we check for JTCs, we ignore any JTCs if a joint is missing. my fix is to load all joint limits in the robot description.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1891 +/- ##
==========================================
- Coverage 85.13% 85.12% -0.02%
==========================================
Files 143 143
Lines 13742 13744 +2
Branches 1200 1201 +1
==========================================
Hits 11699 11699
- Misses 1636 1638 +2
Partials 407 407
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. I was able to reproduce the issue, and that this PR fixes it!
(cherry picked from commit 56c6fa0)
(cherry picked from commit 56c6fa0)
The Problem
If you launched
rqt_joint_trajectory_controller
with one JTC running, then started a new JTC with different joints, it would not show up.How to reproduce the problem
left_arm_jtc
) running for some jointsros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controller
and see you controller listed thereright_arm_jtc
) which controls some different jointsWhy does this happen?
Because the timer callback code actually only load of the joints limits from the URDF once, and only checks for joints "used" by the JTC, ignoring all other joints. Then when we check for new JTCs, they get filtered out as "invalid" because the code checks if we know the limits of the joints, which we do not if the new JTC has different joints than the initial set.
Proposed solution
Load all joint limits in the robot description into
JointTrajectoryController._robot_joint_limits
.This still assumes the URDF never changes.
But now you can start new JTCs and they are automatically listed!
To be honest the diff display makes this look more confusing than it is. All I did was move the
if name in joints_names:
check inside theexcept IndexError
clause. That way, we still throw an error if somehow the urdf does not contain a limit for a joint which is needed by a JTC.Also, I snuck in one other small fix.
The change to
utils.py
fixes this error message. You can get this error (randomly) when starting JTC just becausenode.get_service_names_and_types()
sometimes takes a second to return everything.Please let me know if I should also make PRs for humble/jazzy!