BAT-TLESHIP
ME 218B Smart Product Design Applications - Functional Description
Jen2 is team Twiddling Bits’ robot for the winter 2013 iteration of the ME 218B project at Stanford University. With its name inspired by the second generation of Professor Ed Carryer’s Events and Services Framework, Jen2 is an autonomous robot capable of taking part in a modified version of the tabletop game battleship. This version of battleship involves a head-to-head game between two team's robot. Each robot attempts to shoot nerf balls at the opposing player's robot, "ships", and/or "power station" in order to end the game with the higher number of points. If during the game, a robot ran out of nerf balls, it had the option of getting more ammunition by refilling at designated resupply depots on each side of the playing field.
With the objective of winning this game in mind, we started working on the subsystems Jen2 would need for the game.
INFORMATION GATHERING
To gather information about the game and the playing field, Jen2 relies heavily on it's SPI communication with the Forward Artillery Controller (FAC), a provided module that relays pertinent game information to each robot. In particular, the FAC provides game progress information which Jen2 uses to initiate and/or end the game play. Perhaps, more importantly, the FAC provides information regarding the position and orientation of not only opposing player's ships and robot but also of our own robot. Jen2 uses such information for targeting enemy units and as feedback for its own movement.
For locating units not known by the FAC, Jen2 relies on on-board sensors. For locating the power station for instance, Jen2 uses an IR phototransistor to detect the IR pulses that each power station emits at a specified frequency. For locating the resupply depot, Jen2 primarily uses the FAC to get as close as possibly before relying on limit switches to know when it finishes backing up into the depot.
MOVEMENT
To move, Jen2 uses two wheels, each directly driven by a DC motor and two caster wheels to provide platform stability and to reduce the friction Jen2 sees while moving. On the software side, without encoders on her wheels, Jen2, as mentioned before, relies on FAC information for controlling the DC motor speeds in a closed loop manner. A simple PD control (following some PWM tuning to account for differences in the motors) allows Jen2 to more reliably straight when moving forward or backward and a simple check on orientation every 100ms was enough to orient Jen2 to face a desired direction.
SHOOTING
To shoot nerf balls, Jen2 uses a spring-loaded catapult that is actuated primarily by two servos: a "locking" servo and a "spring-tensioning" servo. A third servo, the "reloading" servo which physically isn't attached to the catapult itself releases balls from the holding bin allowing the ball to drop into the catapult cup. The actual firing sequence starts with the catapult arm down and the "locking" servo locking the catapult arm in place. The reloading servo releases a ball from the holding bin, the tensioning servo stretches the spring, and the locking servo moves to its unlock position thus releasing the catapult arm and firing a nerf ball. Afterwards, the spring is fully un-tensioned allowing the catapult arm to drop back down. The locking servo then locks the catapult arm and the cycle repeats again for the next firing.
To actually fire at a specified location, we had to do some calibration beforehand in order to map "servo arm position" to "distance to enemy unit". Then in battle, Jen2 uses FAC information to calculate the distance the nerf ball has to travel. After orienting herself, Jen2 then merely starts the firing sequence, commanding the spring-tensioning servo to the pre-calibrated position associated with that calculated distance before firing at the enemy unit.
RELOADING
To reload, once Jen2 reaches within backing distance from the reloading station*, Jen2 just backs up into the reloading station until the rear limit switches are triggered. Once the limit switches are triggered, IR LEDs on the rear of Jen2 flash at a specified frequency in order to request balls from the resupply depot. From there,gravity pulls the ball down into the holding bin on the back of Jen2.
(*Note that Jen2 can't use FAC information at such close distances to the resupply depot because the region is physically "cloaked" and so the FAC system knows nothing about any unit in this cloaked region. Instead Jen2 relies on open loop control instead of closed loop).
With all the subsystems above integrated together. Jen2 can go into a two minute long game of battleship and fight valiantly to do more damage to the opponent then we ourselves sustain in the hope of coming out victorious in the game.
We would like to thank Professor Ed Carryer and our TAs Jeff Kessler, Russell Patton and Luis Villaran for coming up with a great project for us to work on, as well as their immense amount of patience and support over the course of the project which made working on Jen2 a highly rewarding experience.
The formal (and more detailed) project description can be found below.
With the objective of winning this game in mind, we started working on the subsystems Jen2 would need for the game.
- Gathering information about the game and about the locations of various units on the playing field
- Moving to specified locations on the field
- Shooting at specified locations on the field
- Reloading as necessary from the resupply depot
INFORMATION GATHERING
To gather information about the game and the playing field, Jen2 relies heavily on it's SPI communication with the Forward Artillery Controller (FAC), a provided module that relays pertinent game information to each robot. In particular, the FAC provides game progress information which Jen2 uses to initiate and/or end the game play. Perhaps, more importantly, the FAC provides information regarding the position and orientation of not only opposing player's ships and robot but also of our own robot. Jen2 uses such information for targeting enemy units and as feedback for its own movement.
For locating units not known by the FAC, Jen2 relies on on-board sensors. For locating the power station for instance, Jen2 uses an IR phototransistor to detect the IR pulses that each power station emits at a specified frequency. For locating the resupply depot, Jen2 primarily uses the FAC to get as close as possibly before relying on limit switches to know when it finishes backing up into the depot.
MOVEMENT
To move, Jen2 uses two wheels, each directly driven by a DC motor and two caster wheels to provide platform stability and to reduce the friction Jen2 sees while moving. On the software side, without encoders on her wheels, Jen2, as mentioned before, relies on FAC information for controlling the DC motor speeds in a closed loop manner. A simple PD control (following some PWM tuning to account for differences in the motors) allows Jen2 to more reliably straight when moving forward or backward and a simple check on orientation every 100ms was enough to orient Jen2 to face a desired direction.
SHOOTING
To shoot nerf balls, Jen2 uses a spring-loaded catapult that is actuated primarily by two servos: a "locking" servo and a "spring-tensioning" servo. A third servo, the "reloading" servo which physically isn't attached to the catapult itself releases balls from the holding bin allowing the ball to drop into the catapult cup. The actual firing sequence starts with the catapult arm down and the "locking" servo locking the catapult arm in place. The reloading servo releases a ball from the holding bin, the tensioning servo stretches the spring, and the locking servo moves to its unlock position thus releasing the catapult arm and firing a nerf ball. Afterwards, the spring is fully un-tensioned allowing the catapult arm to drop back down. The locking servo then locks the catapult arm and the cycle repeats again for the next firing.
To actually fire at a specified location, we had to do some calibration beforehand in order to map "servo arm position" to "distance to enemy unit". Then in battle, Jen2 uses FAC information to calculate the distance the nerf ball has to travel. After orienting herself, Jen2 then merely starts the firing sequence, commanding the spring-tensioning servo to the pre-calibrated position associated with that calculated distance before firing at the enemy unit.
RELOADING
To reload, once Jen2 reaches within backing distance from the reloading station*, Jen2 just backs up into the reloading station until the rear limit switches are triggered. Once the limit switches are triggered, IR LEDs on the rear of Jen2 flash at a specified frequency in order to request balls from the resupply depot. From there,gravity pulls the ball down into the holding bin on the back of Jen2.
(*Note that Jen2 can't use FAC information at such close distances to the resupply depot because the region is physically "cloaked" and so the FAC system knows nothing about any unit in this cloaked region. Instead Jen2 relies on open loop control instead of closed loop).
With all the subsystems above integrated together. Jen2 can go into a two minute long game of battleship and fight valiantly to do more damage to the opponent then we ourselves sustain in the hope of coming out victorious in the game.
We would like to thank Professor Ed Carryer and our TAs Jeff Kessler, Russell Patton and Luis Villaran for coming up with a great project for us to work on, as well as their immense amount of patience and support over the course of the project which made working on Jen2 a highly rewarding experience.
The formal (and more detailed) project description can be found below.
Project Description
The task is to design and build an autonomous mobile robot that can compete in a game of skill and strategy against a machine constructed by another team from the class. The game is patterned loosely on the table-top game Battleship. The object of the game is to sink the ships of your opponent’s fleet by hitting them with Nerf® balls. The field will be equipped with a vision system that recognizes fiducials carried by the robots and ships. Information about the location of the robots and ships will be made available to your robot.
With the task above, team Twiddling Bits set off on this four week project, constructing their bot fondly named Jen2. Their strategy was to keep things simple and implement things in parts, as prescribed by the check-off schedule. First, an autonomous mobile platform was developed, moving through the FAC communication (see description below). Next, beacon sensing was built in and demonstrated, along with catapult shooting. Finally, moving to the reloading station and requesting a ball was fully integrated, meeting all of the project specifications.
With the task above, team Twiddling Bits set off on this four week project, constructing their bot fondly named Jen2. Their strategy was to keep things simple and implement things in parts, as prescribed by the check-off schedule. First, an autonomous mobile platform was developed, moving through the FAC communication (see description below). Next, beacon sensing was built in and demonstrated, along with catapult shooting. Finally, moving to the reloading station and requesting a ball was fully integrated, meeting all of the project specifications.
The Battle-scene
Specs:
The Playing Field:
The Forward Artillery Controller:
The Re-Supply Depots:
The Power Plants:
The Fleets:
The Bat-tleships:
Game Play:
- The playing field is an 8’x8’ area with exterior walls 3.5” tall and a center dividing wall, 5.5” tall.
- The Red ‘bot will start on the Red side. The Blue ‘bot will start on the Blue side.
- Each side will have a re-supply depot located at the center of the back wall.
- Each re-supply depot has an associated power plant, located along the back wall.
- Each side will have a set of 1” black tape lines, as shown in Fig. 1.
- Important objects on the field carry unique fiducial markers that are recognized by a sophisticated machine vision system connected to every 'bot's Forward Artillery Controller (FAC).
The Forward Artillery Controller:
- The FAC will provide the coordinates of and orientation information on both ‘bots on the field.
- The FAC will provide the coordinates of each of the ships on the field.
- The FAC will communicate with the robots over a 4-wire SPI bus.
- The top of the FAC will carry a fiducial mark that is used to identify the ‘bot.
The Re-Supply Depots:
- The re-supply depot will deliver a single ball each time its IR detector receives a series of 10 pulses with a 10ms on time and a 30ms off time. While delivering these pulses the ship must also illuminate a visible LED that is clearly visible to any observer.
- The re-supply depot and a small surrounding area are camouflaged so that a ‘bot at the re-supply depot is invisible to the FAC.
The Power Plants:
- Each Power Plant will have a beacon emitting modulated IR driven by a 50% duty-cycle square wave.
- The IR emitters will be mounted at a height of 10” off the playing surface.
- The beacon on the Red Side will be modulated with a period of 20mS, the beacon on the Blue Side will be modulated with a period of 14mS.
The Fleets:
- The Fleets are the sets of non-moving ships in the game.
- Each ship will carry a fiducial that will be recognized to report its position. When a ship is hit, the ship will no longer be reported by the FAC.
- The fiducial will be mounted within the ship and balanced on a supporting pin. If the fiducial is struck from above or the supporting pin struck at the field level, the fiducial will fall indicating that the ship has been sunk.
The Bat-tleships:
- The robots must be stand-alone entities. Battery power is required. The robot must execute from code on the ‘E128.
- Robots must be autonomous and un-tethered.
- If your robot shoots the Nerf® balls, then the Nerf® balls must exit your robot with a horizontal or above-horizontal trajectory, land no more than 6 feet from the robot and reach a peak height of no more than 3’ above the floor of the playing field.
- Each robot may carry a maximum of 5 balls at any time. Each robot will start a round loaded with up to 5 balls.
- Each Bat-tleship may carry a cloaking device that is capable of covering the fiducial, fully or in part. When sufficiently covered, the Bat-tleship will become invisible to the FAC. Firing while cloaked is grounds for immediate forfeiture of the game.
- You are limited to an expenditure of $200.00/ team for all materials and parts used in the construction of your project.
- Each ‘bot must provide a clearly visible indicator when it thinks that the game is in progress. This indicator should be activated when the ‘bot determines that a game has started and be de-activated at the end of 2 minutes or when the game status indicates the end of the game.
Game Play:
- The game is a head-to-head match up between Bat-tleships as they attempt to score points by sinking the ships and Bat-tleship of the opposing fleet.
- Hitting the power station with a ball will prevent the re-supply depot from delivering replacement balls for 10 seconds.
- The game will begin when a query to the FAC indicates that the game state has changed from stopped to in play.
- A direct hit, through the air, on the opposing ‘bot scores 1 point and ends the round.
- Each ship is worth 1000 points when sunk. A hit on the Power Station is worth 100 points.
- Bat-tleships will begin each round in the un-cloaked state.
- The round ends no more than 2 minutes after the FAC first indicated that the game was in play. At that time, ‘bots must stop all movement for at least 5 seconds and deactivate their game in progress indicator.