Skip to content

Commit

Permalink
Add RIO ping
Browse files Browse the repository at this point in the history
  • Loading branch information
jschenke488 committed Oct 29, 2024
1 parent 99750c5 commit d196803
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions field/driver_station_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type DriverStationConnection struct {
Estop bool
DsLinked bool
RadioLinked bool
RioLinked bool
RobotLinked bool
BatteryVoltage float64
DsRobotTripTimeMs int
Expand Down Expand Up @@ -99,6 +100,7 @@ func (arena *Arena) listenForDsUdpPackets() {
dsConn.DsLinked = true
dsConn.lastPacketTime = time.Now()

dsConn.RioLinked = data[3]&0x08 != 0
dsConn.RadioLinked = data[3]&0x10 != 0
dsConn.RobotLinked = data[3]&0x20 != 0
if dsConn.RobotLinked {
Expand All @@ -120,6 +122,7 @@ func (dsConn *DriverStationConnection) update(arena *Arena) error {

if time.Since(dsConn.lastPacketTime).Seconds() > driverStationUdpLinkTimeoutSec {
dsConn.DsLinked = false
dsConn.RioLinked = false
dsConn.RadioLinked = false
dsConn.RobotLinked = false
dsConn.BatteryVoltage = 0
Expand Down
3 changes: 2 additions & 1 deletion field/team_match_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewTeamMatchLog(teamId int, match *model.Match, wifiStatus *network.TeamWif
}

log := TeamMatchLog{log.New(logFile, "", 0), logFile, wifiStatus}
log.logger.Println("matchTimeSec,packetType,teamId,allianceStation,dsLinked,radioLinked,robotLinked,auto,enabled," +
log.logger.Println("matchTimeSec,packetType,teamId,allianceStation,dsLinked,radioLinked,rioLinked,robotLinked,auto,enabled," +
"emergencyStop,batteryVoltage,missedPacketCount,dsRobotTripTimeMs,rxRate,txRate,signalNoiseRatio")

return &log, nil
Expand All @@ -54,6 +54,7 @@ func (log *TeamMatchLog) LogDsPacket(matchTimeSec float64, packetType int, dsCon
dsConn.AllianceStation,
dsConn.DsLinked,
dsConn.RadioLinked,
dsConn.RioLinked,
dsConn.RobotLinked,
dsConn.Auto,
dsConn.Enabled,
Expand Down
3 changes: 3 additions & 0 deletions static/css/field_monitor_display.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ body {
background-color: #00ff00;
color: #333;
}
.team-id[data-status=rio-linked], .team-notes[data-status=rio-linked] {
background-color: #00cc00;
}
.team-id[data-status=radio-linked], .team-notes[data-status=radio-linked] {
background-color: #AA3377;
}
Expand Down
2 changes: 2 additions & 0 deletions static/js/field_monitor_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ var handleArenaStatus = function(data) {
status = "wrong-station";
} else if (stationStatus.DsConn.RobotLinked) {
status = "robot-linked";
} else if (stationStatus.DsConn.RioLinked) {
status = "rio-linked";
} else if (stationStatus.DsConn.RadioLinked) {
status = "radio-linked";
} else if (stationStatus.DsConn.DsLinked) {
Expand Down

0 comments on commit d196803

Please sign in to comment.