edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement....

44
HockeyBot The goal of this project is to design and build a robotic system capable of competitively playing air hockey against a human player. Final Project Report Date Submitted: 05/09/2012 Instructor: Dr. Melton Team Members: Matt Hodge Sonny Adadi Jason Courtney

Transcript of edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement....

Page 1: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBotThe goal of this project is to design and build a robotic system capable

of competitively playing air hockey against a human player.

Final Project Report

Date Submitted: 05/09/2012

Instructor: Dr. Melton

Team Members: Matt Hodge Sonny Adadi Jason Courtney Jin Li

Page 2: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Table of ContentsProject Overview............................................................................................................................4

Needs Statement.......................................................................................................................4

Objective Statement...................................................................................................................4

Brief Description.........................................................................................................................4

Requirements Specification...........................................................................................................5

Marketing Requirements............................................................................................................5

Engineering Specifications.........................................................................................................5

Concept Selection..........................................................................................................................6

Existing Systems........................................................................................................................6

Concepts Considered................................................................................................................6

Puck Detection.......................................................................................................................6

Control Logic..........................................................................................................................6

Mechanical Motion..................................................................................................................6

Pneumatic Air Supply.............................................................................................................7

Design............................................................................................................................................9

Overall System...........................................................................................................................9

Subsystems..............................................................................................................................10

Software...............................................................................................................................10

Control Logic........................................................................................................................12

Mechanical Motion...............................................................................................................13

User Interface and Controls.....................................................................................................14

Extensibility..............................................................................................................................15

Manufacturability......................................................................................................................16

Reliability..................................................................................................................................16

Background/Multidisciplinary Aspects......................................................................................16

Considerations.............................................................................................................................17

Economic.................................................................................................................................17

Health and Safety....................................................................................................................17

Ethical......................................................................................................................................17

Environment Context...............................................................................................................17

2

Page 3: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Intellectual Property.................................................................................................................17

Cost Estimates.............................................................................................................................18

Testing Strategy...........................................................................................................................19

Unit Testing..............................................................................................................................19

Integration Testing...................................................................................................................19

Software...............................................................................................................................19

Control Logic........................................................................................................................19

Mechanical Motion...............................................................................................................20

Acceptance Testing.................................................................................................................20

Risks............................................................................................................................................21

Trajectory Calculation..............................................................................................................21

Mechanical Components.........................................................................................................21

Noise........................................................................................................................................21

Milestone Chart............................................................................................................................22

Appendix......................................................................................................................................22

Data Sheets.............................................................................................................................26

Acceptance Tests....................................................................................................................27

3

Page 4: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Project Overview

Needs StatementThere are many people who enjoy the game air hockey. Just about everyone has played air hockey at one point or another; it is one of the most popular table games in the world. Being a game that traditionally requires two players, a system is needed to help individual players hone their air hockey skills.

Objective StatementThe objective of this project is to design and prototype a device that will be able to play air hockey against a single player (i.e. the user). The system will detect the incoming puck, calculate its trajectory, position an air hockey mallet to intercept the puck, and return-hit the puck. The system will also keep track of game statistics and display them back to the user.

Brief DescriptionThe HockeyBot system allows a single player to play air hockey against an automated opponent. The figure below describes the basic design of the project. A camera and computer setup monitors the air hockey table and employs image processing techniques to capture the position and movement of the air hockey puck. This information is then used to calculate the puck’s anticipated trajectory. A micro-controller receives the information necessary to position the air hockey mallet to block/hit an incoming puck. A pneumatic rod-less cylinder is used to move the mallet left or right (x-axis). A second pneumatic air piston is used to move the mallet in or out (y-axis). Together these two pneumatic cylinders provide the forces needed to move and hit the air hockey puck. Four high-speed pneumatic solenoid valves are used to control the air flow to the two pneumatic cylinders.

4

Page 5: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

5

Page 6: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Requirements Specification

Marketing Requirements1. The system is able to play air hockey against an opponent. 2. The system is able to calculate an incoming projectile’s trajectory quickly and accurately.3. The system can mechanically block or hit the air hockey puck.4. The system provides a means for keeping game statistics.

Engineering SpecificationsMarketing

RequirementsEngineering Requirements Justification

1,2,3 The vision and processing subsystem detects the puck's position and velocity in 2D space with an accuracy of +/- 3 cm and +/- 3 cm/s.

The system must be able to track a puck accurately.

