Linked Structures

Linked Structures

I have recently been writing the software to control my robotic arm which I have been building at the Shadow Robotic Workshop. The arm is based closely on a human arm, and has all the axis of freedom that a human arm is capable of. I wanted the software to be able to control the arm to the extent that I could specify where in space I wanted its hand, and the arm would move itself into the correct position. This required that I develop linked structures. This aparently is a branch of maths called inverse kinematics. It's mentioned a few times in various computer graphics books I have, but none of them really explain how to do anything useful with it. So this page will lead into the page about modeling a humanoid structure with a view to making really good looking games.

Manipulating linked structures allows us to model many objects with moving parts. Robots,animals, cranes, and other things with bendy movey bits on them can all be modeled in this way. Rendering packages like 3D Studio support this function, as is it absolutely essential for animating people and stuff like that. For example, a robotic arm has a base which rotates. Connected to the base is the first bit of the arm which can pivot up and down on the base. Connected to that is a hand which can move in and out. This and many other structures follow a similar pattern:

(pivot) :object: (pivot) :object: (pivot) :object

This document will try to explain how to compute the shape of these structures in 2D and 3D, how to model forces on the structure, and how to use them to control a complex mesh object surrounding them.

I will start off by explaining how to manage serial-link structures. ie, those without branching links, basically a series of hinges. The basic structure of this system is a series of objects of some length linked together by hinges. The hinges can pivot in the x, y or z-axis. (it is possible to have hinges which can pivot in any arbitary direction, but I will explain those later. Lets first look at the robot arm example. The structure is like this:

(y-axis) :base: (x-axis) :main arm: (telescopic) :hand:

red=base
green=main arm
blue=wrist

This is a serial linked structure. Here, the names of parts of the robot are enclosed in colons, and the names of pivots are enclosed in brackets. The x-axis goes from left to right, the y-axis goes from bottom to top, and the z-axis goes away from you. The names of the pivots describe how they can move. An x-axis pivot can rotate in the y,z plane. A telescopic joint can change length, rather like a telescope unsurprisingly.

A linked structure needs to have a starting point which stays still, while all the links that attach to it move, but remain connected to it. The starting point is not one of the objects above, it is usually the origin. To calculate the position and orientation of all the parts in space, it is usually easiest (although slowest) to start building up the object from the end. I will explain later how to create the objects straight into space later.

Lets say we wanted to make a model of our robotic arm with these conditions:

base angle = 90 degrees
Main arm angle = 60 degrees
wrist telescoped to 5 cm

The arm is constructed using this pseudo code:

loop through the objects starting from the last one end of loop

This is probably better explained using a series of pictures:

Here, the black sphere represents the origin. The Y-axis goes up, the X-axis goes right, and the Z-axis goes into the screen.

(1) Firstly the last object is created with its begining touching the origin, and the rest of it sticking in the Y direction.

(2) It is then rotated / moved depending on whether it is a rotational or telescopic joint. In this case it is a telescopic joint, so it is moved 5cm.
(3) Before the next object (main arm) is created, all the objects must be moved to make space for it. It is moved the length of the next object to be created.
(4) The main arm is now created.
(5) the main arm was to be positioned at 60 degrees, so all the objects currently in existance are rotated by 60 degrees.
(6) Before the base is created, the objects must be moved out of the way.
(7) The base is now created.
(7) Finally the base is rotated 90 degrees.

So, every time you need to generate the structure in space, follow those steps. I hope this is clear. It's quite hard to explain this kind of thing.

I have written an animated demo of this process to make it clearer. It's called linkdemo.