Difference between revisions of "Rock Paper Scissors Machine"

From Mech
Jump to navigationJump to search
Line 72: Line 72:


==Results==
==Results==
Overall, the RPS machine was a great success. Its sleek design coupled with an intuitive, user-friendly interface proved to be a winning combination, especially with people without an extensive technical background. Wireless operation of the hand became an essential part of the project - it helped to greatly reduce clutter and kept the project looking neat and organized.
Overall, the RPS machine was a great success. Its mechanically intensive design coupled with an intuitive, user-friendly interface proved to be a winning combination, especially with people without an extensive technical background. Wireless operation of the hand became an essential part of the project - it helped to greatly reduce clutter, despite limited range.


Video of the RPS machine in action can be found [http://www.youtube.com here]
Video of the RPS machine in action can be found [http://www.youtube.com here]

Revision as of 12:20, 12 March 2009

Overview

Rock paper scissors.jpg

We have created a machine that will play a fully functioning, intuitive game of Rock/Paper/Scissors (abbreviated as RPS) with a user. The machine is represented by a human-like hand, capable of seperate and independant wrist, arm, finger and thumb motion. The players' hand goes into a glove equipped with flex sensors, which wirelessly transmits data to the machine based on what the player chose. The machine then reads this data, randomly chooses a throw of its own, and displays win/loss/tie both on an LCD screen and in the form of a thumbs up/down/side motion.





Team Members

Chris Carhart - Mechanical Engineer 2010
Kevin Kao - Mechanical Engineer 2010
Reed Walker - Electrical Engineer 2009

The Players' Glove

The players' glove is a large, leather grill glove with a wireless RF transmitter and two flex sensors embedded inside, one on the index finger, and one on the ring finger. We assumed, reasonably, that the three throws could be determined by the position of the index and ring fingers alone. It also has a power light and an on/off switch. The goal was to have it easily used by everyone, and high percentage success rate of transmitting the throw the user chooses.

RF transmission

i dunno anything about this actually

Flex sensors

Flex sensors are used to tell what throw the player chose. Flex sensors have a varying resistance based on the bend of the sensor - a higher bend angle means higher resistance value. A high bend angle (>60 degrees or so) will have a resistance high enough so that the RC reader reads a low signal.

  • If the player throws rock, both flex sensors will be bent, and the read resistances will be high
  • If the player throws scissors, the ring finger flex sensor will be bent, but the index finger's sensor will not.
  • If the player throws paper, neither of the flex sensors will be bent.

These three combinations are enough to send three unique signals to the PIC.

Other Glove Features

The power switch can turn the game on or off. In the off position, the PIC will display a blank screen until the glove is turned back on. The power light on the glove lets the player know whether the glove is on or off.

The Mechanical Arm

The hand consists of five separate RC servos that control arm motion, wrist motion, thumb motion, and 2x finger set motion.

The Arm

The arm is a servo connected to a bracket, which the wrist is mounted on.

The arm's servo is the physically most powerful servo, a Futaba S3004. It is mounted to the holding bracket, and its job is to move the entire machine arm up and down for the "Rock/Paper/Scissors/Shoot" motion. A spring connects this servo to the wrist servo - this stabilizes (and slows) the arm's downward motion. This servo moves at maximum speed on the downward swing, and at a slightly slower speed on the upward swing. This mimics natural RPS motion.

The wrist

The wrist is an aluminum rod screwed and glued to the arm's bracket and the hand.

The wrist servo is also a Futaba S3004 servo. It is mounted with screws to a bracket attached to the arm servo. Its role is to rotate 90 degrees if the PIC chooses Paper, and 180 degree rotation for thumbs up/down/middle for player win/loss/tie. For instance if the PIC throws rock and the player throws scissors (player loses), the wrist servo will rotate downwards 180 degrees so the thumb can do a thumbs down.

The hand

The hand is a sheet metal aluminum piece ...more info here

The thumb

The thumb is simply a carbon rod attached to a small servo, tied to the hand.

The thumb servo is a Blue Arrow BA-TS-4.3. Its role is to rotate upwards for a player win or loss, and rotate slightly away from the fingers if the PIC throws paper.

The fingers

The fingers are two sets of brackets. (info about the mechanical construction of the fingers here)

Both finger servos are Blue Arrow BA-TS-9.0s. One servo controls the index and middle fingers, and the other one controls the ring and pinky fingers (ie, index/middle fingers move together, ring/pinky moves together). Both servos default at the rock position. The upper (index and middle fingers) servo rotates about 120 degrees clockwise if the PIC throws scissors. Both servos rotate 120 degrees clockwise if the PIC throws paper.

Code

The goal of the code was to:

  • Separately control 5 different servos
  • Read 3 inputs from the player's glove
  • Randomly generate a number, and based on that number throw R/P/S
  • Display the results on an LCD screen
  • Recognize when the player has turned off the glove


Note that the servo control and the random number generator portions were borrowed from the internet.

The outline of the code:
1. Declare constants
2. Interrupts for Servo control
3. Random number generator function
(start of main part of program)
4. Generate a random number
5. Reset arm to default rock position
6. Rotate arm servo 4 times, on the 4th ("shoot"), based on random number, control wrist/fingers to do chosen throw
7. Read and determine what the player threw from the glove
8. Display what the computer threw, what you threw on the LCD, display win or lose
9. Rotate thumb/wrist based on whether the player won or lost
10. Read resistance to see if the glove is turned off. If the glove is turned off do not start game until glove is turned back on
11. Go back to step 4

code here

Results

Overall, the RPS machine was a great success. Its mechanically intensive design coupled with an intuitive, user-friendly interface proved to be a winning combination, especially with people without an extensive technical background. Wireless operation of the hand became an essential part of the project - it helped to greatly reduce clutter, despite limited range.

Video of the RPS machine in action can be found here

Next Steps

The RPS machine was developed and created within a five week timespan. While it is fully operational, other features can be added to make it a more complete, enjoyable experience.

  • Spoken results

The machine could say "Rock, Paper, Scissors, Shoot!" while the arm is moving. It could also say "You Win", "You lose", or some variation of those.

  • Servo cushioning

The repetitive motion can generate lots of wear and tear on the servos. Cushioning between each part could extend the lifespan of each servo.

  • Power issues

The arm's downward speed can be viewed as slightly lower than desired. A more powerful servo, or a higher voltage power supply could greatly increase the speed of gameplay.

  • AI

The machine's code could include strategies for which to play against a human. For example, if the player throws paper 4 times in a row, the machine could start to favor scissors.