Skip to content

Commit

Permalink
Convert to warrior-arena and add smc_ws
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPurpleSocks committed Oct 17, 2024
1 parent 952d20f commit 348f347
Show file tree
Hide file tree
Showing 121 changed files with 592 additions and 313 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014, Team 254
Copyright (c) 2014, Team 254, Team 3256
All rights reserved.

This software may be used and redistributed subject to the following conditions:
Expand Down
58 changes: 37 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Cheesy Arena [![Build Status](https://github.com/Team254/cheesy-arena/actions/workflows/test.yml/badge.svg)](https://github.com/Team254/cheesy-arena/actions)
Warrior Arena [![Build/Test](https://github.com/Team3256/warrior-arena/actions/workflows/test.yml/badge.svg)](https://github.com/Team3256/warrior-arena/actions/workflows/test.yml)
============
A field management system that just works.

For the game-agnostic version, see [Cheesy Arena Lite](https://github.com/Team254/cheesy-arena-lite).

## Key features
**For participants and spectators**

Expand All @@ -23,14 +21,22 @@ For the game-agnostic version, see [Cheesy Arena Lite](https://github.com/Team25
* Reports, results, and logs can be viewed from any computer
* An arbitrary number of auxiliary displays can be set up using any computer with just a web browser, to show rankings, queueing, field status, etc.

**For teams**
* Uses cheaper hardware (no modbus!)
* Allows for less wiring (just additional ethernet cable to alliance stations + one for amps)
* You don't have to program a PLC

## We didn't make most of this
This was made almost in whole by FRC Team 254. Team 3256 has just modified it to work better for our resources and budgets.

## License
Teams may use Cheesy Arena freely for practice, scrimmages, and off-season events. See [LICENSE](LICENSE) for more details.
Teams may use Warrior Arena freely for practice, scrimmages, and off-season events. See [LICENSE](LICENSE) for more details.

## Installing

**From a pre-built release**

Download the [latest release](https://github.com/Team254/cheesy-arena/releases). Pre-built packages are available for Linux, macOS (x64 and M1), and Windows.
Download the [latest release](https://github.com/Team3256/warrior-arena/releases). Pre-built packages are available for Linux, macOS (x64 and M1), and Windows.

On recent versions of macOS, you may be prevented from running an app from an unidentified developer; see [these instructions](https://support.apple.com/guide/mac-help/open-a-mac-app-from-an-unidentified-developer-mh40616/mac) on how to bypass the warning.

Expand All @@ -40,49 +46,59 @@ On recent versions of macOS, you may be prevented from running an app from an un
1. Clone this GitHub repository to a location of your choice
1. Navigate to the repository's directory in the terminal
1. Compile the code with `go build`
1. Run the `cheesy-arena` or `cheesy-arena.exe` binary
1. Run the `Warrior-arena` or `Warrior-arena.exe` binary
1. Navigate to http://localhost:8080 in your browser (Google Chrome recommended)

**IP address configuration**

When running Cheesy Arena on a playing field with robots, set the IP address of the computer running Cheesy Arena to 10.0.100.5. By a convention baked into the FRC Driver Station software, driver stations will broadcast their presence on the network to this hardcoded address so that the FMS does not need to discover them by some other method.
When running Warrior Arena on a playing field with robots, set the IP address of the computer running Warrior Arena to 10.0.100.5. By a convention baked into the FRC Driver Station software, driver stations will broadcast their presence on the network to this hardcoded address so that the FMS does not need to discover them by some other method.

When running Warrior Arena without robots for testing or development, any IP address can be used.

When running Cheesy Arena without robots for testing or development, any IP address can be used.
When using raspberry pis for alliance station buttons and scoring, the following IPs should be used
| Raspberry Pi Location | IP Address |
|-----------------------------------|------------|
| Red Alliance Driver Station | 10.0.101.0 |
| Blue Alliance Driver Station | 10.0.101.1 |
| Reserved For Auto Scoring | 10.0.101.2 |
| Reserved For Auto Scoring | 10.0.101.3 |
| Reserved For Auto Scoring | 10.0.101.4 |
| Reserved For Auto Scoring | 10.0.101.5 |

## Under the hood
Cheesy Arena is written using [Go](https://golang.org), a language developed by Google and first released in 2009. Go excels in the areas of concurrency, networking, performance, and portability, which makes it ideal for a field management system.
Warrior Arena is written using [Go](https://golang.org), a language developed by Google and first released in 2009. Go excels in the areas of concurrency, networking, performance, and portability, which makes it ideal for a field management system.

Cheesy Arena is implemented as a web server, with all human interaction done via browser. The graphical interfaces are implemented in HTML, JavaScript, and CSS. There are many advantages to this approach – development of new graphical elements is rapid, and no software needs to be installed other than on the server. Client web pages send commands and receive updates using WebSockets.
Warrior Arena is implemented as a web server, with all human interaction done via browser. The graphical interfaces are implemented in HTML, JavaScript, and CSS. There are many advantages to this approach – development of new graphical elements is rapid, and no software needs to be installed other than on the server. Client web pages send commands and receive updates using WebSockets.

[Bolt](https://github.com/etcd-io/bbolt) is used as the datastore, and making backups or transferring data from one installation to another is as simple as copying the database file.

Schedule generation is fast because pre-generated schedules are included with the code. Each schedule contains a certain number of matches per team for placeholder teams 1 through N, so generating the actual match schedule becomes a simple exercise in permuting the mapping of real teams to placeholder teams. The pre-generated schedules are checked into this repository and can be vetted in advance of any events for deviations from the randomness (and other) requirements.

Cheesy Arena includes support for, but doesn't require, networking hardware similar to that used in official FRC events. Teams are issued their own SSIDs and WPA keys, and when connected to Cheesy Arena are isolated to a VLAN which prevents any communication other than between the driver station, robot, and event server. The network hardware is reconfigured via SSH and Telnet commands for the new set of teams when each mach is loaded.
Warrior Arena includes support for, but doesn't require, networking hardware similar to that used in official FRC events. Teams are issued their own SSIDs and WPA keys, and when connected to Warrior Arena are isolated to a VLAN which prevents any communication other than between the driver station, robot, and event server. The network hardware is reconfigured via SSH and Telnet commands for the new set of teams when each mach is loaded.

## PLC integration
Cheesy Arena has the ability to integrate with an Allen-Bradley PLC setup similar to the one that FIRST uses, to read field sensors and control lights and motors. The PLC hardware travels with the FIRST California fields; contact your FTA for more information.
## PLC substitution
Warrior Arena has the ability to connect to Raspberry Pis (or similar SBCs) instead of using a PLC. Both all driver stations have an E-Stop and an A-Stop, with one RPi per alliance. Additionally, one RPi per major section of the game, that isn't connected to the driver stations (note: certain years, 2025 for example, don't have auto scoring, thus only use the two driver station RPis)

The PLC code can be found [here](https://github.com/ejordan376/Cheesy-PLC).
The RPi code can be found [here](https://github.com/Team3526/warrior-arena/RPi).

## LED hardware
Due to the prohibitive cost of the LEDs and LED controllers used on official fields, for years in which LEDs are mandatory for a proper game experience (such as 2018), Cheesy Arena integrates with [Advatek](https://www.advateklights.com) controllers and LEDs.
Due to the prohibitive cost of the LEDs and LED controllers used on official fields, for years in which LEDs are mandatory for a proper game experience (such as 2018), Warrior Arena integrates with [Advatek](https://www.advateklights.com) controllers and LEDs.

## Advanced networking
See the [Advanced Networking wiki page](https://github.com/Team254/cheesy-arena/wiki/Advanced-Networking-Concepts) for instructions on what equipment to obtain and how to configure it in order to support advanced network security.
See the [Advanced Networking wiki page](https://github.com/Team3256/warrior-arena/wiki/Advanced-Networking-Concepts) for instructions on what equipment to obtain and how to configure it in order to support advanced network security.

## Contributing
Cheesy Arena is far from finished! You can help by:
Warrior Arena is far from finished! You can help by:

* Checking out the [TODO list](TODO.md), writing a missing feature, and sending a pull request
* Filing any bugs or feature requests using the [issue tracker](https://github.com/Team254/cheesy-arena/issues)
* Contributing documentation to the [wiki](https://github.com/Team254/cheesy-arena/wiki)
* Filing any bugs or feature requests using the [issue tracker](https://github.com/Team3256/warrior-arena/issues)
* Contributing documentation to the [wiki](https://github.com/Team3256/warrior-arena/wiki)
* Sending baked goods to [Pat](https://github.com/patfair)

## Acknowledgements
[Several folks](https://github.com/Team254/cheesy-arena/graphs/contributors) have contributed pull requests. Thanks!
[Several folks](https://github.com/Team3256/warrior-arena/graphs/contributors) have contributed pull requests. Thanks!

In addition, the following individuals have contributed to make Cheesy Arena a reality:
In addition, the following individuals have contributed to make Warrior Arena a reality:

* Tom Bottiglieri
* James Cerar
Expand Down
12 changes: 6 additions & 6 deletions field/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"reflect"
"time"

"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/network"
"github.com/Team254/cheesy-arena/partner"
"github.com/Team254/cheesy-arena/playoff"
"github.com/Team254/cheesy-arena/plc"
"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/network"
"github.com/Team3256/warrior-arena/partner"
"github.com/Team3256/warrior-arena/playoff"
"github.com/Team3256/warrior-arena/plc"
)

const (
Expand Down
9 changes: 5 additions & 4 deletions field/arena_notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
package field

import (
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/playoff"
"github.com/Team254/cheesy-arena/websocket"
"strconv"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/playoff"
"github.com/Team3256/warrior-arena/websocket"
)

type ArenaNotifiers struct {
Expand Down
15 changes: 8 additions & 7 deletions field/arena_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
package field

import (
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/partner"
"github.com/Team254/cheesy-arena/playoff"
"github.com/Team254/cheesy-arena/tournament"
"github.com/Team254/cheesy-arena/websocket"
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/partner"
"github.com/Team3256/warrior-arena/playoff"
"github.com/Team3256/warrior-arena/tournament"
"github.com/Team3256/warrior-arena/websocket"
"github.com/stretchr/testify/assert"
)

func TestAssignTeam(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion field/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ package field

import (
"fmt"
"github.com/Team254/cheesy-arena/websocket"
"net/url"
"reflect"
"sort"
"strconv"
"strings"
"sync"
"time"

"github.com/Team3256/warrior-arena/websocket"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions field/driver_station_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"strconv"
"time"

"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/network"
"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/network"
)

// FMS uses 1121 for sending UDP packets, and FMS Lite uses 1120. Using 1121
Expand Down
7 changes: 4 additions & 3 deletions field/driver_station_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
package field

import (
"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/network"
"github.com/stretchr/testify/assert"
"net"
"testing"
"time"

"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/network"
"github.com/stretchr/testify/assert"
)

func TestEncodeControlPacket(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion field/event_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ package field

import (
"fmt"
"github.com/Team254/cheesy-arena/model"
"math"
"time"

"github.com/Team3256/warrior-arena/model"
)

const maxExpectedCycleTimeSec = 900
Expand Down
7 changes: 4 additions & 3 deletions field/event_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
package field

import (
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/stretchr/testify/assert"
"testing"
"time"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/stretchr/testify/assert"
)

func TestCycleTime(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion field/fake_plc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package field

import (
"github.com/Team254/cheesy-arena/websocket"
"github.com/Team3256/warrior-arena/websocket"
)

type FakePlc struct {
Expand Down
2 changes: 1 addition & 1 deletion field/realtime_score.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package field

import "github.com/Team254/cheesy-arena/game"
import "github.com/Team3256/warrior-arena/game"

type RealtimeScore struct {
CurrentScore game.Score
Expand Down
3 changes: 2 additions & 1 deletion field/scoring_panel_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
package field

import (
"github.com/Team254/cheesy-arena/websocket"
"sync"

"github.com/Team3256/warrior-arena/websocket"
)

type ScoringPanelRegistry struct {
Expand Down
5 changes: 3 additions & 2 deletions field/scoring_panel_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
package field

import (
"github.com/Team254/cheesy-arena/websocket"
"github.com/stretchr/testify/assert"
"testing"

"github.com/Team3256/warrior-arena/websocket"
"github.com/stretchr/testify/assert"
)

func TestScoringPanelRegistry(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions field/team_match_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"path/filepath"
"time"

"github.com/Team254/cheesy-arena/model"
"github.com/Team254/cheesy-arena/network"
"github.com/Team3256/warrior-arena/model"
"github.com/Team3256/warrior-arena/network"
)

const logsDir = "static/logs"
Expand Down
5 changes: 3 additions & 2 deletions field/team_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ package field

import (
"fmt"
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"image/color"
"log"
"net"
"strconv"
"strings"
"time"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
)

// Represents a collection of team number and timer signs.
Expand Down
7 changes: 4 additions & 3 deletions field/team_sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
package field

import (
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/stretchr/testify/assert"
"image/color"
"testing"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/stretchr/testify/assert"
)

func TestTeamSign_GenerateInMatchRearText(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions field/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ package field

import (
"fmt"
"github.com/Team254/cheesy-arena/game"
"github.com/Team254/cheesy-arena/model"
"github.com/stretchr/testify/assert"
"math/rand"
"os"
"path/filepath"
"testing"

"github.com/Team3256/warrior-arena/game"
"github.com/Team3256/warrior-arena/model"
"github.com/stretchr/testify/assert"
)

func SetupTestArena(t *testing.T, uniqueName string) *Arena {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Team254/cheesy-arena
module github.com/Team3256/warrior-arena

go 1.22

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
package main

import (
"github.com/Team254/cheesy-arena/field"
"github.com/Team254/cheesy-arena/web"
"github.com/Team3256/warrior-arena/field"
"github.com/Team3256/warrior-arena/web"
"log"
)

Expand Down
5 changes: 3 additions & 2 deletions model/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ package model

import (
"fmt"
"github.com/Team254/cheesy-arena/game"
"go.etcd.io/bbolt"
"io"
"os"
"path/filepath"
"strings"
"time"

"github.com/Team3256/warrior-arena/game"
"go.etcd.io/bbolt"
)

const backupsDir = "db/backups"
Expand Down
Loading

0 comments on commit 348f347

Please sign in to comment.