Review Article

The Quadruped Robot Uses the Trajectory Planned by DIACO to Complete the Obstacle Avoidance Task

Algorithm 1

Diffusion-improved ant colony optimization algorithm.
Input:
: Number of ants
: The maximum number of iterations
: Pheromone weight
: Heuristic information weight
: Grid map matrix containing obstacles
Output:
 best_path: Coordinate information matrix on the optimal path
% Main loop for the iterations
for k = 1: K
 % Loop for each ant
  for m = 1: M
   % Initialize Tabu list
   TABUkm = ones(N)
   % Initialize path list
   DIACO = []
   while ∼ target_position(current_position)
    leave_pheromone(current_position, equation_7_parameters)
    % Add the current position to the path list and Tabu list
    DIACO = add_to_path(DIACO, current_position)
    TABUkm = update_tabu(TABUkm, current_position)
    % Calculate transition probabilities according to equations (1)–(6) transition_probabilities = calculate_transition_probabilities(current_position, equations_1_to_6_parameters)
    next_position = select_next_position(transition_probabilities)
    % Update the current position
    current_position = next_position
   end
   % Check if there are positions in the path that satisfies the diffusion threshold according to (18)
   if any_position_satisfies_diffusion_threshold(DIACO, equation_18_parameters)
    % Perform pheromone diffusion according to equations (9)–(17)
    Pheromone_update = perform_pheromone_diffusion (DIACO, equa-tions_9_to_17_parameters)
    % Local pheromone update
    Pheromone = leave_pheromone + Pheromone_update
   end
   % Check if all ants have completed the path search
   if all_ants_have_completed_path_search()
    % Check if this is the last iteration
    if k < K
     % Perform global pheromone update according to (8)
     perform_global_pheromone_update(equation_8_parameters)
    else
     % Return the best path and the best path curve
     [best_path] = get_best_path_and_curve(DIACO)
     return
    end
   end
  end
 end
end