Hexapod Inverse Kinematics Simulator
The Mathematics of a Hexapod Robot
Controlling a hexapod robot is really just a big math problem. A three-degrees-of-freedom hexapod uses a total of eighteen servos to move, three on each of the robot’s six legs. In order for the robot to move, the controller running the code must calculate the angles for each of these servos based on the user’s input.
The type of mathematics used to calculate the servo angles is called inverse kinematics. Several previous posts have discussed hexapod inverse kinematics including a broad overview of inverse kinematics in general, and the inverse kinematics calculations used for hexapods:
When I was building the Capers II hexapod robot (build instructions for which can be found on Instructables), it became extremely time-consuming and inefficient to troubleshoot the code by manually calculating the servo angles over and over again. So, to automate the process, I created a spreadsheet.
The speadsheet is interactive; it is designed to be a hexapod calculator. The speadsheet is divided into different blocks of calculations based upon the steps in the inverse kinematics algorithm described in more detail in a previous post. In columns A and B you will find a section titled Direct Inputs. This section is, in turn, divided into two subsections, Robot Geometry and Control Input.
The Robot Geometry section allows you to input the dimensions of your hexapod’s body, and the lengths of each part of its legs. The second section, Control Inputs, allow you to “move” the robot in the calculator.
Based on your inputs in the Direct Inputs section, the remainder of the spreadsheet performs all of the inverse kinematics calculations needed to translate the information in the Direct Inputs section into servo angles. There is much more information about these calculations in a previous post containing all of the inverse kinematics formulas used in the spreadsheet. You can also click any given cell in the spreadsheet to take a look at the formulas used.
Finally, the result of all the inverse kinematics calculations is a set of angles for the hexapod’s eighteen servos. These results are found in columns A and B, underneath the Direct Inputs section.
So, whether you want to troubleshoot the code running on your own hexapod, learn about hexapod inverse kinematics, or develop your own control algorithms, this hexapod simulation spreadsheet should prove useful.