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

(Python API) Mat.Offset() pose format

1. Documentation bug in :

"Calculates a relative target with respect to the reference frame coordinates. X,Y,Z are in mm, W,P,R are in degrees."

Arguments are rx, ry, rz, not W, P, R.  Not to be confused with which correctly lists rx,ry,rz.

2. As far as I can tell, Offset() uses a pose format unsupported by all the Pose_2_* functions, in that it wants rx,ry,rz in degrees.  The closest supported pose I found is Pose_2_TxyzRxyz(), which returns rx,ry,rz in radians.  So if I want to offset 2 poses relative to each other, I have to convert radians to degrees:

    a = robodk.Pose(100, 200, 300, 30, 45, 60)
    b = robodk.Pose(10, 0, 0, 0, 0, 0)

    x, y, z, rx_radians, ry_radians, rz_radians = robomath.Pose_2_TxyzRxyz(b)
    rx_degrees = math.degrees(rx_radians)
    ry_degrees = math.degrees(ry_radians)
    rz_degrees = math.degrees(rz_radians)
    c = a.Offset(x, y, z, rx_degrees, ry_degrees, rz_degrees)

It's also weird that Offset() wants broken out x,y,z,rx,ry,rz instead of taking a Pose: a.Offset(b).

3. If I have a reference frame with Pose f and its child target with Pose t, what's the equivalent math?  After a bunch of messing around with Offset(), looks like it's just f * t.  I can also get the same answer with the code above, but since most of the people looking at Offset() are probably trying to do what I was with two Poses, it's probably worth mentioning that they just need to multiply the poses together.
1. I have updated the documentation, it should reflect the change in the next publication.

2 and 3. If the two poses are known, we typically use new_pose = pose_a * pose_b directly.

Offset() is convenient on loops, for instance:

for i in range (10):
 pose_i = pose.Offset(0, 0, 0, rz=i*5)

Note that Pose_2_Staubli returns Pose_2_TxyzRxyz in degrees.
Please read the Forum Guidelines before posting!
Find useful information about RoboDK by visiting our Online Documentation.

Users browsing this thread:
1 Guest(s)