Navigation

OK, so this section might be a bit of a pain to wrap your head around, so read slowly and carefully. The Navigation System is automatically used by the MotionController, so you never need to create one yourself! As long as you implement a Drive class for your robot, it will work automatically. This section is here simply so you know how it works.

The Navigation System answers one simple question: In which direction should the robot be moving at this exact very moment? It does not know the actual PATH the robot will take, it doesn't need it. We just need to know which way the robot needs to go RIGHT NOW. To answer this, the Navigation System is told the following things:

First check out the diagram, then I shall explain:

There are two methods of navigation: The A* Search navigation and the Potential Fields navigation (bottom of the diagram). You can see they both implement the NavigationInterface and they make use of Obstacles. You can tell the navigation system what obstacles to avoid. All the robots and the enemy/friendly defence areas are added automatically. Sometimes you may wish to add other obstacles (like the ball for example).

Depending on which navigation method the MotionController is using, the class converts them to the obstacles of the particular navigation system and perform the search on it. That is why both navigation systems have all those other classes attached to them.

The MotionController decides which navigation system to use based on the location of the robot and whether or not the robot would get stuck if it used the potential fields.