Function select_nearest_cones_indices

Function Documentation

std::array<int, 2> select_nearest_cones_indices(const std::array<float, 2> car_position, const std::array<float, 2> car_direction, std::vector<std::array<float, 3>> cones, ConeType cone_type, const float distance_threshold, const float angle_threshold)

Choose the two nearest cones to the car.

This function selects the two nearest cones to the car based on their distance and angle.

Parameters:
  • car_position – Position of the car (x, y).

  • car_direction – Direction of the car (x, y).

  • cones – Vector of cones represented as arrays of three floats [x, y, color].

  • cone_type – Type of cones to select.

  • distance_threshold – Threshold for distance to the car.

  • angle_threshold – Threshold for angle to the car.

Returns:

Array of two integers representing the indices of the selected cones.