1,2 The software subsystem calculates the incoming trajectory of the puck in less than 100 ms.

The software subsystem must detect a moving puck quickly so that other subsystems have time to respond.

1,3,4 The mechanical motion subsystem moves to the correct position in less than 400 ms.

The system must have a response time quick enough to block/hit a fast moving puck.

1,4 The mallet is positioned within +/- 3 cm of its target.

The mallet must be positioned to hit or block the incoming puck.

3 The mechanical subsystem is capable of hitting the puck at a speed of 10 m/s.

The system must be fast enough to compete with a human player.

1,4 The software subsystem calculates game statistics

The system must provide the user with statistical information such as scores, matches, etc.

Concept Selection

6

Page 7: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Existing SystemsThere are many virtual table hockey games that exist that feature a single player mode. These are popular because software based implementations are cheaper to make and much easier to manage. One example is on the top applications list in the iTunes application store: “Air Hockey.” This application features both single and multi-player game modes with an option of playing with one or two pucks. There are far fewer physical implementations of a mechanical air hockey opponent. One example with a similar concept is a project by Nuvation. This system includes an off-the-shelf industrial robotic arm that moves approximately 4 m/s; a camera with a 100 frames per second (FPS) capture rate; and an AI system that processes trajectory, spin, and energy loss. The main problem with this system is that the cost of manufacturing is higher than a senior design team can afford.

Concepts ConsideredThe complete automated air hockey system is composed of three main subsystems: puck detection, control logic, and mechanical motion.

Puck DetectionTwo main concepts for puck detection were considered. The first concept uses an array of magnetic proximity sensors with a magnet-embedded puck. The second concept consists of a camera and employs computer vision techniques to detect the puck’s position and trajectory. The simplest and cheapest of both concepts is the camera/vision system. Due to budget constraints, this concept has been selected for this project. 

Control LogicTwo types of micro-controllers were considered for this project: the Arduino and the NXP mbed. The Arduino has a clock speed of 16MHZ while the mbed has a clock speed of 96MHZ. The mbed was selected to be the better choice for this subsystem since it is significantly faster, and speed is a critical component for this project. The only drawback is that the mbed is pricier than the Arduino; however, the team had already acquired an mbed through an ARM promotional event.  For mechanical feedback, two types of linear encoders were considered: magnetic encoders and optical encoders. The optical encoder is slightly more accurate than the magnetic encoder, but it is more expensive. The magnetic encoder was ultimately chosen for this project because it is a durable and low cost solution.

Mechanical Motion

7

Page 8: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

There are many linear actuator options for mechanical motion systems. These options were compared and rated on how completely they fulfilled the demands of the project. The following types of actuators were considered:  

Electric/Mechanical—uses motors to convert electrical energy into mechanical movement. o Wheel/Belt—a motor driven pulley system used to produce linear motion. o Screw—motion of a nut on a screw, where a motor controls the screw to produce

linear motion.  

Pneumatic—uses compressed gas to convert pressure into linear motion. o Rodded cylinder—uses a piston, piston rod, and a sealed cylinder to convert

pressure into linear motion. o Rodless cylinder—similar operation to rodded cylinder but does not contain a piston

rod; instead uses linear bearings.  

Hydraulic—similar to pneumatics except uses pressurized hydraulic fluid. o Tie rod cylinder—uses high strength threaded steel rods to hold end caps to a

cylinder barrel. o Welded body cylinder—welds cylinder barrel directly to end caps. 

 These actuators were compared based on several criteria: speed, accuracy, repeatability and force. The speed criterion is how fast the actuator can get into position. Accuracy is how close to the desired position the actuator can reach. Repeatability is, when given then same inputs, how well the actuator can perform in the same manner. Finally, force is how much force the actuator can output. The following table displays the trade-offs between the different technologies. 

Mechanical Trade-offs Weight Wheel/Belt Screw Pneumatic Hydraulic

Speed 4 0 -- ++ -

Accuracy 2 + ++ - -

Repeatability 2 + ++ - -

Force 1 - + + ++

Total 3 1 5 -6

The results of the table show that the pneumatic technology is the best option for our project; it supplies the best performance in the most crucial area: speed. The second best option would be an electric/mechanical wheel or belt type technology, because they offer suitable trade-offs compared to pneumatic solutions.

8

Page 9: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Pneumatic Air SupplyThe air supply for the mechanical system was selected based on five criteria: tank pressure, refill, duration, cost, and portability. The following table displays the trade-offs between different pneumatic technologies.

