-
Notifications
You must be signed in to change notification settings - Fork 1
/
mbot.html
123 lines (110 loc) · 5.2 KB
/
mbot.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>远程控制</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, Maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- 直播视屏开始-->
<canvas id="videoCanvas" width="320" height="240">
<p>
Please use a browser that supports the Canvas Element, like
<a href="http://www.google.com/chrome">Chrome</a>,
<a href="http://www.mozilla.com/firefox/">Firefox</a>,
<a href="http://www.apple.com/safari/">Safari</a> or Internet Explorer 10
</p>
</canvas>
<!-- // <script type="text/javascript" src="jsmpg.js"></script> -->
<script type="text/javascript">
// Setup the WebSocket connection and start the player
// var client = new WebSocket( 'ws://192.168.3.68:8084/' );
// var canvas = document.getElementById('videoCanvas');
// var player = new jsmpeg(client, {canvas:canvas});
</script>
<!-- 直播视屏结束 -->
<!-- 控制台 -->
<div class="cp-wrapper">
<!-- 按钮组 -->
<div class="widget test">
<button class="btn" style="background: #27ae60;border-bottom-color: #16a085;color: #fff;" onclick="motion.setSpeed(200, 200)">run</button>
<button class="btn" style="background: #4A4747;border-bottom-color: #000;color: #fff;" onclick="motion.stopAll()">stop</button>
<button class="btn color" style="background: #e74c3c;border-bottom-color: #c0392b;color: #fff;" onclick="motion.randomLed();">Color</button>
<button class="btn buzzer" style="background: #1abc9c;border-bottom-color: #16a085;color: #fff;" onclick="motion.buzzer();">Buzzer</button>
<button class="btn" style="background: #e67e22;border-bottom-color: #d35400;color: #fff;" onclick="motion.ultrasoinic.start()">ultrasoinic</button>
<button class="btn fliker" style="background: #e67e22;border-bottom-color: #d35400;color: #fff;">灯光闪烁</button>
</div>
<!-- 动作检测模块 -->
<div class="motion-detect">
<video id="monitor" autoplay style="display: none; width: 320px; height: 320px;"></video>
<div id="canvasLayers" width="320" height="320" style="position: relative; left: 0px; top: 0px;">
<canvas id="videoCan" width="320" height="320" style="z-index: 1; position: absolute; left:0px; top:0px;"></canvas>
<canvas id="layer2" width="320" height="320" style="z-index: 2; position: absolute; left:0px; top:0px; opacity:0.5;"></canvas>
</div>
<canvas id="blendCanvas" style="display: none; position: relative; left: 320px; top: 320px; width: 320px; height: 320px;"></canvas>
</div>
<!-- <div class="mask">
<div class="face"></div>
<span class="poptip">Hi, what can i do for you?</span>
</div> -->
<div class="widget control-panel">
<div id="zone"></div>
<div id="debug">
<ul>
<li class="position">
position :
<ul>
<li class="x">x : <span class='data'></span></li>
<li class="y">y : <span class='data'></span></li>
</ul>
</li>
<li class="force">force : <span class='data'></span></li>
<li class="pressure">pressure : <span class='data'></span></li>
<li class="distance">distance : <span class='data'></span></li>
<li class="angle">
angle :
<ul>
<li class="radian">radian : <span class='data'></span></li>
<li class="degree">degree : <span class='data'></span></li>
</ul>
</li>
<li class="direction">
direction :
<ul>
<li class="x">x : <span class='data'></span></li>
<li class="y">y : <span class='data'></span></li>
<li class="angle">angle : <span class='data'></span></li>
</ul>
</li>
</ul>
<div class="dump"></div>
</div>
</div>
<div class="msg">
<p>当前行驶速度 <span class="speedL"></span>/<span class="speedR"></span></p>
<p class="distance">距离前方障碍物距离 <span class="distance-value"></span>cm</p>
</div>
</div>
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/socket.io-1.3.7.js"></script>
<script src="js/nipplejs.js" charset="utf-8"></script>
<script src="js/motion.js"></script>
<script src="client.js"></script>
<script src="js/motion-detect.js"></script>
<script>
function doAction(color) {
if(color == 'red') {
motion.stopAll();
// buzzer();
}
if(color == 'green') {
motion.setSpeed(200, 200);
}
if(color == 'blue') {
motion.stopAll();
}
}
</script>
</body>
</html>