Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Function to get the pose of an object with respect to a given frame

#1
Hi,

it would be nice to have an API function to get the pose of an object with respect to a given reference frame. I don't do robot programming very often, but everytime I do, that function would have helped me. I have writen my own, but I think this function could easily provided by you and maybe help other users as well.

Or is there such a function and I just didn't see it?

Kind regards,
Martin
#2
Hi Martin,
Thanks for writing in.
That's a nice suggestion. You can use the below function:


Code:
def CalculatePoseFrame2Object(frame, part):
"""Calculate the pose of any object with respect to any reference in RoboDK"""
# Get both poses with respect to the station reference (wrt-world coordinate system)
framePoseAbs = frame.PoseAbs()
partPoseAbs = part.PoseAbs()
#计算the pose of the object relative to the reference
pose = framePoseAbs.inv() * partPoseAbs
return pose
# Take the object
obj = RDK.Item('Sphere')
# Retrieve the reference
frame = RDK.Item('Frame 2')
#计算the relationship
pose = CalculatePoseFrame2Object(frame,obj)
# Display the result
print(pose)
RDK.ShowMessage("The relative pose is:\n" + str(pose))


Also, I have attached a station file where I use this function to calculate pose of a object with respect to another frame. I hope this helps you.

Let me know if you run into any other issues.

Cheers,
Vineet


Attached Files
.rdk PoseExample.rdk(Size: 668.28 KB / Downloads: 314)




Users browsing this thread:
1 Guest(s)