Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
add web controls for camera mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jan 14, 2020
1 parent 63c55a5 commit a6b9f5e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 32 deletions.
7 changes: 4 additions & 3 deletions controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

CAMERA_MODE_RAW = 'R'
CAMERA_MODE_BALL = 'B'
CAMERA_MODE_LOADING_BAY = 'L'
CAMERA_MODE_HEXAGON = 'H'

class Controls():

def __init__(self):
self.enable_camera = True
self.enable_processing = False
self.camera_mode = CAMERA_MODE_RAW

# self.enable_processing = False
self.camera_mode = CAMERA_MODE_LOADING_BAY
self.enable_streaming = True
self.enable_feed = True
self.turn_camera_off = False

Expand Down
40 changes: 38 additions & 2 deletions web/www/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ new Vue({
data: {
controls: {
enable_camera: false,
enable_processing: false,
// enable_processing: false,
camera_mode: 'R'
}
},
Expand All @@ -16,8 +16,44 @@ new Vue({
methods: {
enableCamera: function () {
var self = this;
self.controls.enable_camera = self.controls.enable_camera
if(self.controls.enable_camera == false){
self.controls.enable_camera = true;
}
else{
self.controls.enable_camera = false;
}
Socket.send(self.controls)
},
enableRaw: function() {
var self = this;
self.controls.camera_mode = 'R';
Socket.send(self.controls)
},
enableBall: function(){
var self = this;
self.controls.camera_mode = 'B';
Socket.send(self.controls)
},
enableHex: function(){
var self = this;
self.controls.camera_mode = 'H'
Socket.send(self.controls)
},
enableBay: function(){
var self = this;
self.controls.camera_mode = 'L'
Socket.send(self.controls)
}
// enableProcessing: function(){
// var self = this;
// if(self.controls.enable_processing == false){
// self.controls.enable_processing = true;
// }
// else{
// self.controls.enable_processing = false;
// }
// Socket.send(self.controls)
// },

}
});
40 changes: 13 additions & 27 deletions web/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@
<head>
<meta charset="utf-8">

<!--<link rel="stylesheet" href="/lib/spectre.min.css">-->
<!--<link rel="stylesheet" href="/lib/spectre-exp.min.css">-->
<!--<link rel="stylesheet" href="/lib/spectre-icons.min.css">-->
<link rel="stylesheet" href="/spectre.min.css">
<link rel="stylesheet" href="/spectre-exp.min.css">
<link rel="stylesheet" href="/spectre-icons.min.css">

<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
<style>
.cosmic {
height:100vh;

background-image: radial-gradient( circle farthest-corner at 0.5% 97.2%, #2fad5b 0%, #93c4ff 100.2% );

}
</style>
</head>
<body class="cosmic">

<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>


<!--<script src="/lib/jquery-2.2.2.min.js"></script>-->
<script src="/vue.js"></script>


<script type="text/x-template" id="main-template">
Expand Down Expand Up @@ -64,37 +58,29 @@
</td>
</tr>
<tr>
<td>enable processing</td>
<td>camera MODE</td>
<td><!-- form switch control -->
</td>
<td>
<div class="form-group">
<label class="form-switch">
<input type="checkbox">
<i class="form-icon"></i>
<label class="form-radio form-inline">
<input type="radio" name="gender" checked="" @click="enableRaw"><i class="form-icon"></i> RAW
</label>
</div>
</td>
</tr>
<tr>
<td>camera MODE</td>
<td><!-- form switch control -->
</td>
<td>
<div class="form-group">
<label class="form-radio form-inline">
<input type="radio" name="gender" checked=""><i class="form-icon"></i> RAW
<input type="radio" name="gender" @click="enableBay"><i class="form-icon"></i> BAY DETECT
</label>
</div>
<div class="form-group">
<label class="form-radio form-inline">
<input type="radio" name="gender"><i class="form-icon"></i> BOX DETECT
<input type="radio" name="gender" @click="enableBall"><i class="form-icon"></i> BALL DETECT
</label>
</div>
<div class="form-group">

<label class="form-radio form-inline">
<input type="radio" name="gender"><i class="form-icon"></i> HEX GOAL DETECT
<input type="radio" name="gender" @click="enableHex"><i class="form-icon"></i> HEX GOAL DETECT
</label>
</div>
</td>
Expand All @@ -117,4 +103,4 @@

</body>

</html>
</html>

0 comments on commit a6b9f5e

Please sign in to comment.