Air Supply Weight Air Compressor CO2 Gas Compressed Air

Tank Pressure 3 ++ - - -

Refill 2 ++ + +

Duration 2 + ++ ++

Cost 3 ++ + +

Portable 1 - - ++ ++

Total 16 7 5

An air compressor was chosen over compressed gasses since tank pressure is easier to manage, and no cost is required for refilling the tank. Also, since the tank is pre-supplied with a pressure regulator, it is not necessary to purchase extra equipment.

9

Page 10: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Design

Overall SystemThe overall system consists of three subsystems. The figure below indicates the main sequence of data flow in the system. The process begins in the software stage where puck detection occurs. The puck detection information is processed and the predicted trajectory is passed along to the control logic unit. The control logic unit is responsible for the communication and positioning of the mechanical components. 

10

Page 11: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

SubsystemsEach subsystem is composed of multiple components. The following figure gives a more in-depth view of the subsystems.

SoftwareThe Software subsystem uses a PlayStation Eye camera and the OpenCV computer vision library to detect the puck’s and computer-mallet's position. Software then predicts the puck’s trajectory and passes position data (the suggested position of the HockeyBot’s mallet) to the Control Logic subsystem. The game state also detects and reports to the user through graphical user interface elements. The “Model” serves as the central component of the software application. User input, game state data, and computer-mallet positioning data is accepted as input; output is fed to the mbed, and the user interface updates when appropriate. The following

11

Page 12: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

diagram demonstrates the basic flow of the image processing, trajectory calculation, and game-state detection components. 

Image ProcessingImage processing uses the OpenCV library from Intel. Once an image is fed in, the image needs to be cropped and translated so that a uniform X/Y coordinate range can be mapped to the table surface. Since processing-time needs to be minimized in order to maximize the amount of time the mechanical components have to respond, simple computer vision techniques are used. The air hockey play-field offers a high contrast environment for computer vision (a colored puck on a white surface); this is the perfect environment for HSV thresholding. Once the puck is isolated, blob detection is used to calculate the center of the puck as x and y coordinates on the table’s surface.

Trajectory CalculationOnce puck coordinates are found for at least two frames, the puck’s trajectory can be calculated. The software component observes paths traveling into walls and attempts to estimate a bounce-path (spin is not be taken in to account). As the puck is moving along its path, adjustments are made to the trajectory and velocity when needed. The estimated bounce-path allows the computer-controlled mallet to be positioned for hitting the puck. If the trajectory path changes significantly, the system sends an updated estimate to the control logic

12

Page 13: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

subsystem. The puck’s velocity is used to estimate a “hit-time”. The hit-time is used by the micro-controller to activate the hitting mechanism when the puck arrives.  

Game State

The table above presents the state progression of an air hockey game. The game begins with a coin toss; the winner then gets to serve the puck. Once the puck is served, a general “Play” state is active until the puck stops for 7 seconds, a goal is made, or the puck is lost (ejected off the table or removed by hand). In the case that the puck stops for 7 seconds: the player on the side that the puck stopped forfeits the puck, and the opposing player gets to serve. In the

13

Page 14: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

case that a goal is made: the player that scored gains a point, and the opposing player gets to serve. If a player collects 7 points, a win-state is achieved. If the puck is missing and it is not a goal, our version of the game goes into a “Technical Foul” state and triggers another coin toss.  States are detected based on the location of the puck relative to current state. For example: in the “Player Serve” state, pucks that move from the player’s play-zone into the computer’s play-zone can be considered “in play” and the state is updated to the “Play” state. 

Control LogicAn NXP mbed micro-controller makes up the control logic subsystem. The control logic subsystem performs two main tasks. The first task is comprised of a calibrated timing function for controlling the Mechanical Motion system. Based on the valve timing function, pulses are sent to the solenoid valves to operate the mechanical components. TLP222A photo-MOSFETs are used to relay 24 V signals to solenoid valves in the mechanical system. The second task is to interface with the vision and game detection software running on a PC. The following schematic shows the connections between the laptop/PC, mbed micro-controller, relays, and solenoid valves.

TLP

222A

-22

1

3

4 5

6

7

8

C a th o d e 1

A n o d e 1

A n o d e 2

C a th o d e 2 D ra in D 1

D ra in D 2

D ra in D 3

D ra in D 4

TLP

222A

-22

1

3

4 5

6

