##### Hexapods, White Paper

##### White Paper

# How to Manipulate Objects in Six Degrees of Freedom with Hexapods

###### Sean Hart

###### Applications Engineer

Hexapods are incredibly useful tools for manipulating objects in six degrees of freedom. As the name suggests, a hexapod is a robot featuring six independently controlled struts that are coordinated to move an object in six degrees of freedom. Those familiar with robotics will know that an object’s position and orientation in space can be fully defined by three translational positions, X, Y and Z, and three rotational positions, A, B and C. Although various robotic devices, including robotic arms, can move in six degrees of freedom, hexapods uniquely combine flexibility and precision.

The use cases for hexapods are broad, ranging from inspection to sensor calibration and beam steering. For example, hexapods are perfect for testing gyroscopic sensors because of their ability to move in all three translational and angular directions. Hexapods also are an excellent choice for accessing those hard to reach areas in a coordinate measuring machine (CMM) inspection process. Synchrotrons, such as the Large Hadron Collider in Switzerland, use beams of light to accelerate particles. As this paper will demonstrate, hexapods (especially ones that can be programmed using multiple coordinate frames) are an apt choice for steering beams of light.

Hexapods are well suited for these types of applications due to their compact size and ability to precisely orient an object in space. With such a variety of use cases, hexapods need to have a flexible programming scheme that enables users to change between multiple coordinate systems. For example, a user may want to program relative to a fixed point in space or a tool mounted on the hexapod. Often, the user will program using both and swap multiple times within a program.

Hexapod programming is a deep subject, and fully understanding how they work requires expertise in control theory and kinematics. This paper will focus on a practical use case of hexapod programming and describe how a hexapod can be programmed to manipulate a beam (for example, a laser) and place it precisely at a point of interest in space.

The first and perhaps most important step in programming a hexapod is defining the coordinate systems. In this beam steering example, three coordinate systems need to be defined: a target in space, a mirror mounted to the hexapod and the hexapod itself [ref. Figure 1]. In Aerotech hexapod nomenclature, the square target is defined as the “work” and the mirror fixed to the hexapod as the “tool.” The hexapod is called “hexapod,” but it is defined in the command *SetWorldToBase*.

Looking at Figure 2, note the world coordinates at the center of the hexapod base and the XYZ reference plate on the base of the hexapod (circled in blue). Every Aerotech hexapod has a pre-defined XYZ coordinate system. In this particular example, the hexapod base coordinates have been aligned with the world coordinate system. Since the hexapod base coordinates are already aligned to the world coordinates, the command to issue is:

*SetWorldToBase(0,0,0,0,0,0)*

The arguments for this command are (Xoffset, Yoffset, Zoffset, Aoffset, Boffset, Coffset), where the ABC offsets are Bryant angles. With Bryant angles, the order of rotations is A, then B, then C. This will be important later when rotating tool and work coordinates.

It is convenient to program using a coordinate system placed at the center of the target. This coordinate system is fixed in space and does not move relative to the hexapod. This will be defined as the work coordinate system.

To define the work coordinates, look at the relative offsets from the world coordinate system in a SetWorldtoWork(X,Y,Z,A,B,C) command. The world coordinates are at the center of the hexapod base and orientated as shown in Figure 2. In this example, the target is located 1000mm positive along the X axis, 0mm on the Y axis and 400mm positive along the Z axis. Therefore, the XYZ portion of the command is (1000, 0, 400).

Note in Figure 2 that the work coordinates have also been rotated relative to the world coordinates. Relative to world coordinates, X is along the negative Y axis, Y is along the positive Z axis and Z is along the negative X axis. Remember that Bryant angles must be performed in sequence: A, then B, then C. Rotation in A causes a rotation of the Y and Z axes, B rotates X and Z, and C rotates X and Y. The Bryant angle rotations that align the world to work are 90 degrees about X (rotate A), then -90 degrees about Y (rotate B) and there is no rotation about Z (rotate C). Figure 4 shows the rotation sequence for world to work coordinates and the end result of the following command:

*SetWorldToWork(1000,0,400,90,-90,0)*

