Difference between revisions of "Gymnastics Competition App"
(→Initial Machine Design)
(→Initial Machine Design)
|Line 34:||Line 34:|
==Initial Machine Design==
==Initial Machine Design==
[[File:Gymnastics_Machine_Design.jpeg|center||frame|Initial design for the machine]]
==Design and Solutions==
==Design and Solutions==
Revision as of 22:34, 29 April 2017
- 1 Project Proposal
- 2 Initial Machine Design
- 3 Design and Solutions
- 4 Results
- 5 References
Aidan Warren and Lawrence Chan
TA: Nathan Schmetter
Right now, judges score gymnasts using pen and paper, and often have to employ assistants to enter scores for them. We would like to improve this process and to have a more efficient and better way of scoring gymnastics moves. We would build a machine using Raspberry Pi to record deductions with buttons (including a time-stamp of each deduction). There will also be a camera that records the gymnasts' routines. Gymnasts now are unable to view feedback from judges and only receive the final score. Our machine will upload the gymnasts's routine video to Youtube along with timestamp information about when each deduction took place. It will also include their routine's difficulty points and other scoring information. The gymnasts will then be able to go online to view their routines and figure out what mistakes they made and what they need to work on. For our demo, people will be able to watch recorded routines or skills on a computer and score them using our machine. They can then view the youtube video and comments that are uploaded.
- Design the circuitry and Raspberry Pi to input scores with buttons and record the gymnasts' routines using a camera.
- Design and build a unit to house the computer and circuits.
- Upload the information to Youtube for the gymnasts to see the scoring process and view their mistakes.
- Let the audience use the machine for score deduction with a video of a gymnastics routine during our demo.
- Learn how to use Raspberry Pi.
- Learn how to code with Python.
- Learn how circuits work and how to create them (for visual inputs, and display/internet outputs).
- Learn how to implement buttons to the Raspberry Pi.
- Learn how to connect the camera to the Raspberry Pi and take videos with it.
- Learn how to upload the information collected from the Raspberry Pi to Youtube.
- Figure out how to 3D print the housing for the unit.
- $0.00 Raspberry Pi
- $0.00 Youtube upload videos service
- $29.95 Raspberry Pi Camera - https://www.adafruit.com/products/3099
- $7.97 Camera Extension Cord https://www.amazon.com/Adafruit-Flex-Cable-Raspberry-Camera/dp/B00XW2NCKS/ref=sr_1_2?ie=UTF8&qid=1486763635&sr=8-2&keywords=raspberry+pi+camera+extension+cable
- $22.99 Elecrow TFT Display Monitor 3.5 Inch 480x320 TFT LCD Display with Touch Screen for Raspberry Pi 2B B+ Raspberry Pi 3B - https://www.amazon.com/gp/product/B013JEV6VA/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A3UAI31N6IJM2
- $0.00 3D-Printing Materials and Software
- $7.50 (+ $7.14 Shipping) Foot Switch https://www.adafruit.com/products/423?gclid=Cj0KEQiAxeTFBRCGmIq_7rGt_r8BEiQANdPqUk8XYG37qe-_8iJT87roB9Z0fK-OCeW72jrDsBP9niUaAlmV8P8HAQ
Initial Machine Design
Design and Solutions
Module 1: Raspberry Pi and Display Screen
We needed a mini-computer to act as the main body of our machine, that is able to connect to other inputs such as the foot pedal and the camera. We also needed something to display the GUI of our program.
We are using the Raspberry Pi as the main body of our machine, connecting it to a 3.5 inch LCD with touch screen for the GUI of our program from Elecrow. The installation of the 3.5 inch Pi LCD is shown in this page: Installation of the 3.5 inch Pi LCD. 
Module 2: Inputs
We needed an input to record the routine video and an input to time-stamp the judge's deductions. For the time-stamps, we need a an input that does not interfere with the judge's handwritten scoring. For filming, we needed a small camera that was easily compatible with Raspberry Pi to reduce our work load.
We decided to use a foot pedal to time-stamp deductions because it left the judge's hands free to score. Also, only having one button (pedal) instead of multiple makes it easier to use during a fast routine. Because the display screen from module 1 used up all the voltage pins, we didn't have any left for the foot pedal (which had a voltage, ground, and pin wire). In order to solve this problem we coiled the ground and voltage wires together and connected them to a single ground pin. The pin wire we simply connected to a GPIO pin. This works because it completes the circuit and the foot pedal doesn't actually require any voltage to work. It functioned as a simple button. For the camera, we used the Raspberry Pi camera. It is extremely small, and easily compatible with the Raspberry Pi. We plugged it in and only needed to change the screen orientation in order for it to work.
Module 3: Housing
The Raspberry Pi camera must have a housing that protects it. It must also move so the camera can point in any direction. The Raspberry Pi and screen case must be easily openable so we can work on it, and must have ports for many different wires. It also should make it easy for the judge to use and see the screen.
The camera housing is a small box on top of a base, held together by a pin. The pin allows the camera to rotate up and down, while the base can simply be turned in either direction. This allows the camera to point at any angle to best capture the routine. The pin and lid joints are sticking joints, so the camera will remain in whichever position it is put in.
The Raspberry Pi and Screen is housed in a box at an angle to make viewing easier. It has a sliding lid to make accessing the Raspberry Pi easy (this is also a sticking joint to that the lid won't fall out). There are three holes to accommodate the charger, camera cord, and pedal wires.
Module 4: User Interface
The judge needs interface screens for:
- Entering the gymnast's number (or some way to identify each gymnast)
- Recording the video
- Entering the gymnast's skill values
- Entering the gymnast's fulfilled element groups
- Entering deduction values for each of the deductions
There also must be a way to navigate to the next screen. Our original screen sketches incorporated all of these.
Our final interface screens look pretty similar to our designs. We used a blue continue button in the upper right corner of each screen to keep the interface consistent. We also chose a black background to match the machine housing, and used grey buttons across all screens. This contrast makes the buttons easy for the judge to see.
The first screen inputs the gymnast's identification number.
The second screen starts and stops the video recording. Once the judge presses the green "start recording" button, the button changes to a red "stop recording" button. There is also a counter that tracks the number of times the judge presses the pedal during the routine (deduction counter). The judge judges the routine by hand (using pen and paper) as he watches. The next three screens accept inputs from the information he wrote down on his paper.
The third screen inputs the skill values. The judge can use the up and down arrows to adjust the number of each level (A, B, and C) skills the gymnast performed.
The fourth screen inputs the element groups the gymnast performed. The judge can check the boxes of the element groups performed.
The fifth screen inputs the deduction value for each time-stamped deduction. The number in the upper left corner tells the judge which number time-stamp deduction this screen is. This screen repeats for as many deductions as the judge recorded. After pressing the continue button, the video is automatically converted, and an internet browser for YouTube opens. The judge then must click the "allow" button in order for the video to be uploaded. After clicking "allow," the system automatically closes the browser the proceeds to the sixth screen.
The sixth screen displays the final score. Clicking "continue" moves to screen one and restarts the judging process.
Module 5: YouTube Upload
In order for the athletes to receive feedback for the deductions at each part of their routines, we need a way to upload the video of the athlete's routine with time-stamps showing when each deduction occurred.
We decided to use YouTube as the platform to provide feedback for the athletes. This is because it is a widely-used website for videos sharing and that the description of each video allows time-stamps to the video that is easily accessible by just clicking on it. This is a guide to direct uploads of videos from the Raspberry Pi by using a Python program: Directly Upload Videos to YouTube with Raspberry Pi and Python. 
All the modules described above were implemented. Our machine includes a Raspberry Pi connected to a 3.5" display screen which displays the interface. A raspberry pi camera records video and a foot pedal time-stamps deductions. Both of these are connected to the Raspberry Pi. The camera and Raspberry Pi both have 3-D printed housings. The user interface is simple and takes the judge through multiple scoring screens before automatically uploading the video with time-stamped deductions to YouTube.
Compared to Original Objectives
We successfully designed circuitry and utilized the Raspberry Pi. Unlike our initial design, which used four buttons, our final design used only one foot pedal, simplifying our circuitry and the user experience. We also successfully 3-D printed housings for both our Raspberry Pi + Screen and Camera. The machine also automatically uploads the video and deduction time-stamp information to YouTube, which is available for viewing within 2 minutes and does not interrupt the program. We had a successful demo. The audience was able to use the machine to time-stamp a gymnast's fall deduction, and then see that video uploaded in real time.
Critical Decisions and Factors
- Our machine requires the user to authenticate the YouTube channel before uploading. This is only 2 extra buttons to press, but it is inconvenient and requires a browser pop-up. We were unable to automate this process because, unlike the old ClientLogin to authorize command-line scripts to run on servers without a browser, YouTube's new OAuth 2.0 system requires user authentication through a browser. 
- Our system only allows time-stamps of deductions to be precise within one second. This is because YouTube only allows second time-stamp marks for videos. However, this is not a huge problem as there is human error in the reaction time to the judge to press the pedal, and deductions never occur more frequently than several seconds apart.
- When we turn on the Raspberry Pi the system does not automatically start. This is because we thought that the trade off of not being able to access other files important to the program would be too great. As a prototype version, we valued the ability to easily manually edit files on the Raspberry Pi.