7

8

C a th o d e 1

A n o d e 1

A n o d e 2

C a th o d e 2 D ra in D 1

D ra in D 2

D ra in D 3

D ra in D 4

S o le n o id V a lv e 2

1

2

V in

G N D

R 2

S o le n o id V a lv e 3

1

2

V in

G N D

R 1

S o le n o id V a lv e 4

1

2

V in

G N D

2 4 V

S o le n o id V a lv e 1

1

2

V in

G N D

R 3

L a p t o p

US

B

Relays

R 4

mbe

d N

XP

LP

C17

68

4 03 93 83 73 63 53 43 33 23 13 02 92 82 72 62 52 42 32 22 1

123456789

1 01 11 21 31 41 51 61 71 81 92 0

V O U TV UIF -IF +

R D -R D +

TD -TD +

D -D +

P 3 0P 2 9P 2 8P 2 7P 2 6P 2 5P 2 4P 2 3P 2 2P 2 1

G N DV I NV Bn RP 5P 6P 7P 8P 9P 1 0P 1 1P 1 2P 1 3P 1 4P 1 5P 1 6P 1 7P 1 8P 1 9P 2 0

US

B

Mechanical MotionThe Mechanical Motion subsystem consists of several pneumatic devices used to control the pressure and flow of air. The figure below portrays the model of the pneumatic system. In the diagram, the “Rodless Cylinder” controls the side-to-side motion, while the “Pneumatic Piston” controls the forward/back motion (i.e. the hitting motion).

14

Page 15: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

The system begins with an air compressor with the output pressure set to 90 psi. This air supply is split between the two pneumatic cylinders used in the system. Each end of these cylinders is controlled by a 3-port 2-position (3/2) solenoid valve. The 3/2 solenoid valves control the air flow to the pneumatic cylinders. Each cylinder requires two valves. The valves have a default spring return to the exhaust position. When a pulse is sent from the control logic, the solenoid valve is activated and the out port of the valve is switched from exhaust to the air supply.

User Interface and ControlsThe graphical user interface (GUI) acts as the main means of communication between the user and the system; the GUI provides various options and feedback related to the game. Below is screenshot of the GUI.

15

Page 16: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

The GUI contains options to control settings such as difficulty, game control (starting, stopping, and pausing the game). Additional settings can be found in the advanced tab. These settings are used for tweaking the image processing variables (to correct for different lighting conditions, colored pucks, etc.). The GUI also keeps the user updated on game events such as goals, fouls, and win events. Finally, this GUI contains a visual representation of the predicted trajectory.

ExtensibilitySeveral of the sub-components within this project have various uses that can extend to other applications. The software component of the project has areas that deal with image processing, trajectory prediction, and air hockey game-state detection. The functions and algorithms used in these areas could be modified and used as standalone applications for various purposes. For

16

Page 17: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

instance, the image processing and game state detection algorithm can be used as a referee for two human players playing air hockey. The game state detection algorithm takes care of scoring, rules, etc. Another example is having the trajectory prediction algorithm being used for keeping statistics on a player's behavior and shot tendencies; this is useful for players who want to study an opponent or just improve their own skills.

ManufacturabilityThe table is a one of a kind prototype. It was not designed or intended to be manufactured. Since consumer demand is anticipated to be low, manufacturing costs would be high. Modified support structure would need to be added to mount a camera above the table. Secondary parts, such as air compressor and laptop computer would have to be sold separately.

ReliabilityThe reliability of the HockeyBot is mostly a product of the mechanical durability. Industrial grade pneumatic devices were chosen for their long service life and minimal required maintenance.

Background/Multidisciplinary AspectsA collection of different disciplines were utilized in this project; the discipline aspects were split between the different subsystems.

● Software—makes use of computer science/software engineering, mathematics, and physics to accomplish its function. Computer science is needed because of the computer vision aspects in image processing and formation of the GUI. Simple physics/math aids in the analysis and calculation of the air hockey puck's trajectory.

● Control Logic—makes use of computer engineering and electrical engineering to accomplish its tasks. These areas include programming a micro-controller and interfacing it with analog and digital components.

● Mechanical Motion—makes use of the mechanical engineering discipline. No team members had experience with this discipline. Various details on the linear actuators, pneumatic systems, solenoid valves, and air supply mechanisms had to be researched extensively in order to select suitable components.

17

Page 18: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Considerations

