Recursive mimic joint?
It seems that the joint_state_publisher
is not able to mimic another mimic joint.
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs)
File "/opt/ros/kinetic/lib/joint_state_publisher/joint_state_publisher", line 212, in loop joint = self.free_joints[parent]
KeyError: u'<recursive_joint_name>'
The problem is addressable to the clear distinction between free and dependent joints, i.e. if a joint is dependent, it cannot be taken as reference for anyone else.
I see that this is not a real problem as I can mimic the base joint with the proper reduction multiplier. Nonetheless it becomes annoying with a long chain and it also could be not very intuitive at first glance.
I think that the best solution is to implement this workaround without creating an extra non-free-but-neither-only-dependent
category which could only mess up with the code.
I also think that I'm going to create a pull request in the following days, have you got any suggestions?
EDIT: Here is (possible?) simple modification of the part of interest:
# Add Dependent Joint
elif name in self.dependent_joints:
param = self.dependent_joints[name]
parent = param['parent']
factor = param.get('factor', 1)
offset = param.get('offset', 0)
while parent in self.dependent_joints:
param = self.dependent_joints[parent]
parent = param['parent']
factor *= param.get('factor', 1)
# the offset is relative only to the first parent
joint = self.free_joints[parent]
@David Lu, do you think it could work?
Go ahead and make a pull request and we'll go from there.
Perfect, I'm going to create it this evening