Update scoring display for 2018.

This commit is contained in:
Patrick Fairbank
2018-05-17 21:02:59 -07:00
parent be451c96a7
commit fdc92fe07b
3 changed files with 38 additions and 11 deletions

View File

@@ -10,7 +10,8 @@ var scoreCommitted = false;
var handleScore = function(data) {
// Update autonomous period values.
var score = data.Score.CurrentScore;
$("#autoMobility").text(score.AutoMobility);
$("#autoRuns").text(score.AutoRuns);
$("#climbs").text(score.Climbs);
// Update component visibility.
if (!data.AutoCommitted) {
@@ -36,11 +37,17 @@ var handleScore = function(data) {
var handleKeyPress = function(event) {
var key = String.fromCharCode(event.keyCode);
switch (key) {
case "m":
websocket.send("mobility");
case "r":
websocket.send("autoRun");
break;
case "M":
websocket.send("undoMobility");
case "R":
websocket.send("undoAutoRun");
break;
case "c":
websocket.send("climb");
break;
case "C":
websocket.send("undoClimb");
break;
case "\r":
websocket.send("commit");

View File

@@ -16,8 +16,8 @@
<h2>Autonomous Period</h2>
<p>Use the following keyboard shortcuts:</p>
<div class="row">
<div class="col-lg-3 col-lg-offset-1 scoring">m/M</div>
<div class="col-lg-8 scoring-comment">Robot mobility +/-</div>
<div class="col-lg-3 col-lg-offset-1 scoring">r/R</div>
<div class="col-lg-8 scoring-comment">Auto runs +/-</div>
</div>
<div class="row">
<div class="col-lg-3 col-lg-offset-1 scoring">Enter</div>
@@ -29,8 +29,8 @@
<div>
<h2>Autonomous Score</h2>
<div class="row">
<div class="col-lg-4 col-lg-offset-1 scoring-comment">Robot mobility</div>
<div class="col-lg-2 scoring-comment" id="autoMobility"></div>
<div class="col-lg-4 col-lg-offset-1 scoring-comment">Auto runs</div>
<div class="col-lg-2 scoring-comment" id="autoRuns"></div>
</div>
<h3 class="text-center scoring-message">Press Enter to commit autonomous score</h3>
</div>
@@ -41,6 +41,10 @@
<div>
<h2>Teleoperated Period</h2>
<p>Use the following keyboard shortcuts:</p>
<div class="row">
<div class="col-lg-3 col-lg-offset-1 scoring">c/C</div>
<div class="col-lg-8 scoring-comment">Climbs +/- (ignore Levitate)</div>
</div>
<div class="row">
<div class="col-lg-3 col-lg-offset-1 scoring">a</div>
<div class="col-lg-8 scoring-comment">Back to autonomous</div>
@@ -50,6 +54,10 @@
<div class="col-lg-6">
<div>
<h2>Teleoperated Score</h2>
<div class="row">
<div class="col-lg-4 col-lg-offset-1 scoring-comment">Climbs</div>
<div class="col-lg-2 scoring-comment" id="climbs"></div>
</div>
</div>
</div>
</div>

View File

@@ -145,18 +145,30 @@ func (web *Web) scoringDisplayWebsocketHandler(w http.ResponseWriter, r *http.Re
}
switch messageType {
case "mobility":
case "autoRun":
if !autoCommitted {
if (*score).CurrentScore.AutoRuns < 3 {
(*score).CurrentScore.AutoRuns++
}
}
case "undoMobility":
case "undoAutoRun":
if !autoCommitted {
if (*score).CurrentScore.AutoRuns > 0 {
(*score).CurrentScore.AutoRuns--
}
}
case "climb":
if autoCommitted {
if (*score).CurrentScore.Climbs < 3 {
(*score).CurrentScore.Climbs++
}
}
case "undoClimb":
if autoCommitted {
if (*score).CurrentScore.Climbs > 0 {
(*score).CurrentScore.Climbs--
}
}
case "commit":
if web.arena.MatchState != field.PreMatch || web.arena.CurrentMatch.Type == "test" {
autoCommitted = true