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:

All the source code in my GitHub page: https://github.com/yoggi56/hexapod

**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:

where

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:

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

**Mechanics**

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:

- ds4_driver - driver node for Dualshock 4.
- ds4_control - gets data from the gamepad driver, process it, forms a trajectory and sends reference points for the end of the leg.
- geometry_constraints - service which calculates geometry constraints for the end of the leg position. Input: reference point, output: possibility of using this point.
- leg_inv_kinematic - solves inverse kinematic problem. Input: reference coordinates. Output: reference joint angles.
- dynamixel_control - connects to servos, set their params and transforms angle data from double to format understandable for a dynamixel driver.
- dynamixel_manager - dynamixel driver that gets data about angles and send it to a serial port.
- dynamixel_read - reads current angles data from servos and translate it into more useful form.
- leg_forw_kinematic - solves forward kinematic problem. Input: current joint angles. Output: current the end of the leg position.

**Ideas for the Feature**

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

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

## Discussions

## Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.