This is a simple class that, given two points (start, goal) and the interval, returns an array of points with step equal to the interval, forming the line from start to goal. So the first question is, why do we need it? I mean, if we need to drive at a straight line from A to B, why do we need intermediate points?
It can be used by classes like Path Follower to figure out where to go during a turn: it requires the next few points and the last point of a potentially very long linear segment will not do.
The next question is, why making such a simple class a ROS2 node? This is a design choice, and the reason is, it has exactly the same interface the more advancer GlobalPlannerAStarGrid and GlobalPlannerAStarGraph classes have. So i am simply going to make them all members of the same hierarchy, and by doing so, will need no extra code to switch from one path planner to another. But yes, it is just a design choice, and it can be done differently.
Now let's look at the code:
After we create the node and spin it, we can ask its service to provide the path. When service is ready, it returns future (not yet due to a bug mentioned above) and publishes a message containing path (use it until bug is fixed).