From 93deed0984ce1e45b162aaee88a98b9a22c1f47d Mon Sep 17 00:00:00 2001 From: AndrewLester Date: Wed, 26 Feb 2020 17:10:35 -0500 Subject: [PATCH 1/3] Add pitch angle to target display --- src/index.html | 26 ++++++++++++++------------ src/ui.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/index.html b/src/index.html index b5ac442..c91dd71 100644 --- a/src/index.html +++ b/src/index.html @@ -147,22 +147,24 @@ - + + + No angle - No Target + No Target - - - - + + + + - [ - ] + [ + ] - - - - + + + +
diff --git a/src/ui.js b/src/ui.js index f08a597..e1d1f1a 100644 --- a/src/ui.js +++ b/src/ui.js @@ -44,6 +44,7 @@ const cameraRefresh2 = document.getElementById('camera2-refresh'); const ballsIndicatorBar = document.getElementsByClassName("balls-bar"); const messageButton = document.getElementById("message-button"); const messageText = document.getElementById("message-text"); +const pitchAngleText = document.getElementById('target-pitch-angle'); const camera1OptionSelect = document.getElementById("camera1-options-select"); const camera2OptionSelect = document.getElementById("camera2-options-select"); @@ -266,6 +267,19 @@ NetworkTables.addKeyListener('/components/intake/ballsCollected', (_, value, __) } }); +NetworkTables.addKeyListener('/limelight/ty', (_, value, __) => { + value = Math.round(parseFloat(value)); + + //var target = NetworkTables.getValue('/components/launcher/target_rpm'); + var target = 3.5; + var redDistance = 1; + pitchAngleText.textContent = value + "˚"; + + //sets text color to a color on an hsv gradient between red (0, 100, 90) and green (120, 100, 94) + let [r, g, b] = sampleHSVGradient(target, redDistance, value) + pitchAngleText.style.color = 'rgb(' + r + ' , ' + g + ' , ' + b + ')' +}); + function displayClass(classname, visible){ if(visible){ for (let element of document.getElementsByClassName(classname)) { From 347d56e01f7b924687b42caf01c1cbaeeab79db8 Mon Sep 17 00:00:00 2001 From: AndrewLester Date: Wed, 26 Feb 2020 17:28:23 -0500 Subject: [PATCH 2/3] Add pitch angle display --- src/css/ui.css | 4 ++++ src/index.html | 10 +++++----- src/settings/window.json | 2 +- src/ui.js | 8 ++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/css/ui.css b/src/css/ui.css index 4e8e088..90883de 100644 --- a/src/css/ui.css +++ b/src/css/ui.css @@ -347,6 +347,10 @@ body.enabled > svg { transform: translate(-50%, -50%); } +#target-pitch-angle { + text-anchor: middle; +} + .spinningRot { animation: spin-color-panel-Rot 0.5s linear infinite forwards; } diff --git a/src/index.html b/src/index.html index c91dd71..fdf8a2b 100644 --- a/src/index.html +++ b/src/index.html @@ -149,7 +149,7 @@ - No angle + No angle No Target @@ -161,10 +161,10 @@ [ ] - - - - + + + +
diff --git a/src/settings/window.json b/src/settings/window.json index f4d3156..7a9fbb6 100644 --- a/src/settings/window.json +++ b/src/settings/window.json @@ -1 +1 @@ -{"width":1366,"height":600} \ No newline at end of file +{"width":1366,"height":648} \ No newline at end of file diff --git a/src/ui.js b/src/ui.js index e1d1f1a..32eb162 100644 --- a/src/ui.js +++ b/src/ui.js @@ -268,16 +268,16 @@ NetworkTables.addKeyListener('/components/intake/ballsCollected', (_, value, __) }); NetworkTables.addKeyListener('/limelight/ty', (_, value, __) => { - value = Math.round(parseFloat(value)); + value = ~~(parseFloat(value) * 1000) / 1000; //var target = NetworkTables.getValue('/components/launcher/target_rpm'); - var target = 3.5; - var redDistance = 1; + var target = 0.7; + var redDistance = 2; pitchAngleText.textContent = value + "˚"; //sets text color to a color on an hsv gradient between red (0, 100, 90) and green (120, 100, 94) let [r, g, b] = sampleHSVGradient(target, redDistance, value) - pitchAngleText.style.color = 'rgb(' + r + ' , ' + g + ' , ' + b + ')' + pitchAngleText.style.fill = 'rgb(' + r + ' , ' + g + ' , ' + b + ')' }); function displayClass(classname, visible){ From 0938026a8b4414cc3b93ac6b598a4aa6aa0a8b60 Mon Sep 17 00:00:00 2001 From: AndrewLester Date: Wed, 26 Feb 2020 17:35:29 -0500 Subject: [PATCH 3/3] Change angle target --- src/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui.js b/src/ui.js index 32eb162..cee465a 100644 --- a/src/ui.js +++ b/src/ui.js @@ -271,7 +271,7 @@ NetworkTables.addKeyListener('/limelight/ty', (_, value, __) => { value = ~~(parseFloat(value) * 1000) / 1000; //var target = NetworkTables.getValue('/components/launcher/target_rpm'); - var target = 0.7; + var target = 2.2; var redDistance = 2; pitchAngleText.textContent = value + "˚"; @@ -332,4 +332,4 @@ function hsvToRgb(h, s, v) { } return [r * 255, g * 255, b * 255]; -} \ No newline at end of file +}