RoboDK Forum
How to get & set reference frame of a target's pose?可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: How to get & set reference frame of a target's pose? (/Thread-How-to-get-set-reference-frame-of-a-target-s-pose)



How to get & set reference frame of a target's pose?-Maarten-02-14-2022

In the RoboDK API, how do I get and set the reference frame with respect to which the pose of a target is given?

Suppose I have a target named Tar01 which I retrieve as an item via:

tar = RDK.Item('Tar01',ITEM_TYPE_TARGET)

Then I can request its pose via:

tar.Pose()

How do I find with respect to which reference frame this pose is defined, and how can I set it to a different reference frame?

I expected to be able to use PoseFrame() and setPoseFrame(), but these appear only applicable to an item of type robot. I might be able to use the method proposed by Vineet在这里. In the RoboDK GUI the reference frame can simply be changed in a drop down menu ("Target position with respect to:...") from target options, so I'm looking for the API's analogy.

Best regards,

Maarten


RE: How to get & set reference frame of a target's pose?-Albert-02-14-2022

You can retrieve the parent of a target (usually the frame it is attached to) by calling Parent.

Example:
Code:
reference = target.Parent()
print("Target attached to: " + reference.Name())

# You can also move this target to a new reference:
target.setParent(new_frame)