Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

13

Transcript of Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Page 1: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.
Page 2: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Virtual Basketball: How Well Do You Shoot?

Chun Li & Jingwen Ouyang

6.111 Spring 2007

Page 3: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

System Overview

Chun Jingwen

analog x 10

analog y 10

analog z 10

velocity y 10

velocity z 10

velocity x 10

position x 10

position y 10

position z 10

Calibration&

Velocity Calculation

vga_colors 24

Game Display

vsync, hsync, hblank

ADXL3303-Axis

Accelerometer

Page 4: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Accelerometer & A/D Converter

•ADXL330 3-axis Accelerometer

•±3g range•Operating voltage 3V•300 mV/g sensitivity

•AD7810 10-bit A/D Converter

•Sample at 1 kHz

Page 5: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Velocity & Position Block Diagram

Serial InterfaceIntegrator

Determine Release

VelocitiesSerial

Interface

Serial Interface

SCLK

CONVSTDOUTX 10

SCLK

DOUTY 10

SCLK

DOUTZ 10

CONVST

CONVST

To all modules

Debounce/Synchronize

clk

To all modules

reset

acc_x 10

acc_y 10

acc_z

10

Calibration

switch[6:0]

height

7

pos_x pos_y pos_z

7 7 7

sens_x 10

sens_y 10

sens_z 10

Integrator

Integrator

reset enable

reset enable

reset enable

vel_x 20

vel_y 20

vel_z 20

rel_x 20

rel_y 20

rel_z 20 AD

XL

330 3-A

xis Accelerom

eter

AD

7810

AD

7810

AD

7810

analog_x

analog_y

analog_z

27Mhz_clock

Reset (button[0])

Page 6: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Calibration

• Obtain player height• Calculate initial x, y, z positions

• Why: Variances• 0g bias point• sensitivity

Page 7: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Debouncer/ Synchronizer

Game Logic

Display Field

DCM

VGA

Controller

pixel_clockTo All

Reset

Replay

reset_sync

replay_sync

Initial positions

10 x 3 10 x 3

Initial speeds

10 x 3 10 x 3

Ball x, y, zPositions

ShadowPositions

labkit_clock

pixel_count 10

line_count 10

24 rgb_signal1 x 4 VGA signals

Game Display Overview

Page 8: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Get Ball position

(FSM)

Get Shadow Position

StatusInitial Positions 10 x 3

Initial speeds 10 x 3

ball_x,y,z

status

Game Logic

2

10 x 3

Shadow_x,y,z10 x 3

Page 9: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Calculations

• Speed• Vz = g t + Vz (only vertical direction has acceleration)* t = time between each frame

• Position• X = Vx t + X • Y = Vy t + Y• X = Vz t + Z

• 3D to 2D conversion• W = Z + X sin(a) – Y sin(b)• U = X cos(a) + Y cos(b)

Page 10: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

3D to 2D

Converter

ball_x,y,z10 x 3 ball_x,y

10 x 3

Display Field

pixel_count 10

line_count 10 Address Counter

For ROM

7 ball_addr

ROM

rgb_ball24RGB

Controller

24

rgb_signalrgb signals for the shadow, player, scores, and background, which are obtained similarly

24 x 4

Color Mapping

2 color_index

Page 11: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Game Display Interface (1)

2

+

+

+

+

+

4

Page 12: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Game Display Interface (2)

Page 13: Virtual Basketball: How Well Do You Shoot? Chun Li & Jingwen Ouyang 6.111 Spring 2007.

Conclusion

• practice shooting without a court

• Whenever

• Game for the Wii