EconomicThe cost of the HockeyBot is significantly higher than the cost of a standard air hockey table. This is due to the high costs of the pneumatic components that are required for the mechanical motion system.

Health and SafetyThe HockeyBot is projected to be capable of playing an intense game of air hockey. It is essential that the user remains well hydrated while engaging in an intense air hockey game with the HockeyBot.

The mechanical component of this device is powered by an air compressor. Some air compressors can output more pressure than the pneumatic components can handle. Pressure greater than 120 psi may cause mechanical failure of the solenoid valves. Therefore, it is very important to set the air compressor output-pressure to be less than 120 psi to reduce the risk of unsafe operation.

EthicalAddiction to playing air hockey with the HockeyBot may interfere with day to day tasks such as: going to work, taking care of the kids, good hygiene, sleeping, etc..

Environment ContextThe HockeyBot has many electrical components; this includes transistors, diodes and capacitors. It is necessary to handle reusing or recycling carefully. Electrical components, such as capacitors, cannot be thrown away. It is very important to consider the environmental impact. Thus, the electrical components should be recycled at an electrical recycling facility.

Intellectual PropertyThe open source OpenCV library being used in the HockeyBot software subsystem falls under a BSD license. Similarly, the HockeyBot’s software is also being written under a New BSD (aka. BSD 2-Clause) license.

18

Page 19: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Cost EstimatesThe following table is an estimate of the cost for the parts that compose the project.

Parts Estimated Cost Our Cost (with shipping)

Air Hockey Table $ 300 $ 0

mbed Micro-Controller $ 50 $ 0

TLP222A-2 Photo-MOSFET (x4) $ 7 $ 15

PlayStation Eye (Camera) $ 30 $ 30

Air Hockey Pucks $ 20 $ 20

Laptop/Desktop $ 500 $ 0

Rodless Air Cylinder $ 800 $ 145

Air Piston $ 30 $ 37

Solenoid Valves x4 $ 107 $ 107

Pneumatic Tube/Fittings $ 43 $ 43

AS5306 Encoder w/ PCB $ 26 $ 30

3’ Magnetic Strip $ 9 $ 20

Structural Material / Misc. $ 40 $ 40

TOTAL $ 1964 $ 487

19

Page 20: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Testing StrategyThere are three main stages in our testing strategy: unit testing, integration testing and acceptance testing. Separating our testing strategy into three phases allows us to identify and analyze problems in lower stages before they move on to the subsequent testing stages.

Unit TestingUnit testing is done on each individual component. These components include: camera, solenoid valves, rodless cylinder, air piston, linear encoder, computer vision, and control logic. This type of testing ensures that each part functions properly on its own before it is connected to the rest of the system.

● Software Tests○ Test the trajectory calculation using sample images.○ Test the table and puck-position detection algorithm using sample images

● Control Logic Tests○ Test linear encoder○ Test receiving data from the vision system

● Mechanical Motion Tests○ Test solenoid valve operation○ Test the rodless and rodded air cylinders

Integration TestingIntegration testing focuses on testing each of the subsystems in our project. These tests will ensure that each of the subsystems are providing accurate inputs/outputs for the other subsystems.

SoftwareThe main goal of the software integration tests is to make sure that the camera, image processing, game state detection, and trajectory calculations all work together. The first step in this process is to supply the image processing unit with a pre-recorded air hockey game. This allows us to test and verify the outputs of the software subsystem since information about the game is already known. The output of the image processing is passed into the game state detection algorithm and puck trajectory algorithm. The results of those algorithms are verified by comparing them with the pre-recorded video of an air hockey game.

Control Logic

20

Page 21: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

The control logic subsystem functions as the interface between the software and mechanical subsystems. Integration testing of the control logic includes supplying the micro controller with inputs that have known outputs. These inputs contain puck trajectory information, mallet position, and the puck’s arrival time. The outputs will be signals to the mechanical subsystem. This verifies that the control logic sends the correct pulses to the mechanical motion system.

Mechanical MotionThe integration tests for the mechanical subsystem focus on making sure that all of the components of the pneumatic system are properly connected. This includes the connection of the air supply to the solenoid valves, and the solenoid valves to the linear actuators. Dummy position values will be provided to the solenoid valves to make sure that the proper valves open and the linear actuators move in the correct direction.

Acceptance TestingThe final stage in our testing strategy is to perform acceptance testing. Acceptance testing ensures that our design is in compliance with the engineering requirements, which satisfy the marketing requirements. The acceptance test cases are found in the appendix (Acceptance Tests).

