Jak_o_Shadows Web

I really need a tagline



The forward and inverse kinematics of a Stewart-Gough platform are derived, and code created (available to download).


The forward and inverse kinematics of a stewart-gough platform are described, with explicit mention of coordinate systems and sign conventions.

Code Overview

configuration.py [Download]

This file defines the position of the sensors/actuators on the base and platform. Note that the attachment points of the platform/base are with respect to the platform/base coordinate system respectively. Also defined is the resting distance between the platform and base, as well as actuator/sensor length constraints, and attachment point angular constraints

fk.py [Download]

Does the forward and inverse kinematics. Requires Numpy, because matrix math is extensively used. Has the function ik(bPos, pPos, a, sqrt=True) for inverse kinematics - finding sensor/actuator lengths for a given platform position. Has the function fk(bPos, pPos, L) which finds the platform position/orientation for the given sensor/actuator lengths L.

Blender Simulator

To visualise the motion of the platform, instead of graphs, a 3D interface is used. This is based on Blender a free 3D modelling program. Utilising the Blender Game Engine (BGE), the position/orientation of the platform is updated, with actuators/sensors automatically updating due to rigid body constraints.

Brief Instructions

Brief because Blender has quite a learning curve in itself.

  • Download Blender. Delete the starting cube.
  • In Blender's text editor, open the scripts listed below in Blender Scripts.
  • Also open configuration.py in Blender.
  • Run makeObjects.py in Blender.
  • Setup this logic on the platform.
    Logic blocks that call the scripts mentioned below


conn.py [Download]

Helper library for threaded sockets. Puts both to-send and recieved messages into FIFO queues to be dealt with later. Python 2/3 compatible.

simAngles.py [Download]

Generates a csv of test positions for the platform. Independently sweeps each variable between a max and minimum range.

sendSimAngles.py [Download]

Sends the csv of test positions generated by simAngles.py to Blender for visualisation. Loops back to start.

msgpass.py [Download]

Connects to a serial port & reads in sensor values - will send platform position information to blender for visualisation. Will use the forward kinematics of fk.py to generate platform position/orientation from sensor lengths. UNFINISHED.

Blender Scripts

Note that some manual changes are required in Blender before visualisation can occur. These scripts do not do everything.

makeObjects.py [Download]

Using configuration.py from above, makes simple geometry to use in the visualisation. Requires minor work after (mostly rescaling) before use

createJoints.py [Download]

Creates the rigid body joints required for the sensor/actuators to behave. (Required makeObjects.py> to have been run in the past).

recieveAngles.py [Download]

Using a TCP socket (and conn.py), recieves platform position/orientation data and applies it to the platform generated by makeObjects.py

getLegLength.py [Download]

Gets the length of each actuator/sensor as it appears in Blender. Useful for checking if extension limits are being adhered to, or for checking that the forward kinematics is working.