Ask Your Question

Recursive mimic joint?

asked 2017-01-09 08:23:05 -0500

alextoind gravatar image

updated 2017-01-09 10:49:31 -0500

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/", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/", 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?

edit retag flag offensive close merge delete


Go ahead and make a pull request and we'll go from there.

David Lu gravatar imageDavid Lu ( 2017-01-11 20:34:47 -0500 )edit

Perfect, I'm going to create it this evening

alextoind gravatar imagealextoind ( 2017-01-12 05:13:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-09 09:19:49 -0500

David Lu gravatar image

That's a use case I did not consider when originally implementing it. The code has been relatively ignored for years, so I'm sure it could use freshening up.

The frustrating part is that how different URDF tags are handled across different nodes is inconsistent, so there's not a great understanding of how mimic tags are used in different places, i.e. whether you should just mimic the base joint or not. In the context of this one node however, I think you should be able to recurse.

edit flag offensive delete link more


Thank you very much for your quick response! I know the problems, but I also believe that mimic joints are very helpful with some specific robotic mechanisms, e.g. when replicating a pure rolling motion among two meshes. If you have time I would be glad if you could have a look at the above proposal

alextoind gravatar imagealextoind ( 2017-01-09 10:57:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-01-09 08:23:05 -0500

Seen: 129 times

Last updated: Jan 09 '17