:EDIT:
I wrote the answer above on my phone over the weekend. I'll add some more content now:
What you're asking for is almost more like consciousness than a "simple task" - you want the robot to be spatially aware of itself, aware of the objectives its been given, how to move around its environment and then how to use its physical structure to achieve the goal. I'm positive this is all very far beyond the scope of the project/competition you're asking about.
The route I would take would be to break each action out into their own functions and then tune each as required. So you might have functions like:
- Localize - this is how the robot determines where it is. Dead reckoning, localization, SLAM (simultaneous localization and mapping), etc. would exist here.
- Navigate - this would do pathfinding as required to set waypoints or instructions for how the robot would get from a given start to a given end. Maps and navigation routines like A*, Dijkstra, etc. exist here.
- Locomotion - this would be the low-level interface between the navigate function and the wheels. Navigate says turn to a heading of XXX degrees and travel YYY centimeters, Locomotion actually does it. Here's where the wheel base, wheel radius, gear ratios, and other parameters related to locomotion reside.
- Obstacle detection - if required, a detected obstacle could pause the navigate/locomotion routine, update the map with an obstacle, and force a new navigate call to find the best path from the current position to the original destination. Mapping, SLAM, or other detection algorithms could exist here.
- Manipulate - this would control the device on the robot that is designed to interact with the course.
- Mission control - this would be the higher-level function that calls everything else.
So, for example, if you were given some arbitrary number of ball locations and told to deposit them in a basket, your code might look something like the following (Matlab) pseudo-code:
function MissionControl()
basketLocation = [xBasket, yBasket];
objective(1).startPosition = [xBall1, yBall1];
objective(2).startPosition = [xBall2, yBall2];
% This continues for all objectives
% All of the objective locations are at the basket, so
% assign all of the objective goals to that location.
[objective.goal] = deal(basketLocation);
for currentObjective = 1:numel(objective)
currentPosition = Localize();
path = Navigate(currentPosition, objective(currentObjective).startPosition);
for currentWaypoint = 1:numel(path)
Locomotion(currentPosition,path(currentWaypoint));
currentPosition = Localize();
end
Manipulate('get');
currentPosition = Localize();
path = Navigate(currentPosition,objective(currentObjective).goal);
for currentWaypoint = 1:numel(path)
Locomotion(currentPosition,path(currentWaypoint));
currentPosition = Localize();
end
Manipulate('put')
end
Each subfunction has its own parameters - again, things related to how the robot moves goes in Locomotion()
. How the robot 'get'
s the ball goes in Manipulate()
, etc. If you were going to insist on using AI, I would encapsulate each AI routine in a similar manner, such that there are actually several AI routines.
Again, if there are any dramatic changes, such as a dramatically different footprint or something similar, you'll probably need to wind up retraining the AI. If you don't discard the previous AI, then all of the new training is going to try to "fight" its previous learning of how to behave or interact, and the result may not be optimal in either scenario (old or new).
But like I mentioned earlier, any use of AI would, in my opinion, be a big overkill. Parameterize your code - don't use any magic numbers - and you should be able to update/tune your performance relatively quickly by tweaking the configuration parameters.