This class calculates and displays the linear path between two points. As we are on a 2.5d surface, Z coordinate is taken from the map.
This class is a base for A* Graph, Grid, Dynamic Grid and Graph classes. These classes provide a path in the form of an array of centers of cells we are passing through (in the case of grid based methods) and coordinates of graph nodes (in the case of a graph based method). As these points can be far from each other AND Path Follower (that we will revisit in one of the following sections) requires path with points that are dense enough, especially when the road turns, the PlannerStraightLine class is responsible for filling the gaps.
Note that all planner classes (PlannerStraightLine, PlannerAStarGrid, PlannerAStarGridDynamic, PlannerAStarGraph) have their own "main" functions that are used for demo purposes. You can run the file without ROS2, as a standalone, for example:
That will execute its "main" and show the map and a path in a popup window.
PlannerStraightLine.py
Result: