This project proposed the development of a piece of software capable of controlling a robot and performing a series of tasks. Our robot, Gary, was supposed to drive around a predetermined course, which contained five checkpoints, five golf balls and five obstacles. Gary's objectives were to go through all the checkpoints, while collecting as many golf balls as possible and avoiding the obstacles. After that, the balls needed to be deposited at the appropriate locations. And all this should be done as fast as possible.
There were five, blue and orange golf balls. Gary had to collect them, telling us the precise location where they were found. The more precise, the more points Gary would give us. Gary had to avoid the obstacles, otherwise he'd be disqualified.
A map with a shortest path algorithm was used to navigate the robot between points. A 6x6 array was used to keep track of where the boxes were placed on the course. New boxes where checked on the course any time the robot was going straight and came close enough to a wall based on the robots current position and ladar distance measurements (the ladardata array). Then the function checkobstacle would increment the corresponding box in the 6x6 array. A number greater than 2 in the 6x6 array indicated a box was at that location. Boxes were also checked on the side of the ladar when the robot was in the center of each square so only the middles of each box would be checked as an obstacle.
Every time the environment changed, the shortest path was recalculated. This was done by first marking the distance from each point to the start point. Then the shortest path algorithm would start at the destination point and look for a point one closer to the start until it reached the start. At every turn in the path, a waypoint was marked for the robot to go to. While stepping through the points, the last direction was kept track of to recognize turns and to search in the same direction as the last to prevent a zig-zag path. The closest starting point was also added so if the robot went of f the path while looking for golf balls it could get back on course without running into boxes. The closest point to the destination was also added so if the destination wasn't on the path, the robot could leave the path at the closest point to the destination.
When five boxes were found, the xy_control function would speed up the robot and not look for any new boxes since they were already found. Before the robot started, a ladar reading was also taken to see if a box was at the right entry point of the course (1, 0). If this was the case, the robot would reset the entry point into the course to the left location (-1, 0).
The C files that made Gary work
The VB project that told us humans about Gary's current state