3D printed hexapod robot controlled by 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:
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:
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...
Read more »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:
See my github page for the full source code https://github.com/yoggi56/hexapod