Genetic algorithm is used to optimize the trajectory of a Stanford manipulator. The objective is to minimize the movement distance of the manipulator's end effector by optimizing the sequence and timing of joint movements.
According to the initial posture matrix, the inverse kinematics model established by Denavit-Hartenberg method is used to find the initial state of each joint. In accordance with the given beginning moment, cubic polynomial interpolation is applied to each joint variable and the positive kinematic model is used to calculate the end effector path. Genetic algorithm is then used to optimize the sequential order of each joint and the time difference between different starting time of joints, with an objective function of minimizing the path of end effector.
Unoptimized Path:
Optimized Path:
To plan the trajectory, cubic polynomial interpolation is applied to each joint variable. This interpolation ensures smooth transitions by maintaining continuity in position, velocity, and acceleration, which reduces mechanical stress and ensures efficient movement. The end effector's path is computed using the positive kinematic model based on the given starting conditions.
Initialization:
Function initialization(pop_size, chromo_size)
Input:
int pop_size;
int chromo_size;
int array[2] pop(pop_size, chromo_size);
Output:
for i = 1 to pop_size
for j = 1 to 2 × chromo_size
pop(i, j) = round(rand);
end for
end for
end Function
Fitness Function:
function score = fitness(individual, chromo_size, theta_10, theta_1f, theta_20, theta_2f, d_30, d_3f, tf)
bits = individual;
[t2, t3] = decode(bits, chromo_size, tf);
score = distance(theta_10, theta_1f, theta_20, theta_2f, d_30, d_3f, t2, t3, tf);
end
Selection:
Crossover:
Mutation:
Iteration:
The goal is to minimize the movement distance L of the end effector by finding optimal values for t2 and t3
The calculation of the distance L(t2, t3) involves piecewise functions based on the ranges of t:
$$ When \ 0 < t \leq t_2:$$
$$L = \int_{0}^{t_2} (\dot{x}(t))^2 + (\dot{y}(t))^2 + (\dot{z}(t))^2 \, dt$$
$$ When \ t_2 < t \leq t_3:$$
$$L = \int_{t_2}^{t_3} (\dot{x}(t))^2 + (\dot{y}(t))^2 + (\dot{z}(t))^2 \, dt$$
$$ When \ t_3 < t \leq t_f:$$
$$L = \int_{t_3}^{t_f} (\dot{x}(t))^2 + (\dot{y}(t))^2 + (\dot{z}(t))^2 \, dt$$
Where tf is the final time when the end effector reaches the target position. These formulas represent the distance covered by the end effector in each segment of its movement.