Download Final Year Dissertation 2006
Transcript
Faculty of Information Technology Implementation To model this simulator the Java programming language was chosen. Because of the object-oriented nature the software was the Java programming language was used. The software was tested and implemented on a computer using Windows XP Pro. A lot of time was devoted to reading about and getting to know the details of animation techniques in Java. Concepts such as image buffering were studied on the Java site; http://www.sun.com/java and examples thereof looked at. The simulator part of the software contains a timed task that updates and queries the robot object for its status and draws a visual representation of the robot according to this and the simulator world’s constraints. Quite a lot of good functionality is provided by the Swing framework in Java. One concern was that the processing speed might be too slow because of time taken by the animation part. There were no symptoms of overload on the system though, except for when using the trail option of the software. This is understandable since the trail function stores the number of points visited by the robot in list type of structure and typically when the simulation runs for a long time the number of points becomes too big and the list too. This could be avoided by storing only points that differ substantially in position. Problems encountered were mostly relating to keeping track of objects using the coordinate system and trigonometry functions. Another point worth noting is that some thing in relation to this project such a collision detection could have been easier to implement if some reading on computer gaming concepts and web sites had been done. Regarding the collision detection scheme, Java actually provides Boolean operators to tell if simple two-dimensional geometric shapes intersect such as ovals and rectangles and this was made use of in the partial simulation software. There seems however to be a problem with the precision of these when movement of the robots is less than about 2 pixels during each simulation step. The arbitration aspect of the software was implemented by using a special arbitrating class the check cycles thorugh an array of behaviours in a loop. Every behaviour has Boolean function the arbitrator checks and when this returns a value of ‘true’ the actions associated with the behaviour are run. This is not implemented in a seperate thread, there is no need for that. 21