The final coordinate system to define is the tool coordinate system. Tool coordinates are used to define the location and orientation of a tool that is fixed to the hexapod platform. Unlike world and work coordinates, which are fixed in space, the tool coordinates move with the hexapod. This is important because any rotation performed by the hexapod will simultaneously rotate the tool coordinate system. Having an active tool also means the hexapod will perform rotations about the tool coordinates. This is an important feature for beam manipulation because the mirror must be rotated without causing linear translations. The tool, in this case the mirror, can be located at any point and the hexapod will rotate perfectly about its center. In this example, the mirror is positioned 50mm above the center of the hexapod platform (ref. Figure 2). To maintain the same orientation for the tool coordinates as the work coordinates, the SetToolPoint command will need the following syntax:

SetToolPoint(1,”Mirror”,0,0,50,90,-90,0)

Now that all coordinate systems are defined, the hexapod can be programmed using either tool or work coordinates and it will move; however, it may not yet move as required for this application. Because this example’s objective is to orient the mirror to precisely point the laser beam at an XY position on the target, the optical configuration and the relationship between XY position and mirror angles have to be taken into account.

When using a reflective optic, the output angle of the beam will be equal to the input angle. This means an angle commanded to the hexapod will result in a doubling of the optical angle. Therefore, the relationship between hexapod angle (θ_{Hex}) and optical angle (θ_{op}) is:

θ_{Hex} = ½·θ_{op}

*Equation 1: The relationship of hexapod angle to optical angle.*

Now that the angular relationship has been established, consider which axes must rotate to achieve the correct XY position. Refer to Figure 2 and recall that the hexapod rotates about the active tool (“mirror”). To move along the X axis in the work coordinate frame, a command rotation about Y (θ_{B}) is required. However, a positive rotation about Y would move the laser into the negative quadrant. Therefore, using a negative rotation about Y will affect a positive move in X. Figure 2 also shows how a rotation about X (θ_{A}) would result in a positive translation in Y. The relationship is visualized in Figure 5.

Using the known positions X_{1} , Y_{1} and the straight-line distance to the target, R, the angle can be calculated with an atan2 function. Recall Equation 1 and the relationship between optical angle and hexapod angle. In addition to Equation 1, θ_{B} has an inverse relationship to X_{1}. Therefore, the final equations to relate X_{1} and Y_{1} to θ_{A} and θ_{B} are as follows:

θ_{A} = ½·atan2(Y_{1} , R)

θ_{B} = -½·atan2(X_{1} , R)

*Equation 2: The relationship of hexapod angles to X and Y position.*

This relationship can be programmed a number of ways. This example shows how a macro can be used to convert X, Y and R inputs into A and B angles. The input variables in the macro are $xpos, $ypos, and $radius (all units in meters). The macro then applies Equation 2 and converts from radians to degrees before sending the command as a G1 move to A and B axes.

```
#define pi 3.14159265359
#define rad2deg 180/pi
#Macro CommandXYR($xpos, $ypos, $radius) $xangle=-1*rad2deg*0.5*ATAN2($xpos,$radius)\
$yangle=rad2deg*0.5*ATAN2($ypos,$radius)\
G1 A $yangle B $xangle\
```

*Figure 6: An example macro called ‘CommandXYR’.*

The following example program demonstrates a sequence of moving to each of the four corners of the target and then back to center using the macro *CommandXYR*.

```
DVAR $xangle, $yangle
SetWorldToWork(1000,0,400,90,-90,0)
SetWorldToBase(0,0,0,0,0,0)
SetToolPoint(1,"Mirror",0,0,50,90,-90,0)
Absolute
ActivateTool("Mirror")
EnableWork
dwell 0.1
CommandXYR(0.25, 0.25, 1) // move 1
CommandXYR(-0.25, 0.25, 1) // move 2
CommandXYR(-0.25, -0.25, 1)// move 3
CommandXYR(0.25, -0.25, 1) // move 4
CommandXYR(0 ,0, 1) // move 5
End Program
```

*Figure 7: An example motion program.*

Using the work coordinate system and rotations about the tool, the beam can be angled precisely at the target. Since all three coordinate systems have been established, the user is free to program in any manner. It may be necessary to translate the optic in work coordinates or use tool coordinates to perfectly align the input beam and optics. This example is just one approach to one application. Every hexapod application offers unique challenges and considerations. A flexible programming approach and the ability to move freely between coordinate systems makes it possible to address those challenges. Aerotech offers expertise in motion control and is willing to work with you to solve your hexapod application needs.