21

Page 22: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Risks

Trajectory CalculationWhen calculating the trajectory for the puck’s movement, many factors are acting on the puck that make difficult to analyze (e.g. puck spin, friction, mass, etc.). Each of these factors contributes to the error in the overall calculation result. Therefore, the resulting trajectory has a degree of inaccuracy. To minimize the effect of this risk, updates are sent to the control logic as the puck moves closer. These updates are used to make adjustments to the HockeyBot’s movements.

Mechanical ComponentsDuring play, the pneumatic cylinders are operating at high speeds. The high speed movement causes vibrations throughout the table. This can potentially lead to a part coming loose or the camera receiving blurred images.

The pneumatic cylinders have delays in responding to the incoming commands. Those delays can cause the mallet to miss the puck. This will significantly reduce the game play experience. These delays are analyzed and minimized as much as possible.

The amount of tubing between the tank and valves causes the speed of the rodless cylinder’s carriage to drop as the compressor’s regulator releases more air. This causes a small reduction in cylinder’s speed. This could cause the mechanical system to become inaccurate or slowed. After running many tests and calibrations with the pneumatic systems this risk has posed any serious performance threat.

NoiseThe noise from our test air compressor is very loud. Annoying noises lower the user’s satisfaction. The noise only occurs while the compressor’s internal pressure drops below the regulated pressure of the system. This risk cannot be avoided, however, because the system depends on an air supply to power its movement.

22

Page 23: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Milestone ChartThe milestone chart shows our milestones and completion dates.

Task Scheduled Completion

Date

Members Responsibl

e

Modified Completion

Date

Comments

Image Thresholding (Prototype)

02/05/2012 SA, MH COMPLETED

mbed Programming (Prototype)

02/19/2012 JC COMPLETED

Cylinder and Valve preliminary testing

02/22/2012 JC COMPLETED

Image Processing 03/09/2012 MH 04/16/2012 COMPLETED

Serial Communication

03/09/2012 JC 04/16/2012 COMPLETED

Piston Control 03/09/2012 JC COMPLETED

Trajectory Calculation

03/16/2012 SA, MH 04/25/2012 COMPLETED

GUI 03/16/2012 SA 04/25/2012 COMPLETED

Encoder (prototype)

03/30/2012 JL, JC 04/02/2012 COMPLETED

Game State 03/30/2012 JL,MH 04/30/2012 COMPLETED

Model 04/06/2012 MH, SA, JL 04/30/2012 COMPLETED

Build piston, mallet, and camera

mounts

04/06/2012 JC, MH 04/19/2012 COMPLETED

Encoder 04/06/2012 JC 04/16/2012 COMPLETED

23

Page 24: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Task(continued)

Scheduled Completion

Date (continued)

Members Responsibl

e(continued)

Modified Completion

Date(continued)

Comments(continued)

Rodless cylinder control

04/06/2012 JC, JL 04/30/2012 COMPLETED

Physical System 04/08/2012 JC, MH, SA, JL

04/09/2012 COMPLETED

Integration Testing 04/13/2012 JL, MH, SA, JC

04/30/2012 COMPLETED

Acceptance Testing

04/20/2012 JL, MH, SA, JC

04/30/2012 COMPLETED

24

Page 25: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

25

Page 26: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

PerspectiveOverall the project has been a great success. Given the time and budget we had, we built a competitive machine for casual air hockey players. The HockeyBot demo at the Imagine RIT Festival went extraordinarily well. Aside from a few momentary pauses to re-tighten some screws, the HockeyBot ran from 10am to 5:30pm (after all the other projects had packed up and left the gym) with a crowd of excited children crowded around waiting for their turn to play.

To make this project a success, we had to make some changes to the initial proposed design. We originally proposed to use a magnetic linear encoder to read relative positioning data of the computer-mallet. We quickly found that the rodless cylinder frequently moved faster than the encoder chip could read. This caused huge problems when using the encoder to position the HockeyBot’s mallet. A solution to this problem was to perform absolute positioning through the vision subsystem by attaching a colored cover to the mallet. The mallet position could then be detected and sent to the microcontroller.

