Skip to content

Commit

Permalink
Initial content
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBoesen committed May 7, 2016
1 parent 01a5e93 commit f142532
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# FRCDashboard-MultiCamera
Addon to allow toggling between multiple camera views. Great if your robot has a back camera and a front one.

## Installation
1. If it's not already there, copy the contents of `multicamera.html` to wherever in the dashboard you desire the camera to go.
2. Change the src property of the <img> to wherever your camera source comes from.
3. If it's not already there, copy the contents of `multicamera.css` to `style.css` in the dashboard. Of course, you can put it anywhere else you would normally put CSS.
4. Copy the sections of `multicamera.js` to where the comments above each section say they should go. Unlike the HTML and CSS, this code should not already be there.
13 changes: 13 additions & 0 deletions multicamera.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* This code should already be in the dashboard, but here it is if you need it. */
.camera {
position: fixed;
bottom: 0;
left: 0;
width: 50vw;
overflow: hidden;
height: 80vh;
}
.camera img {
width: 50vw;
height: 80vh;
}
2 changes: 2 additions & 0 deletions multicamera.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- THIS HTML SHOULD ALREADY BE ON THE PAGE. But here it is in case you removed it. -->
<img src="PUT DEFAULT CAMERA SOURCE HERE" id="camera">
32 changes: 32 additions & 0 deletions multicamera.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This should be added inside the definition of the 'ui' object at the starting of ui.js.

,
camera: document.getElementById('camera')

// End section



// Copy this portion of the code into the large switch statement in the onValueChanged function. Then change the src's.

case '/SmartDashboard/useBackCamera':
if (value) {
ui.camera.src = 'INSERT HERE THE SOURCE OF YOUR BACK CAMERA';
} else {
ui.camera.src = 'INSERT HERE THE SOURCE OF YOUR FRONT OR MAIN CAMERA';
}
break;

// End Section



// Add this at the bottom of ui.js with the other listeners.

// Toggle between camera views
ui.camera.onclick = function() {
var cameraKey = '/SmartDashboard/Drive | backCamera';
NetworkTables.setValue(cameraKey, !NetworkTables.getValue(cameraKey));
};

// End section

0 comments on commit f142532

Please sign in to comment.