How agame7k/freezy-arena works
Freesy Arena is a Go field-management system for running robotics competitions, with browser-based controls and displays, live match scoring, tournament scheduling, and optional field/network hardware integrations. The external trigger is an event operator launching the cheesy-arena executable; staff and display users then interact through a browser, while driver stations and field devices connect over network protocols. Startup constructs the arena, starts the web server, and runs the arena state machine.
Components
Application startup and control
• Executable startup — main.go: parses the development-network flag, creates the arena, starts the web interface in a goroutine, and runs the arena loop.
• Arena runtime and match coordination — field/arena.go: owns live event and match state, initializes hardware/notifiers, and coordinates match loading, timers, scoring inputs, and tournament updates.
• Driver-station protocol — field/driver_station_connection.go: accepts driver-station TCP connections, assigns stations, exchanges control/game-data packets, and tracks connections.
Operator, browser, and live updates
• HTTP operator interface — web/web.go: implements the web server entry point and route setup; the README documents browser-based human interaction.
• Match review and score editing — web/match_review.go: serves match-result editing, calculates summaries, and commits edits through the web arena.
• Reports and exports — web/reports.go: generates event reports in CSV/PDF and includes judging-schedule reporting.
• Browser displays and controls — static/js/audience_display.js: a representative browser display; the README documents browser clients using WebSockets for commands and updates.
• WebSocket transport and notification — websocket/websocket.go: provides WebSocket handling; websocket/notifier.go implements notifier behavior for connected clients.
Event state and competition logic
• Persistent event database — model/database.go: opens Bolt storage and registers tables for event settings, teams, matches, results, rankings, and related records.
• Game rules and scoring — game/score.go: calculates match scores; game/rule.go: defines scoring rules. Score summaries and ranking calculations are additional game responsibilities.
• Qualification and judging schedules — tournament/judging_schedule.go: schedules judging slots against qualification matches and breaks, saving slots to the database.
• Playoff brackets — playoff/double_elimination.go: constructs double-elimination bracket matchups and timing specifications; the README also highlights small-team double eliminations.
• Event and match model types — model/match.go: defines match data used by event workflows.
Hardware and external services
• PLC field I/O — plc/plc.go: polls a Modbus PLC, reads inputs, and writes output coils; field/arena.go consumes field I/O in match control.
• Wireless access-point management — network/access_point.go: configures team Wi-Fi and polls connection status through the access point HTTP API.
• LED control — led/controller.go: implements LED controller behavior; the README documents support for Advatek controllers and field LED hardware.
• External event publishing — partner/tba.go: retrieves and publishes event, match, alliance, and related data through The Blue Alliance API; the README documents schedule, results, and rankings publishing.
• Competition lighting and show control — partner/blackmagic.go: represents the Blackmagic integration; partner/companion.go: implements Companion integration. Specific runtime wiring is not established by the excerpts.
Relationships
• Event operator -> Executable startup: launches the application; evidence: README.md.
• Executable startup -> Arena runtime and match coordination: creates the arena and runs its state machine; evidence: main.go.
• Executable startup -> HTTP operator interface: constructs the web interface and starts its server in a goroutine; evidence: main.go.
• Browser user -> HTTP operator interface: interacts with the application through a browser; evidence: README.md.
• HTTP operator interface -> Match review and score editing: route registration is not shown in the sampled excerpt; evidence: none (inferred from documented web application and handler responsibility).
• Match review and score editing -> Persistent event database: reads stored match results for non-current matches; evidence: web/match_review.go.
• Match review and score editing -> Game rules and scoring: imports game scoring types and uses rules for editing and summary workflows; evidence: web/match_review.go.
• Arena runtime and match coordination -> PLC field I/O: creates PLC implementations and processes PLC input/output; evidence: field/arena.go.
• Arena runtime and match coordination -> Driver-station protocol: the arena manages alliance stations and the driver-station code operates on arena state; evidence: field/driver_station_connection.go.
• PLC field I/O -> WebSocket transport and notification: PLC code imports the WebSocket package to send I/O change messages; evidence: plc/plc.go.
• Arena runtime and match coordination -> Playoff brackets: reconstructs and updates the playoff tournament; evidence: field/arena.go.
• Tournament scheduling -> Persistent event database: loads qualification matches and schedule blocks, then saves judging slots; evidence: tournament/judging_schedule.go.
• External event service (The Blue Alliance) -> External event publishing: receives API requests for event data; evidence: partner/tba.go.
• Browser displays and controls -> WebSocket transport and notification: clients use WebSockets for commands and updates; evidence: README.md.
• Arena runtime and match coordination -> External event publishing: event-triggered client call sites are not fully visible in the excerpt; evidence: none (inferred from arena’s partner references and TBA integration).
Coverage limits: Several central modules are sampled only partially, and many web routes, notifier implementations, model types, and partner integrations are not excerpted. The README establishes product-level behavior, but the exact runtime wiring for several displays, integrations, and publication triggers could not be verified.
Main entry points: arena.go Arena runtime · main.go Executable startup · match_review.go Match review · web.go HTTP operator interface
Components 19
Application Runtime
Startup, arena coordination, and driver-station communication.
- Executable startup
main.go - Arena runtime
field/arena.go - Driver-station protocol
field/driver_station_connection.go
Browser Interface
Operator workflows, browser displays, and live WebSocket updates.
- HTTP operator interface
web/web.go - Match review
web/match_review.go - Reports and exports
web/reports.go - Browser displays
static/js/audience_display.js - WebSocket notifier
websocket/websocket.go
Competition Logic
Event persistence, scoring, schedules, and playoff brackets.
- Event database
model/database.go - Game scoring
game/score.go - Judging schedules
tournament/judging_schedule.go - Playoff brackets
playoff/double_elimination.go
External Integrations
Field hardware and external event publishing.
- PLC field I/O
plc/plc.go - Wireless access point
network/access_point.go - LED controller
led/controller.go - Event publisher
partner/tba.go
Other components
- Event operator
- Browser user
- Blue Alliance API
Connections 15
- Event operator → Executable startup: launches
README.md - Executable startup → Arena runtime: creates and runs
main.go - Executable startup → HTTP operator interface: starts server
main.go - Browser user → HTTP operator interface: interacts through
README.md - HTTP operator interface → Match review: routes to · Inferred; not shown in the code that was read.
- Match review → Event database: reads results
web/match_review.go - Match review → Game scoring: uses rules
web/match_review.go - Arena runtime → PLC field I/O: processes field I/O
field/arena.go - Arena runtime → Driver-station protocol: manages stations
field/driver_station_connection.go - PLC field I/O → WebSocket notifier: sends I/O changes
plc/plc.go - Arena runtime → Playoff brackets: updates bracket
field/arena.go - Judging schedules → Event database: loads and saves
tournament/judging_schedule.go - Blue Alliance API → Event publisher: receives requests
partner/tba.go - Browser displays → WebSocket notifier: uses for updates
README.md - Arena runtime → Event publisher: publishes event updates · Inferred; not shown in the code that was read.