We experienced many issues with the pneumatic control system. When a valve is opened on the rodless cylinder it takes a small amount of time to pressurize the cylinder before the carriage begins to move. This time varies with the position of the carriage. For example, when the carriage is near the left end, and the valve is opened, the volume inside the cylinder that needs to be pressurized is very small thus the pressurizing time is very short. When the carriage is in the middle, the volume inside the cylinder that needs to be pressurized is much larger thus the pressurizing time is much longer. To solve movement issues, calibration functions were created that relate starting and stopping positions to valve-open times. For example, to move the cylinder carriage from position 5 to position 50 (distance of 45 positions), the driving valve must open for roughly 50 ms. To move the cylinder carriage from 55 to 100 (also a distance of 45 positions), the driving valve must open for roughly 110ms. The calibration functions are accurate enough to produce results within the desired ±3cm tolerance.

A couple last minute features were added to the HockeyBot to provide a complete experience for the Imagine RIT demo. Goal sensors were added to the air hockey table to update the computer software when a player/HockeyBot scores a goal. Also, a nice coin toss animation was added to the GUI.

There are some small bugs that still remain in the system. There are occasions where the computer software sends repeat movement commands to the microcontroller causing the HockeyBot’s mallet to move farther than intended and miss the puck. Also, the trajectory calculation on shots bouncing off the side-walls tends to have the most error, causing the HockeyBot to have a hard time blocking or hitting these shots. Given more time to study the cause of these errors, the software could be patched to make the HockeyBot an even better air

26

Page 27: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

hockey player. Regardless of these errors, in addition to the fact that the HockeyBot is mainly defensive (it is not actively calculating the best way to score a goal), we still found that the HockeyBot was competitive against average/casual players.

27

Page 28: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Appendix

Data SheetsPart Part Number Datasheet

Solenoid Valve AVS-3312-24D http :// www . automationdirect . com / static / specs / nitradirectionsolenoidavs 3. pdf

Rodded Cylinder A12120DN http :// www . automationdirect . com / static / specs / nitraca 34. pdf

Rodless Cylinder C/46132B/M/36 http :// www . norgren . com / document _ resources / EN / en _1.6.002. pdf

Solid State Relay TLP222A-2 http :// pdf 1. alldatasheet . com / datasheet - pdf / view /92367/ TOSHIBA / TLP 222 A -2. html

Magnetic Linear Encoder

AS5306A http :// datasheet . octopart . com / AS 5306 A - ATSU - Austriamicrosystems - datasheet - 8615707. pdf

NXP mbed Microcontroller

LPC1768 http :// mbed . org / handbook / mbed - NXP - LPC 1768

28

Page 29: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

Acceptance Tests

Test Case Name: HocketBot test #1

Description:Software system should detect the projectile position and velocity within accuracy of +/- 3cm and +/- 3cm/s.

   Name of Tester: Jason, Jin, Sonny

Setup:Position camera above the air hockey table and set it up to capture frames of the puck's movement.

           Step Action Expected Results Pass Fail N/A Comments

1 Capture frames of the puck's movement.

The captured frames should provide enough data to perform calculations.

 X      The puck frame is captured from the camera.

2 Use the captured frames to calculate the puck's position.

The position X,Y of puck should be within +/- 3cm of the puck's actual position.

 X      From vision: x=37.34 cm, y= 39.07 cm.Actual: x= 35 cm, y=40cm(They are within +/- 3cm)

3 Use the captured frames to calculate the puck's velocity.

The velocity of puck should be within +/- 3cm/s of its actual velocity.

 X      The average speed from application: 55.88 cm/sActual speed (recorded via stopwatch): 57.58 cm/s(They are within +/- 3cm)

             

Overall Test Result: Pass      

Page 30: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #2Description: The software system should be able to calculate the puck's incoming trajectory.   Name of Tester: Jason, Jin, Sonny

Setup:Position camera above the air hockey table. Then hit a puck to test the trajectory calculating algorithm.

           Step Action Expected Results Pass Fail N/A Comments  

1 Capture frames of the puck's movement.

The captured frames should provide enough data to perform calculations.

 X      Puck placed on the table; frame recorded every 8ms.  

2 Puck's trajectory is calculated from the captured frames.

The correct trajectory of the puck is calculated.

 X      The correct trajectory is calculated.  

3 Software system outputs the return trajectory.

The return trajectory is calculated and returned within 100 ms.

 X      The trajectory calculated within 16 ms. *

                

Overall Test Result:  Pass        

