“Toy Story” Revisited: Robotic Lazer Tag Phoenix Moorman CSCI 390 - Senior Seminar & Project April 26, 2002 Inspiration to Implementation • Many children fantasize that their toys become animated and play while they are not looking • The advent of robotic kits, Legos have become the first toys to exhibit “behaviors” and play games in front of children’s (and adult’s) eyes Robotic Lazer Tag • Lazer Tag is played between 2 or more players • The game is played within an enclosed arena. • Each player is equipped with a 'lazer' gun and a receiver which is strapped upon the player's body in plain sight • The goal of the game is to "tag" the other player by firing the 'lazer' gun at an opposing player's receiver. The first player to "tag" the other a predefined number of times is the winner. Code of Conduct • Lazer Tag is a non-contact sport. Any accidental contact requires immediate warnings to both players to be more careful, with further physical contact subject to immediate censure. • Sensors Must be Visible. Preventing a Lazer Tag beam from tagging a sensor is dishonorable. • Equipment Failure Means Disqualification. • Sensors Must be Attached. • Sensors Must be Activated. • Refreshments are Available. • Lazer Tag Is a Game. Players must always remember that Lazer Tag is only a game. It is designed so everyone can have fun. If a player gets angry, exhausted, or bitter, he should stop playing until he cools off. Not having fun is against code. (thisTag goes double for the - Worlds of the Wonder Lazer Code of Conduct Guide programmer) The Idea • Robots are beginning to play a crucial role in industrial and scientific endeavors • Developing strategies by which robots fulfill a task is of optimal importance • How do we try out different strategies? • Theoretical Model vs. Real Implementation Robots The Handyboard • Motorola 6811 microprocessor • 32K RAM memory chip • 4 Motor Output Ports • 8 Analog / 8 Digital Input Ports • 1 Infrared Output Port • 1 Infrared Input Sensor Robots Theoretical Modeling with Robocode • Robocode was designed to teach beginning programmers JAVA • Provides a Lazer Tag-like environment using bullets instead of infrared transmissions • Provides a nice API for interfacing with the theoretical robots Robots Theoretical Modeling with Robocode • Allows for variable-sized arena (used 400 x 400) • Allows easy access to a lot of useful information about the robots • Provides a number of robot strategies to work with/against • Allows for object-oriented programming (classes, etc) • Allows user to utilize the full power of the CPU of user’s computer with a small penalty of slowdown • Allows user to utilize full memory of user’s computer Robots Simple vs. Complex Strategies • Simple Strategies • Rely on patternistic behaviors to find, tag, and/or avoid the other robot • Utilize basic sensory data Robots Complex Strategies • Complex Strategies • Rely on algorithms that make use of a number of available factors to find, tag, and/or avoid the other robot • A Sampler of Factors: • Velocity (of self or other robot) • Direction / Bearing • Size / Topology of Environment • Number of hits (received or given) Robots Simple Strategies: A Case Study • My implementation: John Dunbar • Goes in a straight line until it finds a corner, then backs up and turns • Sweeps lazer gun/radar back and forth to find other robot Robots Simple Strategies: A Case Study • Scans over a large area to find opponent • Hard to pin down and hit repeatedly • Does comparably well against a variety of strategies Robots Complex Strategies: A Case Study • My implementation: Tracker/Sun Tzu • The idea: attempt to discover the other robot’s strategy “Thus, what is of supreme importance in war is to attack the enemy's strategy.” - Sun Tzu, “The Art of War” Robots Complex Strategies: A Case Study Robots Complex Strategies: A Case Study Robots Complex Strategies: A Case Study Robots Implementation in Reality • Hardware issues: • John Dunbar’s turret can’t turn a full 360 degrees (cord issues) • 32K RAM doesn’t allow for large programs • Greater complexity of program, greater the slowdown (greater time slowdown for Tracker) Robots Implementation in Reality • Programming issues: • Interactive C doesn’t support classes (the global variable solution) • Interactive C doesn’t allow for reading and writing to files (the persistent global variable solution) Robots Implementation in Reality • Programming issues: • Interactive C’s API isn’t as nice as Robocode’s! So how does Tracker: • create grid spaces? • keep track of its grid space? • figure out the other robot’s position? Robots Implementation in Reality • The Relativity Solution: • Pre-define a starting position • Use velocity (the time to cross grid spaces) and direction to keep track of Tracker’s grid spaces • Use light sources/sensors to define distance between the robots (ambient light - threshold) Robots Implementation in Reality Robots Some Conclusions • Theoretical models are good tools for developing robotic strategies when several things are considered: • The computational power of the model vs. the robot • While nice features of the model may increase the ease of use and decrease development time, they must be easily implementable in the real world • Murphy’s Law must be incorporated into real-world adaptations of theoretical designs