1

I have two frames at different joint locations of IIWA arm, using f1 = plant.GetFrameByName("iiwa_link_0", kuka_model) f2 = plant.GetFrameByName("iiwa_link_2", kuka_model)

I want to find the transformation between these two body frames(f1, f2).

Getting error when using f1.CalcPoseInBodyFrame() :

TypeError: CalcPoseInBodyFrame(): incompatible function arguments. The following argument types are supported: 1. (self: pydrake.multibody.tree.Frame_[float], context: pydrake.systems.framework.Context_[float]) -> pydrake.math.RigidTransform_[float]

What is the correct way to approach this problem?

Thanks, Sarvesh

1 Answers1

3

It would be helpful if you post the actual code giving you the error.

Worst case, you can do this:

context = ... # assuming you have a context where things are posed.

f1 = plant.GetFrameByName("iiwa_link_0", kuka_model)
f2 = plant.GetFrameByName("iiwa_link_2", kuka_model)
X_F2F1 = f1.CalcPose(context, f2)
Sean Curtis
  • 1,425
  • 7
  • 8
  • If the two frames are rigidly connected, is there a way to do this without using a context? – Mark Aug 07 '23 at 19:25
  • 1
    You still acquire frames f1 and f2 and then try this: ```py X_BF1 = f1.GetFixedPoseInBodyFrame(); X_BF2 = f2.GetFixedPoseInBOdyFrame(); X_F2F1 = X_BF2.inverse() * X_BF1. ``` Although, this assumes they're rigidly connected to the same body. If it's a frame on one body for which there's a welded path to another frame on another body, that becomes trickier. – Sean Curtis Aug 10 '23 at 06:45