Hexapod Forward and Backward Movement Calculation and Algorithm

By Chau To

Introduction:
Hexapod uses the tripod gait (3-leg combined showed in Figure 1) to perform forward and backward movement. In order for the Hexapod to move in a straight line, it is required all of the servos such as shoulder, femur, and tibia servo to be operated simultaneously. This blog post will give a detail calculation for the angle that each servo needs to make to compensate with one another. This blog post will also introduce the algorithm for the Hexapod forward and backward movement.

Hexapod Movement Analysis and Calculation:
The Hexapod will use 3 legs at the same time for movement as showed in Figure 1.

 figure 1

Each leg composed of a femur and a tibia and is controlled by 3 servos: shoulder servo, femur servo and tibia servo as showed in Figure 2. 

figure 2

 

 Forward and backward movement analysis:
When the Hexapod is moving, if the Tibia servo does not rotate, the Hexapod body will be shifted by the “x” distance (bottom picture in figure 3.) The purpose of the following calculation is to find the angle of the Tibia and Femur to compensate and to prevent the “shifted body problem.”

Let’s declare the variable like in figure 3:

figure 3

 

  • F is the length of the Femur (from the shaft of the Femur servo to the shaft of the Tibia servo)
  • T is the length of the Tibia (from the shaft of the Tibia servo to the ground)
  • α is the angle of the Tibia assuming that the initial position of the Tibia is perpendicular to the ground.
  • β is the angle of the Fumur assuming that the initial position of the Femur is parallel to the ground.
  • A is the project of the leg on the ground
    • θ is the angle the shoulder servo rotates
    • x is the distance that the body is shifted

 Let’s α’ be the new angle of the Tibia servo to compensate the x distance:

 The angle that the Tibia servo has to adjust:

 In order to balance the Hexapod, the Femur servo also has to rotate to a new angle

Let’s y is the length the Femur need to compensate like in Figure 4

 figure 4

Let β’ be the new angle of the Femur servo to compensate the x distance:

 The angle that the Femur servo has to adjust:

Example: Hexapod matching the speed of the Rover 0.2m/s
In order to match the speed of the Rover, each Hexapod step needs to be 4 inches assuming that the Hexapod takes 2 steps in 1 sec, and the speed of the Rover is 8 inches/s

Let the length of the Femur: F = 3 inches, length of the Tibia: T = 6 inches, and α = β = 300

  • A = 6sin(30)+3cos(30) = 5.5980 inches

To reach 4 inches, Let θ = 450  à Hexapod step will be: Asin(45) = 3.958 inches.

So, with this setting, the Hexapod should be able to match the speed of the ROVER!!!

Let calculate the angle of the Tibia and Femur for the forward movement:

  • x = A – A cos(θ) = 5.5980-5.5980*cos(45) = 1.159 in
  • α’ = 43.88660
  • ∆α = 43.8866 – 30 = 13.88660 (from initially 300 to 43.8860)
  • y = 0.8718 in
  • β’ = 120
  • ∆β = -180 (from initially 300 down to 120)

In summary, in order for the Hexapod to move in straight line with a step of 4 inches with the settings in the example, the shoulder servo needs to rotate 450; the tibia servo need to rotate an extra 140 and the femur servo also needs to rotate an extra 180.

Movement Algorithm:
Screenshot (33)

Delay is very important because it requires certain time for each servo to rotate. Therefore, each delay makes sure that the previous stage is completed. Maximizing the delay also increased the performance of the Hexapod. 

At the final stage when the shoulder servo rotates back to –θ, i.e it means that the servo rotate to the initial angle before the robot move. The delay between each rotation is very important and needs to be precise because each angle of the leg servos might be different from each other.