robotlearn / pyrobolearn

PyRoboLearn: a Python framework for Robot Learning
Apache License 2.0
402 stars 62 forks source link

How to get the robot end-effector pose in the coordinate of object B (B is not the world or the robot link) #21

Closed TFLQW closed 5 years ago

TFLQW commented 5 years ago

I want to confirm that whether the package has the function to get the robot end-effector pose in the coordinate of object B (B is not the world or the robot link). If it has, i will be convinent.

TFLQW commented 5 years ago

I have also find a problem at pyrobolearn/utils/converter.py at the line 254 return np.quaternion(roll(data.ravel().tolist(), -self.convention)) this need to be changed as return np.quaternion(roll(data.ravel().tolist(), -self.convention)[0], roll(data.ravel().tolist(), -self.convention)[1], roll(data.ravel().tolist(), -self.convention)[2], roll(data.ravel().tolist(), -self.convention)[3]) else it will be push the errors like : TypeError: quaternion constructor takes zero, one, three, or four float arguments, or a single quaternion. If I use the function quaternion_distance(), args is ndarray type. @bdelhaisse

bdelhaisse commented 5 years ago

Hi,

You can get the pose of a link/object in the coordinate of another link/object by taking the poses with respect to the world frame and applying the proper transformations using the functions given in https://github.com/robotlearn/pyrobolearn/blob/master/pyrobolearn/utils/transformation.py

However, I could indeed add a method in the World class that would allow to do that.

TFLQW commented 5 years ago

Ok! I have adapted the method you advise. Thanks! By the way, did find that problem like I have found at pyrobolearn/utils/converter.py at the line 254? @bdelhaisse

bdelhaisse commented 5 years ago

Indeed, there seems to be a mistake at line 254 in converter.py: You can replace: np.quaternion(roll(data.ravel().tolist(), -self.convention)) by np.quaternion(*roll(data.ravel().tolist(), -self.convention)).

I added a * in front of roll. I just pushed that change in the last commit b1f4ac84f19d3ea17dddb6141071b67633975a8e

Best, Brian

TFLQW commented 5 years ago

Thanks, I will close this issue !