-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
222 lines (171 loc) · 12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<html>
<head>
<title>AR Lap Tracker</title>
<script src="main-settings.js"></script>
<script src="main-record.js"></script>
<script src="main-race.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" href="main.css"/>
<link rel="stylesheet" href="main-settings.css"/>
<link rel="stylesheet" href="main-laps.css"/>
<link rel="stylesheet" href="main-help.css"/>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
</head>
<body style="background-color: rgba(240,240,255,0.6)">
<div class="left-column">
<div class="settings-panel">
<table>
<tr>
<td><div class="settings-panel-header">Settings:</div></td>
<td style="text-align: right; width: 200px; vertical-align: top"><div class="reset-button" onclick="window.location.href = window.location.href.split('?')[0];">Reset</div></td>
<td style="text-align: right; vertical-align: top"><div class="help-button" onclick="document.querySelector('.help-panel').style.display='block'">Help</div></td>
</tr>
</table>
<div class="setting-panel">
<div class="setting-name">Marker size:</div>
<input id="markerSizeMeters" type="text" value="0.2" size="4" oninput="applySettings()">
<div class="setting-units"> meters</div>
</div>
<div class="setting-panel">
<div class="setting-name">Lap finished when distance to marker less than:</div>
<input id="minMarkerDistanceMeters" type="text" value="1" size="4" oninput="applySettings()">
<div class="setting-units"> meters</div>
</div>
<div class="setting-panel">
<div class="setting-name">Min lap time:</div>
<input id="minLapTimeSeconds" type="text" value="5" size="4" oninput="applySettings()">
<div class="setting-units"> seconds</div>
</div>
<div class="setting-panel">
<div class="setting-name" style="width: 85px">Countdown:</div>
<div class="setting-name" style="width: 30px; margin-left: 17px"> min</div>
<input id="coundownMinSeconds" type="text" value="3" size="1" oninput="applySettings()">
<div class="setting-name" style="width: 30px; margin-left: 9px; margin-right: 8px"> max</div>
<input id="coundownMaxSeconds" type="text" value="3" size="1" oninput="applySettings()">
<div class="setting-units"> seconds</div>
</div>
<div class="setting-panel">
<div class="setting-name">Min frames with marker:</div>
<input id="minFramesWithMarker" type="text" value="5" size="4" oninput="applySettings()">
<div class="setting-units"> seconds</div>
</div>
<div class="setting-panel">
<div class="setting-name">Record video:</div>
<input id="recordVideo" type="checkbox" style="margin: 0" oninput="applySettings()">
</div>
</div>
<div class="laps-panel">
<div class="start-race-button" onclick="toggleRace()">Start race</div>
<div class="race-time">00:00.000</div>
<!--
In order to freeze header we split laps table into 2 tables.
It's better to have laps table with scroll to avoid scrolling the whole page to always
keep race time and video on the screen during the recording
-->
<table class="laps-table">
<thead>
<th class="laps-column-pilot">Pilot</th>
<th class="laps-column-number">Lap</th>
<th class="laps-column-time">Time</th>
<th class="laps-column-split">Split</th>
</thead>
</table>
<div class="lap-times-scrollbox">
<table class="lap-times">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<audio id="lap-finished-audio" src="sounds/lap-finished.mp3"></audio>
<audio id="countdown-audio" src="sounds/countdown.mp3"></audio>
<audio id="start-audio" src="sounds/start.mp3"></audio>
<div class="help-panel" onclick="document.querySelector('.help-panel').style.display='none'">
<div class="help-content">
<h1>AR lap tracker</h1>
<p>AR lap tracker is a web tool for tracking laps in FPV drone racing by marking finish line with AR markers/QR codes
and recognizing them in VTX video feed. You'll need USB OTG 5.8Ghz video receiver to use it.</p>
<h2>How to use</h2>
<p>Print any (you only need one) of the following markers on A4 paper and place it near the finish line.</p>
<img src="markers/tinyviewplus-marker_00_main_a.png" width="100px" height="100px">
<img src="markers/tinyviewplus-marker_01_main_b.png" width="100px" height="100px">
<img src="markers/tinyviewplus-marker_02_main_c.png" width="100px" height="100px">
<img src="markers/tinyviewplus-marker_03_main_d.png" width="100px" height="100px">
<p>Set margins to zero during printing to maximize the picture size on paper.</p>
<p>Connect USB OTG video receiver to your PC - it automatically acts as an ordinary webcam.</p>
<p>Configure the settings and hit Start race!</p>
<h2>Settings</h2>
<p><b>Marker size</b> - the length of black square's side in meters, on A4 from pdf it's
usually about 16cm, so input 0.16. This is used to determine distance to the marker
and ignore it if it's too far away</p>
<p><b>Lap finished when distance to marker less than</b> - when drone is near the marker and
marker goes out of sight - the app assumes that pilot passed the finish gate. Configure this
distance threshold. Note that some cameras have narrow FOV and can't see marker when they
are too close to it so be sure to test it on different drones before the race.</p>
<p>NOTE! At the moment there is a bug, where distance to marker may be determined a but incorrectly
and depend on camera FOV. Please check this and slightly adjust this settings for your environment
if needed (usually the difference between measured and actual distance is within 10%, so it is
not needed) - better just to put higher value here. The lap finish registration happens based on
the distance shown as number overlay and not on the blue box size, although they are expected to
be the same if everything works correctly.</p>
<p><b>Min lap time</b> - set min lap time to ignore cases when pilot got stuck near the finish
gate for some time. Adjust it it the actual length of your track.</p>
<p><b>Min frames with marker</b> - marker must be detected in this number of consecutive frames
in order for lap to be tracked (if frame 1 has marker A and frame 2 has marker B - we treat it as 2
consecutive detections). Sometimes marker patterns are erroneously detected in FPV noise, usually in
only a single frame. To avoid triggering lap finished check in these cases we use this setting. Min
value should be 2, but we use 3 as the default for safety. If you don't mind false positives - feel
free to set it to 1.</p>
<p><b>Record video</b> - in case of any lap counter errors we want to record video to be able to
correct manually after the race. If this option is checked - you'll be asked to choose the
browser tab to record and only then the race will start.</p>
<p>Also this option guards your from accidentally erasing results after race was stopped if you've
unintentionally clicked Start race again since you'll need to select screen to record first and
only then previous results would be erased.</p>
<p><b>Countdown</b> - random or fixed countdown can be configured, you'll hear beeps every second
and then the start sound.</p>
<p><b>Camera</b> - connect USB video receiver and select it in this dropdown. In order to remove the
device - select Remove pilot option.</p>
<p><b>Pilot name</b> - pilot name to use when tracking laps to distinguish between several pilots.
Make sure all pilots have unique names!</p>
<p>Settings are saved to window url and are preserved upon refresh. This may be useful in receiver
got stuck or you have performance degradation and need to reload the page. To reset the settings to
defaults - click on Reset link in the Settings panel.</p>
<h2>Marker placement best practices</h2>
<p>Before starting the race you should power your drone and point it to the marker - the app should
show a colored box where it detects the marker and distance to it. Check if shown distance to marker
is correct - otherwise adjust marker size in settings.</p>
<p>If you don't see the box - make sure your marker is clearly visible through the camera and sheet
of paper is not bent - it should be straight. Marker rotation over any axis doesn't matter.</p>
<p>Marker is - white pattern in the center with black area around it and it also must have a white
contrasting border around the black area to be recognized.</p>
<p>If marker is partially visible - it won't be recognized. Bear in mind that marker can also be
covered by OSD (especially low battery warning later in race!) or VTX noise.</p>
<p>Our markers are taken from <a href="https://github.com/t-asano/tinyviewplus">TinyViewPlus lap
tracker</a> to be cross-compatible. It doesn't matter which one of them you use.</p>
<p>To increase probability of marker recognition - you can place several markers (print one image
several times or use different - doesn't matter) around the finish gate - if at least one of them
is recognized the lap will be recorded correctly. Although if you use same image several times then
the app will shift colored area between them depending on which one is better visible - it doesn't
affect lap tracking since in this case marker is still considered constantly visible.</p>
<p>Marker needs to stay visible on screen and not be too shaky for about 0.5 sec in order to be
recognized. When planing track layout a typical option is to have finish gate about 3-5m after 180
degree turn so that pilots slow down, face the gate with markers and then approach it in a straight
line.</p>
<h2>Known issues, limitations and compatibility</h2>
<p>If recording is many minutes long it may consume all memory - not tested currently, but probably
will be fixed later.</p>
<p>Tested with:</p>
<ul>
<li>Chrome browser</li>
<li>Skydroid OTG USB 5.8Ghz video receiver</li>
<li>Happymodel Mobula6 tinywhoop</li>
</ul>
</div>
</div>
<div class="videos-panel">
<div class="add-pilot-button" onclick="addPilot()"><div class="plus">+</div></div>
</div>
</body>
</html>