mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Add ethernet connected, trip time, missed packets, and tooltips to the field monitor (closes #63).
This commit is contained in:
@@ -82,11 +82,12 @@ type Arena struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AllianceStation struct {
|
type AllianceStation struct {
|
||||||
DsConn *DriverStationConnection
|
DsConn *DriverStationConnection
|
||||||
Astop bool
|
Ethernet bool
|
||||||
Estop bool
|
Astop bool
|
||||||
Bypass bool
|
Estop bool
|
||||||
Team *model.Team
|
Bypass bool
|
||||||
|
Team *model.Team
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the arena and sets it to its initial state.
|
// Creates the arena and sets it to its initial state.
|
||||||
@@ -747,6 +748,13 @@ func (arena *Arena) handlePlcInput() {
|
|||||||
arena.handleEstop("B1", blueEstops[0])
|
arena.handleEstop("B1", blueEstops[0])
|
||||||
arena.handleEstop("B2", blueEstops[1])
|
arena.handleEstop("B2", blueEstops[1])
|
||||||
arena.handleEstop("B3", blueEstops[2])
|
arena.handleEstop("B3", blueEstops[2])
|
||||||
|
redEthernets, blueEthernets := arena.Plc.GetEthernetConnected()
|
||||||
|
arena.AllianceStations["R1"].Ethernet = redEthernets[0]
|
||||||
|
arena.AllianceStations["R2"].Ethernet = redEthernets[1]
|
||||||
|
arena.AllianceStations["R3"].Ethernet = redEthernets[2]
|
||||||
|
arena.AllianceStations["B1"].Ethernet = blueEthernets[0]
|
||||||
|
arena.AllianceStations["B2"].Ethernet = blueEthernets[1]
|
||||||
|
arena.AllianceStations["B3"].Ethernet = blueEthernets[2]
|
||||||
|
|
||||||
if arena.MatchState == PreMatch || arena.MatchState == PostMatch || arena.MatchState == TimeoutActive ||
|
if arena.MatchState == PreMatch || arena.MatchState == PostMatch || arena.MatchState == TimeoutActive ||
|
||||||
arena.MatchState == PostTimeout {
|
arena.MatchState == PostTimeout {
|
||||||
|
|||||||
14
plc/plc.go
14
plc/plc.go
@@ -159,6 +159,20 @@ func (plc *Plc) GetTeamEstops() ([3]bool, [3]bool) {
|
|||||||
return redEstops, blueEstops
|
return redEstops, blueEstops
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns whether anything is connected to each station's designated Ethernet port on the SCC.
|
||||||
|
func (plc *Plc) GetEthernetConnected() ([3]bool, [3]bool) {
|
||||||
|
return [3]bool{
|
||||||
|
plc.inputs[redConnected1],
|
||||||
|
plc.inputs[redConnected2],
|
||||||
|
plc.inputs[redConnected3],
|
||||||
|
},
|
||||||
|
[3]bool{
|
||||||
|
plc.inputs[blueConnected1],
|
||||||
|
plc.inputs[blueConnected2],
|
||||||
|
plc.inputs[blueConnected3],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the on/off state of the stack lights on the scoring table.
|
// Set the on/off state of the stack lights on the scoring table.
|
||||||
func (plc *Plc) SetStackLights(red, blue, orange, green bool) {
|
func (plc *Plc) SetStackLights(red, blue, orange, green bool) {
|
||||||
plc.coils[stackLightRed] = red
|
plc.coils[stackLightRed] = red
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
html {
|
html {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
cursor: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
@@ -74,7 +71,7 @@ body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.team-box {
|
.team-box {
|
||||||
width: 25%;
|
width: 20%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: 2.5vw;
|
font-size: 2.5vw;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var handleArenaStatus = function(data) {
|
|||||||
teamElementPrefix = "#" + blueSide + "Team" + station[1];
|
teamElementPrefix = "#" + blueSide + "Team" + station[1];
|
||||||
}
|
}
|
||||||
var teamIdElement = $(teamElementPrefix + "Id");
|
var teamIdElement = $(teamElementPrefix + "Id");
|
||||||
|
var teamEthernetElement = $(teamElementPrefix + "Ethernet");
|
||||||
var teamDsElement = $(teamElementPrefix + "Ds");
|
var teamDsElement = $(teamElementPrefix + "Ds");
|
||||||
var teamRadioElement = $(teamElementPrefix + "Radio");
|
var teamRadioElement = $(teamElementPrefix + "Radio");
|
||||||
var teamRadioTextElement = $(teamElementPrefix + "Radio span");
|
var teamRadioTextElement = $(teamElementPrefix + "Radio span");
|
||||||
@@ -47,6 +48,14 @@ var handleArenaStatus = function(data) {
|
|||||||
teamIdElement.attr("data-status", "");
|
teamIdElement.attr("data-status", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the Ethernet status box.
|
||||||
|
teamEthernetElement.attr("data-status-ok", stationStatus.Ethernet ? "true" : "");
|
||||||
|
if (stationStatus.DsConn && stationStatus.DsConn.DsRobotTripTimeMs > 0) {
|
||||||
|
teamEthernetElement.text(stationStatus.DsConn.DsRobotTripTimeMs);
|
||||||
|
} else {
|
||||||
|
teamEthernetElement.text("ETH");
|
||||||
|
}
|
||||||
|
|
||||||
var wifiStatus = data.TeamWifiStatuses[station];
|
var wifiStatus = data.TeamWifiStatuses[station];
|
||||||
teamRadioTextElement.text(wifiStatus.TeamId);
|
teamRadioTextElement.text(wifiStatus.TeamId);
|
||||||
|
|
||||||
@@ -54,6 +63,7 @@ var handleArenaStatus = function(data) {
|
|||||||
// Format the driver station status box.
|
// Format the driver station status box.
|
||||||
var dsConn = stationStatus.DsConn;
|
var dsConn = stationStatus.DsConn;
|
||||||
teamDsElement.attr("data-status-ok", dsConn.DsLinked);
|
teamDsElement.attr("data-status-ok", dsConn.DsLinked);
|
||||||
|
teamDsElement.text(dsConn.MissedPacketCount);
|
||||||
|
|
||||||
// Format the radio status box according to the connection status of the robot radio.
|
// Format the radio status box according to the connection status of the robot radio.
|
||||||
var radioOkay = stationStatus.Team && stationStatus.Team.Id === wifiStatus.TeamId && wifiStatus.RadioLinked;
|
var radioOkay = stationStatus.Team && stationStatus.Team.Id === wifiStatus.TeamId && wifiStatus.RadioLinked;
|
||||||
@@ -69,6 +79,7 @@ var handleArenaStatus = function(data) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
teamDsElement.attr("data-status-ok", "");
|
teamDsElement.attr("data-status-ok", "");
|
||||||
|
teamDsElement.text("DS");
|
||||||
teamRobotElement.attr("data-status-ok", "");
|
teamRobotElement.attr("data-status-ok", "");
|
||||||
teamRobotElement.text("RBT");
|
teamRobotElement.text("RBT");
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,17 @@
|
|||||||
<div id="{{.side}}Team{{.position}}" class="team">
|
<div id="{{.side}}Team{{.position}}" class="team">
|
||||||
<div id="{{.side}}Team{{.position}}Id" class="team-id center"></div>
|
<div id="{{.side}}Team{{.position}}Id" class="team-id center"></div>
|
||||||
<div class="team-box-row">
|
<div class="team-box-row">
|
||||||
<div id="{{.side}}Team{{.position}}Ds" class="team-box center">DS</div>
|
<div id="{{.side}}Team{{.position}}Ethernet" class="team-box center"
|
||||||
<div id="{{.side}}Team{{.position}}Radio" class="team-box center">
|
title="Driver Station Ethernet Connected Trip Time (ms)">ETH</div>
|
||||||
|
<div id="{{.side}}Team{{.position}}Ds" class="team-box center"
|
||||||
|
title="Driver Station Software Running Missed Packets">DS</div>
|
||||||
|
<div id="{{.side}}Team{{.position}}Radio" class="team-box center" title="Field Access Point Configured Team">
|
||||||
<i class="glyphicon glyphicon-signal"></i>
|
<i class="glyphicon glyphicon-signal"></i>
|
||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="{{.side}}Team{{.position}}Robot" class="team-box center"></div>
|
<div id="{{.side}}Team{{.position}}Robot" class="team-box center"
|
||||||
<div id="{{.side}}Team{{.position}}Bypass" class="team-box center"></div>
|
title="Battery Voltage Seconds Since Last Connected"></div>
|
||||||
|
<div id="{{.side}}Team{{.position}}Bypass" class="team-box center" title="Emergency-Stopped or Bypassed"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
Reference in New Issue
Block a user