Introduction: Video Time Shifting - the E-mirror for Tennis Training
Who does not like a mirror. Apart from admiring ones beauty it is used by body builders, dancers... to perfect their skills. Tennis is a sport that requires who body coordination to precise timings. If one were to hypothetically look at a mirror and train he would be a master pretty soon. But unfortunately and unlike a crow, humans cannot look at the tennis ball as well as review their image on the mirror at the same time. Players have used video recordings to review their strokes and correct them. In my case this technique has a cycle time of one day. i.e I record the video, go home and view it; come back the next day and correct my strokes; go home and review... It would be great convenience if the cycle time could be reduced to minutes or seconds. i.e you serve or hit a few strokes and immediately walk a few steps and review your strokes on the time shifted video; come back and correct them. What a convenience this would be. Will it not enable the newbie to master strokes rapidly?
OK so let us go ahead and build the lowest cost e-mirror that is going to train the future Federer.
Step 1: Parts to Buy
1. Raspberry Pi Zero: The open source wonder board that makes this project financially feasible.
https://www.amazon.in/Robocraze-Raspberry-Developm...
2. Raspberry Pi Camera Board
https://www.amazon.in/Raspberry-Pi-Camera-Board/dp...
3. Micro SD card
https://www.amazon.in/gp/product/B018MBABWK/ref=oh...
4. Head sinks (recommended for continuous operation in tropical enviroments)
https://www.amazon.in/Pure-Aluminium-sinks-Raspber...
5. Mini HMDI To HDMI High speed cable
https://www.amazon.in/gp/product/B079284SPT/ref=oh...
6. 5V Micro USB adapter for Raspberr Pi
https://www.amazon.in/ELEMENTZ-Adapter-Charger-Ras...
7. A standard keyboard. This mini keyboard is recommended
https://www.amazon.in/gp/product/B00JO80LUI/ref=oh...
8, A HDMI input monitor. 15" to 21" to plasma displays based on your preference.
9. A tripod stand
https://www.amazon.in/gp/product/B00XI87KV8/ref=oh...
10. A 3D printed casing. You can download this Solidworks file and print a 3D enclosure yourself.
Step 2: Bringup the Hardware
1. Download and install "Raspbian Stretch Lite" on the SD card
The detailed instructions to download and install Raspbian Stretch Lite can be found in the Raspberry Pi website
https://www.raspberrypi.org/downloads/raspbian/
2. Boot up the hardware and login. (refer Raspberry Pi website if you are a newbie to this)
3. Connect the camera module and ensure the camera is working (again refer to Raspberry Pi website if you are a newbie to camera module)
4. Connect to internet and upgrade the os to the latest using the following commands
sudo apt-get update
sudo apt-get upgrade
5. Now that basic hardware is setup and camera module is working fine, we will get into the tinkering part to convert this hardware to a time shifting device.
Attachments
Step 3: The Scripts
Just two commands in the command prompt are sufficient to get our time shifting going. That simple. These commands are lengthy and it is sensible to put it into a script file and just execute the script.
The first command go like this:
raspivid -n -w 1280 -h 720 -t 0 -o - | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' --sout-rtp-caching=15000 :demux=h264
and the second command is:
omxplayer -b rtsp://localhost:8554/
These two command (and additional convenicence commands files for normal video playback and shutdown commands) files are attached. Copy them to your Raspberry Pi through a USB pen drive. (Refer Pi forums for this basic file copying details if you are a newbie again to Pi)
Step 4: The Final Show
1. Boot up the pi and login.
2. Execute script "a" by typing ". a"
The script brings up raspvid and live video is displaye for 10 seconds. Adjust the camera to area of interest. Redo ". a" if you need to play the live video
3. Next execute script "b1" by typing ". b1"
This script also brings up raspvid but the video is played to a pipe (an internal sink rather that the display straight) with buffering for 11 seconds.
4. Open a new command terminal by entering Alt + F2
5. Login and then execute the script "c" by typing ". c"
this brings up omax player and the video stream is form an internal sink. You will see the time delayed video on screen.
6. To exit press excape
7. To shutdown execute the script "z" by typing ".z"
8. If you need more delay just use the other scripts such a b5 - for 15 seconds delay, b60 - for 70 seconds delays etc.
9. Boxing: Now that you have got the gist of the system, it is time to box them and take it to the field. House the entire electronics into the 3D printed box. Glue an M4/M5 screw to mount this box to the tripod. Mate the box and tripod. Take it to the field. If you do not a Electric Power Supply point, use an UPS box.
Happy tennis training.