forked from nikivanov/watney
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
196 lines (189 loc) · 6.55 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>Watney Rover</title>
<style type="text/css">
*{
font-family: Verdana;
text-decoration: none;
}
#status{
text-align: center;
font-size: 50pt;
}
#footer {
position: absolute;
bottom: 0px;
left: 0px;
}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ui/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/all.css">
<link rel="stylesheet" type="text/css" href="js/material.css">
<link rel="stylesheet" type="text/css" href="js/watney.css">
<link rel="stylesheet" type="text/css" href="js/ui/jquery-ui.min.css">
<script type="text/javascript" src="js/cookies.js"></script>
<script type="text/javascript" src="js/lodash.js"></script>
<script type="text/javascript" src="js/adapter-latest.js"></script>
<script type="text/javascript" src="js/janus.js"></script>
<script type="text/javascript" src="js/watney_janus.js"></script>
<script type="text/javascript" src="js/watney.js"></script>
<script type="text/javascript" src="js/joystick.js"></script>
<script type="text/javascript">
window.addEventListener("load", function(){
var joystick = new JoyStick({
radius: 80,
x: window.innerWidth / 2,
y: window.innerHeight /2,
inner_radius: 70,
mouse_support: false
});
var lastBearing = -1;
var status = document.getElementById('status');
function run_all_time(){
var text = '';
if ( joystick.up ) text += 'up ';
if ( joystick.down ) text += 'down ';
if ( joystick.left ) text += 'left ';
if ( joystick.right ) text += 'right';
var bearing = "0";
var look = 0;
var slow = false;
if (joystick.up) {
if (joystick.left) {
bearing = "nw";
}
else if (joystick.right) {
bearing = "ne";
}
else {
bearing = "n";
}
}
else if (joystick.down) {
if (joystick.left) {
bearing = "sw";
}
else if (joystick.right) {
bearing = "se";
}
else {
bearing = "s";
}
}
else if (joystick.left) {
bearing = "w";
}
else if (joystick.right) {
bearing = "e";
}
if (lastBearing != bearing) {
lastBearing = bearing;
var commandObj = {
'bearing': bearing,
'look': look,
'slow': slow,
};
$.ajax({
url: '/sendCommand',
type: "POST",
data: JSON.stringify(commandObj),
contentType: "application/json; charset=utf-8",
dataType: "json"
});
}
status.innerHTML = text;
requestAnimationFrame( run_all_time );
}
run_all_time();
});
</script>
</head>
<body style="margin: 0; background-color: black">
<div id="status">
</div>
<video id="vid" autoplay></video>
<button id="playButton" style="display: none;"><i class="material-icons">play_arrow</i></button>
<div id="buttonPanel">
<div>
<div id="infoButton" title="Help" class="wButton">
<i class="material-icons">info</i>
</div>
<div id="lightsButton" title="Headlights (L)" class="wButton">
<i class="material-icons">flash_off</i>
</div>
<div id="ttsButton" title="Text to Speech (S)" class="wButton">
<i class="material-icons">chat_bubble_outline</i>
</div>
<div id="micButton" title="Local mic on/off. Push-to-talk (V)" class="wButton">
<i class="material-icons">mic_none</i>
</div>
<div id="volumeSlider" class="wButton noHover" title="Remote Volume (-/+)">
<i class="material-icons">
volume_down
</i>
<input type="range" value=0 min=0 max=5 />
<i class="material-icons">
volume_up
</i>
</div>
<div id="deviceSelectSection" class="wButton noHover" title="Audio Input Device">
<select id="deviceSelector"></select>
</div>
<div id="resetButton" title="Reset" class="wButton">
<i class="material-icons">refresh</i>
</div>
<div id="powerButton" title="Shutdown" class="wButton">
<i class="material-icons">power_settings_new</i>
</div>
</div>
</div>
<div id="shutdown-confirm" title="Shut down Watney?" style="display:none">
<p>Are you sure you want to shut down Watney?</p>
</div>
<div id="restart-confirm" title="Restart Watney?" style="display:none">
<p>Are you sure you want to restart Watney?</p>
</div>
<div id="info" tabindex="-1" style="display: none">
<pre>Controls:
Arrow keys: move the rover
Shift: slow movement
A: look up
Z: look down
S: Text to speech
V: Push-to-talk
L: Headlights</pre>
</div>
<div id="wifiInfo" tabindex="-1">
<div>
<div>SSID:</div>
<div><span id="wifi_ssid"></span></div>
</div>
<div>
<div>Quality:</div>
<div><span id="wifi_quality"></span></div>
</div>
<div>
<div>Signal:</div>
<div><span id="wifi_signal"></span></div>
</div>
<div>
<div>CPU:</div>
<div><span id="cpuUsage"></span>%</div>
</div>
<div>
<div>Battery:</div>
<div><span id="batteryPercent"></span>% <span style="display: none;" id="batteryCharging">(charging)</span></div>
</div>
</div>
<div id="ttsSection" style="display: none;">
<input type="text" id="ttsInput" placeholder="Enter to send, ESC to cancel" />
</div>
<div id="reconnecting" style="display: none;">
Reconnecting...
</div>
</body>
</html>