Class RoutePlannerBase

Class Documentation

class RoutePlannerBase

Public Functions

virtual F2CRoute genRoute(const F2CCells &cells, const F2CSwathsByCells &swaths_by_cells, bool show_log = false, double d_tol = 1e-4, bool redirect_swaths = true)

Generate route to cover the swaths on a field. If two consecutive swaths are far away, the route connects both through the headland.

Parameters:
  • cells – Headland swath rings used to travel through the headlands

  • swaths_by_cells – Swaths to be covered.

  • show_log – Show log from the optimizer

  • d_tol – Tolerance distance to consider if two points are the same.

Returns:

Route that covers all the swaths

void setStartAndEndPoint(const F2CPoint &p)

Set the start and the end of the route.

virtual F2CGraph2D createShortestGraph(const F2CCells &cells, const F2CSwathsByCells &swaths_by_cells, double d_tol) const

Create graph to compute the shortest path between two points in the headlands.

Parameters:
  • cells – Headland swath rings used to travel through the headlands

  • swaths_by_cells – Swaths to be covered.

  • d_tol – Tolerance distance to consider if two points are the same.

virtual F2CGraph2D createCoverageGraph(const F2CCells &cells, const F2CSwathsByCells &swaths_by_cells, F2CGraph2D &shortest_graph, double d_tol, bool redirect_swaths = true) const

Create graph to compute the cost of covering the swaths in a given order.

Parameters:
  • cells – Headland swath rings used to travel through the headlands

  • swaths_by_cells – Swaths to be covered.

  • shortest_graph – Graph to compute the shortest path between two nodes.

  • d_tol – Tolerance distance to consider if two points are the same.

virtual ~RoutePlannerBase() = default

Protected Functions

virtual std::vector<int64_t> computeBestRoute(const F2CGraph2D &cov_graph, bool show_log) const

Use the optimizer to generate the index of the points of the best coverage route.

virtual F2CRoute transformSolutionToRoute(const std::vector<int64_t> &route_ids, const F2CSwathsByCells &swaths_by_cells, const F2CGraph2D &coverage_graph, F2CGraph2D &shortest_graph) const

Tranform index of points to an actual Route.

Protected Attributes

std::optional<F2CPoint> r_start_end