Disuniformity between the kinematic chain and the real behavior of the robot

Hi all,
I am new with Poppy robots.
I’m working with the Ergo-Jr robotic arm with the pen holder as an end-effector and I’m programming it through the jupyter notebook via local network.

I have observed that for those joints having the rotation axis matching the z axis of the world-frame (m1 and m4) there is a disagreement between what is considered a positive rotation on the kinematic chain, used for the forward and inverse kinematics, and the same rotation on the real robot.

In the following there is a script that highlights the problem:

from pypot.creatures import PoppyErgoJr
import matplotlib.pyplot as plt
import time

poppy = PoppyErgoJr(camera='dummy')
poppy.m1.goal_position = 90

ax= plt.figure().add_subplot(111, projection='3d')
poppy.chain.plot(poppy.chain.convert_to_ik_angles(poppy.chain.joints_position), ax).

Running the script the robot performs a counterclockwise rotation of 90 degrees of the first joint, while the plot of the chain performs a clockwise rotation of 90 degrees of the first joint.
The same result occurs performing the same rotation on the m4 joint.

Can anyone help me in fixing this problem? I need compliance in the results of these rotations.

Hey @ES91

I observe the same issue than you. This is more easily visible by plotting the axes, e.g:

from ikpy.utils.plot import plot_basis

I assume there is a bug in the kinematics chain somewhere, either in ikpy or in pypot, or the URDF. Observe that pypot can reverse each motor individually but none is reversed for the Ergo Jr here. You may declare your own IK chain and reverse the motors that should be, like for Poppy Torso.

1 Like

Yes, I think that i solved this issue by changing in the ik.py, the following:

raw_joints = [(j + m.offset) * (1 if m.direct else -1)
                      for j, m in zip(joints, self.motors)] 

into the following:

raw_joints = [(j + m.offset) *  -1
                      for j, m in zip(joints, self.motors)]

but only in the convert_to_ik_angles(self, joints) function.

Now the results of the kinematics chain are equal to those of the real robot for all the joints.
Thanks for the answer.

1 Like