Sonar sensor and mounting
The sonar sensor of the robot allows it to find the goal. This is performed once it has the ball. It performs a 360 degree scan in 60 segments. If it is unsuccessful at finding the goal, it will identify the middle of the room, head to it, and scan again.
The actual physical mounting of the sensor was difficult, due to its large size. Our mounting solution is shown below.
The entire search and movement behaviour is controlled from one function. The code for this is here.
The servo which turns the sensor was geared up so that the range of servo movement allowed for a 360 degree turn. This is easily done by attaching a gear to the servo head with the supplied screws.
There were some problems associated with the sonar sensor: