Tuesday, March 29, 2016

Working with Planes in Kuka | prc

Kuka | prc is a method of driving Kuka robots using Grasshopper. This topic describes the use of planes when programming robot motion. (The larger topic of programming using Kuka|prc is here.)

You can think of a plane as an origin (location in space) and an orientation for the X, Y and Z axes (rotational direction of the axes). Planes are drawn in Grasshopper as a tiny grid, with the X and Y axes shown. You control the display size using the Grasshopper pull-down menu option Display > Preview Plane Size, then enter a size in model units.

You can create a Plane component in Grasshopper then right-click on it and choose Set one Plane. You are first asked to set the origin then asked to define the location of the X axis, then the Y axis. Note that once you define X and Y, then Z is defined automatically, perpendicular to X and Y, using the right-hand rule.

Planes are what are fed into the motion commands to move the robot. The plane specifies the location of the Tool Center Point (TCP) and the orientation for the robot face plate. So an understanding of them is essential to using Kuka | prc.

Generating Planes from Geometry

Planes drive the motion of the robot. Since we often want to follow geometry we've modeled or generated algorithmically in Grasshopper, there are a number of easy to use component which generate planes from geometry.

A simple example is creating planes to cause the robot to follow a curve. The Divide Curve component can be used to output points at equal intervals along the curve.

The planes appear in the viewport like this:

Note that these planes all have the exact same orientation. That's because the points were wired into a World XY component which set the constant orientation to match world XY. This is fine is the tool doesn't need to rotate along the curve.

It's also possible to generate the planes so they oriented tangent or perpendicular to a curve. To do so use the Horizontal Frames component.

The resulting planes. The X axis is tangent to the curve.

This can be used when you want the tool to rotate along the curve. For example if the tool was a knife cutter it needs to follow along tangent to the curve at all times.

It's also possible to generate frames which are perpendicular to the axis along the curve. To do so use the Perp Frames component.

The resulting frames:

Components

There are a number of useful Grasshopper components for dealing with planes, available in the Vector menu / Plane panel.

XY Plane, XZ Plane, YZ Plane

These components output planes matching the world XY, XZ and YZ coordinate systems all centered on the origin. You may wire in a different origin to move them around.

If you right-click on the origin socket and choose Extract Parameter Grasshopper wire in a Point component. You can then enable Gumballs in Grasshopper menus (Display > Gumballs). When you select the Point component you can use a small Gumball widget to graphically alter the point. Doing so interactively adjusts the robot position in the viewport.


Unit X, Unit Y, Unit Z

Also handy are the built in unit vectors for X, Y and Z. These are available in the Vector menu / Vector panel. You can wire in scale factors to change the magnitude of the vectors, or negative values to change their direction and magnitude.

Construct Plane

This component lets you construct planes by specifying an origin, and separate X, Y, and Z vectors to define the plane. See the image below under Deconstruct plane for an example in use.

Deconstruct Plane

This component lets you deconstruct a plane by breaking it into an origin and separate XYZ vectors. The example shown below uses both Construct and Deconstruct; you can see an origin point is wired into Construct Plane on the left (1.0 2.0 3.0). Also wired in are the standard X and Y vectors. This builds a plane, centered at world 1, 2, 3 aligned with the world XY plane.

The plane is then Deconstructed to show they match. So the origin output is 1, 2, 3. The X vector is in fact 1, 0, 0 and Y is 0, 1, 0. Z is, as expected, 0, 0, 1.

Adjust Plane

This component is very useful in re-orienting one of the standard planes. For example you can flip the Z axis of the plane to point in the opposite direction. Here you see a -1 factor wired into a Z vector which is wired into the normal of the Alter Plane. This flips +Z so it aligns with world -Z (down).

Note too how this example divides a curve up to generate the various origin points for the plane. You can see a list is output from Divide Curve. That's wired into the origin of the World XY plane.

Cross Product

Given two vectors this will output a new vector which is perpendicular to both those wired in. In the example below unit X and unit Y vectors are wired in. The output is unit Z (0, 0, 1) which, of course, is perpendicular to X and Y. 

No comments:

Post a Comment