* This spec was created when the team was still considering 30fps webcam which would take 33ms per frame. 66 ms for two frames would have been needed for the trajectory calculation. The PS3 Eye gives us greater than 120fps (capturing two frames in less than 16 ms.

30

Page 31: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #3

Description:The mechanical system needs to be able to move to a specified position within 400 ms after receiving a move command.

   Name of Tester: Jason, Jin, SonnySetup: Setup the control system to output commands to the mechanical system.           Step Action Expected Results Pass Fail N/A Comments

1 Configure the control system with several commands to output.

The control system should be ready to output commands.

 X      Positioned mallet at left most point.

2 Send a command from the control system to mechanical system.

The mechanical system should move according to the command.

 X      Sent command to move from "5" to "125". (Position values)

3 Record the timing of the whole process.

The recorded time should be within 400 ms. *

 X      It takes 256 ms to move across the table. *

Overall Test Result:  Pass      

*Worst case (travel from one side to the other) should be tested.

31

Page 32: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #4Description: The paddle must be positioned within +/- 3 cm of its expected position.   Name of Tester: JasonSetup: Setup control system to output commands to the mechanical system.           Step Action Expected Results Pass Fail N/A Comments

1 Configure the control system with several different target positions to output.

The control system should be ready to output commands.

 X      Positioned mallet at leftmost point (position 5).

2 Send a movement commands from the control system to the mechanical system.

The mechanical system should move to the desired location.

 X      Send command to move from 5 to 50.

3 Measure the mechanical systems position.

The mechanical system should be within +/- 3cm of the desired location.

 X      Recorded position 49.

                          

Overall Test Result:  Pass     0.5 cm from desired position. * (pass)

* Each position value corresponds to 0.5 cm.

32

Page 33: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #5

Description:The mechanical subsystem should be capable of hitting the puck at a speed of 10m/s.

   Name of Tester: Jason, SonnySetup: Setup control system to output commands to the mechanical system.           Step Action Expected Results Pass Fail N/A Comments

1 Configure the control system with hitting commands.

The control system should be ready to output commands.

 X      Mallet set to home position.

2 Send a hit command from the control system to the mechanical system.

The mechanical system should perform a hitting motion.

 X      Command sent to hit puck.

3 Record and capture the mechanical systems hitting speed.

The mechanical system should have a speed near 10 m/s.

 ~      Recorded speed:278.6 in/s = 7.07 m/s

                          

Overall Test Result:  ~      7.07 m/s *

* We were testing w/ a smaller air compressor @ 90 PSI. The PSI was lowered from when this spec was made. Higher PSI would increase the hit speed dramatically. The recorded speed is near 10 m/s. Bounced hits (hits that are performed on pucks that are intercepted) are greater than 10 m/s.

33

Page 34: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #6Description: Tracking current position   Name of Tester: JasonSetup: Configure software system to start monitoring the mechanical system's position.           Step Action Expected Results Pass Fail N/A Comments

1 Increment the mechanical system position by steps of 1 inch; starting from the far left.

The software system produces correct position

 X      Positioned at leftmost point.

2 Decrement the mechanical system position by steps of 1 inch; starting from the far right

The software system produces correct position

 X      Valve opened for 15 ms.

                                     

Overall Test Result: Pass      Position = 7/8" or 2.3 cm

This test proves that the HockeyBot can move with very fine precision. By opening the valve for small amounts of time, the change in position can be as small as a few millimeters.

34

Page 35: edge.rit.eduedge.rit.edu/edge/C11303/public/HockeyBotFinalProject…  · Web viewNeeds Statement. There are many people who enjoy the game air hockey. Just about everyone has played

HockeyBot Final Project Report Matt Hodge, Jason Courtney, Sonny Adadi, Jin Li

 

Test Case Name: HocketBot test #7Description: Game states should accurately reflect the current physical game.   Name of Tester: Jason, Jin, SonnySetup: Place puck (player side); start new game.           Step Action Expected Results Pass Fail N/A Comments

1 Move puck towards computer side

Game state: PlayerStart->Play

 X      

2 Stop puck for 7 seconds on computer side

Game state: Play->ComputerForfeit

 X      (ComputerForfeit time was changed to 2 seconds for ImagineRIT)

3 Puck back to player side Game state: ComputerForfeit->PlayerStart

 X      

4 Puck towards computer side Game state: PlayerStart->Play

 X      

5 Stop puck for 7 seconds on player side

Game state: Play->PlayerForfeit

 X      

6 Puck to computer side

Game state:PlayerForfeit->ComputerStart  X      

Overall Test Result:  Pass                   

35