Studying at university I had a project of modelling a hexapod robot. Later I decided to put it into practice. So now I'm developing this robot and testing one leg motion and control.
In the future it will be 18 DOF six legged robot acting by Dynamixel AX-12A servos, controlled by Odroid-C2. All the robot details is going to be designed in Solidworks and produced on 3D-printer. It works on Ubuntu Mate 16.04, the code is written in C++ and running ROS.

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:

Develop a forward kinematic algorithm

Connect a remote controller

Show the data on a computer screen as a plot in real time

Modify the mechanical part according to previous mistakes

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

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:

where

is radius-vector describing the position of the end of the robot foot relative to the geometric center of the robotis a matrix describing position of the foot attachment point relative to the geometric center of the robot's bodyis 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:

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;

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...

Here is the first experiment with a robot leg and solving inverse kinematic problem algorithm. Software was written in C++ running ROS Kinetic. A marker was attached to the end of the leg in order to check correctness of the algorithm. Also reference trajectory is a circle.

This is a visualized scheme of software.

Every node has a special function:

circle_traj_generator - forms a reference circle trajectory for the end of the leg