-
Notifications
You must be signed in to change notification settings - Fork 525
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
Minor bug fix in rqt_joint_trajectory_controller #391
base: melodic-devel
Are you sure you want to change the base?
Conversation
minor modification on rqt_joint_trajectory_controller made robot_description to be redundant to allow clear / separated namespaces for multiple robots in use
ignores controller manager which do not have explicit access to a robot_description file within their or a global namespace o should not be incompatible with any previous functionality as far as I can judge
namespace variable ns was not properly assigned when there was a robot_description paramter set'
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.
Thank for raising this issue.
However, I don't agree with the look-up strategy.
We should replicated the actual behavior of joint_trajectory_controller
:
- Try
robot_description
in root namespace of the controller node () - Crawl up ALL parent namespaces.
If I am not mistaken, your code is not crawling all namespaces.
Perhaps it would be even better to change the behavior in both places to crawl up from controller namespace (eg. with initParamWithNodeHandle
)..
This would even allow to use different URDFs for different controllers.
...int_trajectory_controller/src/rqt_joint_trajectory_controller/joint_trajectory_controller.py
Outdated
Show resolved
Hide resolved
...int_trajectory_controller/src/rqt_joint_trajectory_controller/joint_trajectory_controller.py
Show resolved
Hide resolved
...int_trajectory_controller/src/rqt_joint_trajectory_controller/joint_trajectory_controller.py
Outdated
Show resolved
Hide resolved
...int_trajectory_controller/src/rqt_joint_trajectory_controller/joint_trajectory_controller.py
Show resolved
Hide resolved
…ontrols#391 In short: - changed two underscore variables to standard variable declarations - changed parameter call of robot_description to be inside condition check to prevent number of parameter calls
This could by achieved by calling some private API: rospy.client._init_param_server()
_, _, param_name = rospy.client._param_server.target.searchParam(self._cm_ns, 'robot_description`)
description = rospy.get_param(param_name) Please note: this does not work if the description gets remapped within the controller node. |
It depends on the use-case, which solution is preferable. |
One (simple) work-around: |
I think we are both misunderstanding each other a little, I think that is to my poor explanation. I ll give it another try: if running_jtc and not self._robot_joint_limits:
_description = rospy.get_param('robot_description')
self._robot_joint_limits = get_joint_limits(description=_description) is the version that was implemented, assuming that if there exist a global description which contains all valid URDF data there is. ns=self._cm_ns.rsplit('/', 1)[0]
if ns not in self._ns_checked:
try:
self._ns_checked.append(ns)
_description = rospy.get_param('{}/robot_description'.format(ns))
for _jnt, _lims in get_joint_limits(description=_description).iteritems():
self._robot_joint_limits[_jnt] = _lims
except KeyError:
rospy.loginfo('Could not find a valid robot_description parameter in namespace {}'.format(ns)) In addition, it is also not sufficient to check all description parameters upon start as robots may be added to an environment at runtime. As it can be seen in this function, the joint limits dict is obtained sequentially instead of only once |
add namespace to list before KeyError can occure otherwise recheck loop will mess up performance
I understood your problem with the different namespaces.. The only problem is that some names might be remapped globally.
I don't want to support dynamic description changes. |
I'd prefer the following approach:
|
Tbh, I think the current way, the joint_trajectory_controller is implemented seems to be most convenient, as it first checks the private namespace of the controller manager and then falls back to the global namespace if there is nothing to be found. If we would adjust the URDF parser the way you mentioned here, the only advantage would be to find description parameters in between the current and the global namespace, which I do not really see as an advantage, but I may have misundersood something here. Regarding your comment before: it was actually my intention from start, that the GUI follows the behavior of the controller, as the controller itself has no problem with the namespace nesting / separation. It is just the GUI that fails to adjust to the description parameter lookup. One has to admit that the GUI is monitoring all active controller managers and controllers, while the joint_trajectory_controller and controller manager isn't, such that the parsing has to initiated every time a new controller manager is spawned. I don't want to support dynamic description changes either, that's why every namespace is only parsed once in the current implementation and stored in the list such that the description is not altered. |
No, first it tries to find the description in If the control node was launched with |
@ipa-mdl: I don't understand everything in this issue, but wouldn't |
No, because it starts the search in rqt's namespace and crawls upwards |
Right. I'd missed the part where the search must start in the controller manager ns. |
I adjusted the checking to the behavior of Regarding the suggestion to adjust the behavior of joint_trajectory_controller, I rather disagree as this could theoretically lead to false parameter lookup procedures. In my opinion, having either a private and global description per controller manager is sufficient and should not be extended any further. Aside from that, joint_trajectory_controller would behave different than all other controllers after the change. But I might be wrong on the latter. |
@ipa-mdl and @VGab , is this still required? Can we advance on it? |
Ping |
Regarding my personal ROS-setup, that spawns robots in their individual namespace with a separate robot_description parameter for each of them, I depend on this issue to be fixed.Even though I can continue to work on my personal fork, I would welcome a merge. |
Dear @VGab, |
Hi,
I don't know if this is needed in general, but I ran into some problems when working with multiple robots without a joint robot_description parameter being set within ROS. The gui crushes due to a KeyError as there is no parameter set.
This bug fix just runs an additional search in the subnamespace of the controller manager and finally ignores the description and thus the joint limits evaluation from joint_limits_urtf.py, which is called from joint_trajectory_controller.py.
The changes have been tested on a ubuntu 18.04 bionic with ROS melodic and to the best of my knowledge backward compatibility is guaranteed. Nevertheless, as my insight into this package may be limited, I hope my adjustments do also meet your contribution guidelines and tests