CSE 466 Lab 8: World Cup Soccer

Introduction

This is the final project for 466 this quarter. Using all of the knowledge you've gained through lab this quarter, you will be designing a player controller that can participate in a world cup soccer game. You will also be interfacing your controller with our super-bird sensor boards.

WARNINGS!!!

Objectives

In this lab, you will learn:

Suggested Reading and Resources

Part 1: Designing your player controller

For this lab you will be completing your player controller.

For your player controller you must do the following: (from lab 7)
  1. Determine what movements you will use to read your accelerometer and move your player. We encourage creative interactions. You should be able to control the movement such that your iMote2 sends a value between +/-20 for both the X and Y axis.
  2. Your design should be generally human friendly. (i.e. holding the node generally steady should result in no movement of your player)
  3. Make it respond to a game controller when your node is contacted.
  4. Make it stop sending if you receive an OFF packet for your player and start sending if you receive an ON packet for your player.
Additionally, you must implement the rest of the functionality for your player controller:
  1. If you receive a packet telling you you're merged, you should send your response to your captain rather than the game controller
  2. If you are the captain, you should appropriately calculate your deltaX, deltaY based on all of the packets you've received from your merged group.
Also, we're adding the superbird sensor board, so we're expecting you to do the following:
  1. On your display you should show your player number, if you're merged or not (and the captain's # if you are merged), the game score, and the position of your player on the field.
  2. You should also implement sounds for different events in the game. Specifically you should implement sounds for scoring, hitting the out-of-bounds line, merging, and hitting an opponent.
  3. Feel free to be creative with both the displays and the sounds and add any additional information/sounds you think would be fun/interesting.
  4. You may also add other sensors and/or button presses, etc... to help enhance your project

UPDATE!

The LCD on the SuperBird and your accelerometer are configured to use the same SPI port. Therefore, we will be giving you a new accelerometer board that is configured differently. You must modify your driver to use SSP port 2. Note that you must change the alternate function registers accordingly. See the iMote2 and PXA27x datasheets for more info.

You'll need several drivers for the superbird:

Note that the I2C interface is needed for many of these drivers, so you must modprobe i2c-pxa for these to work!

A header file for superbird.ko is available here. The header for the tri-color LED is here. In addition, you might find mpg123 useful for testing your bird's audio chip.

The packet structure for this lab is as follows. You should put this structure into the data field in a TOS_Msg, and parse it from the same. You should broadcast your packets (i.e. set pkt.addr = 0xFFFF;).

UPDATE: We've changed the packet structure slightly to help with word alignment issues with the xscale. More information about that can be found here.

Game Controller to Player
---------------------------------------------------------------------
| src | dest | position | merged | score1 | score2 | action | reset | player |
---------------------------------------------------------------------

where:
src = 2 Bytes: Source address identifying packet as coming from controller
        Controller is player 0 on team 0
dest = 2 Bytes: Destination address
        1st byte is team (1 or 2) and 2nd byte is player number (player number unique)
position = 4 Bytes: 0..1 X position, 2..3 Y position of player on field
merged = 1 Byte: Merged or not merged
        0 if not merged, # of captain if merged
score1 = 1 Byte: Current score for team 1
score2 = 1 Byte: Current score for team 2
action = 1 Byte: where 1=scored, 2=merged, 3=unmerged, 4=teleported, 5=hit out-of-bounds line
reset = 1 Byte: Reset
player = 1 Byte: Player on=1/off=2


Player to Game Controller (or group captain)
----------------------------
| src | dest | deltaX | deltaY |
----------------------------

where:
src = 2 Bytes: Team, player #
dest = 2 Bytes: To Game Controller (0, 0) or Captain (team, player #)
deltaX = 2 Bytes: change in X value
deltaY = 2 Bytes: change in Y value
Packets to the game controller must be sent as quickly as possible after reception of packet from game controller

We will be giving you a test game controller soon so you can test your responses, but until then feel free to update your game controller from lab 7 to help you test.

Deliverables

E-mail a single .zip file containing all requird documents to cse466-tas@cs.washington.edu
For all files turned in, the comments at the top of the file should contain:

  1. Demonstrate your player controller and fake game controller to a T.A. You can either do this during lab, or during the first 1/2 hour of the next lab.
  2. Turn in a soft copy of your commented C code.