Adding, Moving, and Attaching Frames

Brief: In this example, we show how to add, move, and attach coordinate frames in a Polyscope program.

New URScript functions used in this example:

The example program adds two frames, “frameA” and “frameB”. It then shows how to use the move_frame() command to rotate and move “frameA” in the z direction of the robot base frame. It moves “frameA” back to its starting location, attaches “frameB” to “frameA” and then moves “frameA” again demonstrating that “frameB” moves with “frameA” because of the attachment. Here’s the Polyscope program:

Program

Demonstration

img

img

Let’s go through the some highlights of this example in greater detail:

Resetting the World Model

img

This removes any frames that have been added to the world. It’s useful when the program is set to loop forever, otherwise, the calls to add_frame() later in the program attempt to add frames with the same name that already exists. This throws an error.

Adding Frames

img

This adds “frameA” and “frameB” to the world. The pose provided to add_frame is expressed in the robot’s “base” frame when adding “frameA”. When adding “frameB”, however, the pose is defined in “frameA” and is placed 0.25m in the -y direction of “frameA”. This illustrates how new frames can be added relative to existing frames.

Moving Frames

img

Line 9 moves “frameA” relative to it’s current position by 0.002m in its z direction (up in the demo gif) and simultaneously rotates itself by 0.05 radians around its own z axis. This shows how to make a frame move relative to itself.

Attaching Frames

img

This moves “frameA” back to its original starting pose in the robot “base” frame and then attaches “frameB” to it. Now that “frameB” is attached to “frameA”, the “frameA” can move around and “frameB” will follow. The relative pose between “frameB” and “frameA” will remain constant while “frameB” is attached to “frameA”.