Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The nav_core package contains the BaseGlobalPlanner and BaseLocalPlanner interfaces so that various planners can be loaded in place of one another without modifying move_base. ROS does this using pluginlib.

Pluginlib is one of the reasons that the initialize method is required. Since plugins are loaded dynamically, one cannot instantiate an instance of a particular plugin (navfn, for example). move_base uses pluginlib's classLoader to load an instance of whatever planner is desired. It then calls the initialize method to set up all configurations, services, publishers, subscribers, etc. The initialize method does more than just pass the copy of the costmap. If you were to only try to use messages, you would not be able to dynamically load the planner (because it'd have to be pre-loaded to be able to subscribe to the topic and, thus, would not be dynamically loaded).

By enforcing the BaseGlobalPlanner and BaseLocalPlanner interfaces, move_base can always be sure that it has both planners at all times. If the planners ran standalone, move_base would have more difficulty controlling their operation, ensure that they're running, and creating/destroying instances of planners.

These are just my opinions on the matter, I'm sure it's not a comprehensive list, but I hope it helps.