This is a ROS2 node class that provides a path planning service based on A* grid algorithm. It also has a GlobalPlannerStraightLine class as its parent and has similar interface: if you can plot a straight line path, you should be able to easily switch to A* grid based one.
Here we got a node that we can run either on a robot - if it has sufficient resources, or on a server. Note that even in the second case, each robot has its own path planner: the constructor receives the robot name and creates corresponding service and publisher. Should we make it a universal class instead, so one instance handles all robots?
Again, it is a design choice. A single node is more elegant, but if we have many robots asking for calculations in the same time, it might get slow. Or we will have to do some extra coding to make it parallel, which, in the case of individual nodes, is a default behaviour.
Also, if we have individual nodes corresponding to each robot, we will have no problem running them on the robot side, if the server does not respond. It will allow us to handle the situation when with the server robots do something advanced, yet if there is no server, they can at least do some primitive things, like returning to base. It is not a showstopper though, as we can create an individual object of this class on a robot's side, and only provide it with a single robot (as opposed to letting it handle multiple robots on a server).
As I said, it is a design choice. Also, this is definitely not the only choice. For example, we can make calculations distributed, so whatever robots are idle, can handle calculations for robots that are busy. This, of course, will require a different (3rd type of design) approach. This is a common situation in software development, and you should at some point just choose one of many possible solutions and stick to it.
Not implemented in this section! Will be added later!
In earlier sections it was called Navigation node. Then I realized that Navigation has very little to do with it: actually, navigation is what I am doing now, with Path Planners and (in future sections) Path Followers. So I have renamed it to Localization.