Hexapod v0.11

A project log for Scarab - Hexapod Robot

3D printed hexapod robot controlled by ROS

VladimirVladimir 04/01/2020 at 11:370 Comments

After creating the first version of a robot construction, inverse kinematic algorithms, basic software and testing workability, the aim is for the next version was to:

  1. Develop a forward kinematic algorithm
  2. Connect a remote controller
  3. Show the data on a computer screen as a plot in real time
  4. Modify the mechanical part according to previous mistakes

So the work was done and now you can see the results on the video:

All the source code in my GitHub page:

Remote controller

I decided to choose Sony Dualshock 4 as a remote controller just because I already have it. Connecting the gamepad to Ubuntu and using it in ROS is quite simple problem. Here and here you can see instructions how to do that. 

After installing a driver for the controller it was necessary to write down a node in order to control robot acting. The node is called ps4_control and you can find it in my GitHub repository.

Forward kinematic algorithm

On the basis of the selected type of a robot construction with an insectomorphic type of actuators, a solution of the direct kinematics problem is obtained using two methods: algebraic and geometric approach.

Algebraic approach comes down to a sequential multiplication of matrices describing coordinate systems:


is radius-vector describing the position of the end of the robot foot relative to the geometric center of the robot

is a matrix describing position of the foot attachment point relative to the geometric center of the robot's body

is a matrix describing the position of the i-th joint relative to the point of attachment of the leg.

Alternatively, there is a geometric method. It differs in that the spatial geometry of a limb is decomposed into several geometric problems on the plane. The figures show projections of the actuator on the YX and ZX planes, respectively.

The only variables in this system of equations are the values of the angles of the servos, which allow to accurately determine the position of the pedipulator relative to the origin of the robot.

Using the leg R2 (middle on the right side) as an example, I confirmed that both methods yield the same set of formulae for determining coordinates of the end of the leg:

\color{White} \large \theta_{i}

is an angle of i-th joint in the pedipulator;

x, y, z are the coordinates of the robot foot relative to the geometric center of the robot’s body;

\color{White} \large L_{i}is a length of i-th joint;;

W is robot body width.

To test the results of the approaches described above, a model was developed using the Matlab package. The obtained results were compared with the CAD model using the leg R2 as an example. The same angles were set in the joints of both the CAD model and the mathematical models, and then they were compared.

The results of the check revealed minor deviations in the resulting coordinate values. These deviations are not systematic and may be related to differences in algorithms for calculating trigonometric functions, the number of π, and possible rounding of preliminary results in SolidWorks and Simulink software products. At the same time, comparing the geometric and algebraic approaches, it was found that the results of calculating the coordinates of the end of the foot are almost identical for both approaches. Also note that the algebraic approach requires 40 multiplications, 17 trigonometry calculations, and 22 additions, while the geometric approach requires only 8 multiplications, 8 trigonometric calculations, and 12 additions.

Thus, it is concluded that the geometric method is more preferable for solving the problem of calculating kinematics for a walking device with an insectomorphic type of legs.

 Showing data on a screen

To output data from ROS network in the form of a plot I used an open source software which is called PlotJuggler. More information about it is here and here. This programme has a special streaming mode which can subscribe to every topics in ROS network and show them as plots.

On the first screenshot you can see plots with relationship between angles of servos and time and on the second one there is relationship between X and Y axes relatively of the centre of mass of the robot.


After the first experiment it was understood that it is necessary to modify some details. So the first modification was made for the body part. Now there is added power switches, diode indicators and rebuilded layout of interior devices.

It was also rebuild a coxa part in order to make it more durable. The previous one was deformed after a month of exploitation.

ROS network Architecture

Adding new nodes and changing some code parts of source brang to modification of ROS network architecture. Here is the explanation of each node:

Ideas for the Feature

I’m going to continue working with this project and here is ideas for the next release:

  1. To produce the other five legs
  2. To develop forward and inverse kinematic algorithm for all the legs
  3. To create URDF-model for the whole robot in order to check it in Rviz simulator.