Programming Waypoints in a Moving Frame

Brief: We show how trajectory waypoints can be programmed in a moving frame.

URScript API functions used in this example:

This is an example of using new world additions to the movel URScript command to follow a trajectory whose waypoint poses are defined in a moving part frame. The example adds an axis group with a single axis and then attaches a “part” frame to the axis. It then follows a square-shaped trajectory where each corner is defined as a pose in the “part” frame.

NOTE: This example does not drive any EtherCAT hardware and the external axes move only in the world model.

img

Let’s go through the example in greater detail:

Setting up the World and Axis

img

This resets the world model and then calls the configAxis subprogram, which is defined here:

img

The sub program adds an axis group called “positioner” located 0.3m in the x axis of the robot’s base frame and then adds an axis named “axis1” to the axis group. A frame called “part” is added to the world model placed -.15m in the x direction, 0.05m in the z direction of the “axis1” frame, and rotated 90 degrees around the y axis of the “axis1” frame. The “part” frame is then attached to the “axis1” frame.

Defining Waypoints

img

These poses define the waypoint poses of the trajectory’s four corners. The trajectory is a square shape with side of length 0.05m. Later in the calls to movel, we tell movel that the poses are defined in the moving “part” frame.

Starting Axis Thread

img

This starts up a new URScript thread that runs the subprogram called moveAxis, which is defined below:

img

The subprogram commands the axis to move at full acceleration but 1/10 of the max allowed velocity. The axis is driven back and from from its 90 deg position to its -90 deg position before coming to a stop back at the 0 deg position, where the thread terminates. See axis_group_movejfor more info.

Following TCP Trajectory

img

Tracking the “part” frame is first turned on using frame_tracking_enable so that subsequent TCP motions are perform in the moving “part” frame. A single struct argument with members ‘pose’ and ‘frame’ are used to pass the raw poses that were defined earlier in the program to the movel command and also indicate that the raw pose is defined in the “part” frame. See here for more info on passing a struct argument to movel. The square-shaped trajectory is completed 5 times in a loop and then the thread is joined.