Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 55 additions & 56 deletions internal/fusion_dance.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package internal

import (
"fmt"
"math"

"github.com/montanaflynn/stats"
)

Expand Down Expand Up @@ -46,7 +44,7 @@ func CompileMultiMatch(entries ...TeamData) MultiMatch { // TODO: FIX FOR NEW

finalData.DriverStation = entries[0].DriverStation

finalData.CycleData = compileCycles(entries)
// finalData.CycleData = compileCycles(entries)

// finalData.Pickups = compilePickupPositions(entries)

Expand Down Expand Up @@ -85,61 +83,62 @@ func compositeScouters(entries []TeamData) string {
}

// Compiles the cycle data from all matches into one CompositeCycleData
func compileCycles(entries []TeamData) CompositeCycleData {
var finalCycles CompositeCycleData
var allNumCycles []int
for _, entry := range entries {
allNumCycles = append(allNumCycles, GetNumCycles(entry.Cycles))
}

for _, cycleNum := range allNumCycles {
if cycleNum != allNumCycles[0] {
finalCycles.HadMismatches = true
}
}

cycleCompositeTime, hadMismatches := avgCycleTimes(entries)

finalCycles.AvgCycleTime = cycleCompositeTime

if hadMismatches {
finalCycles.HadMismatches = true
}

var massiveBlockOfCycles []Cycle
for _, entry := range entries {
massiveBlockOfCycles = append(massiveBlockOfCycles, entry.Cycles...)
}

finalCycles.AllCycles = massiveBlockOfCycles

return finalCycles
}

//
// func compileCycles(entries []TeamData) CompositeCycleData {
// var finalCycles CompositeCycleData
// var allNumCycles []int
// for _, entry := range entries {
// allNumCycles = append(allNumCycles, GetNumCycles(entry.Cycles))
// }
//
// for _, cycleNum := range allNumCycles {
// if cycleNum != allNumCycles[0] {
// finalCycles.HadMismatches = true
// }
// }
//
// cycleCompositeTime, hadMismatches := avgCycleTimes(entries)
//
// finalCycles.AvgCycleTime = cycleCompositeTime
//
// if hadMismatches {
// finalCycles.HadMismatches = true
// }
//
// var massiveBlockOfCycles []Cycle
// for _, entry := range entries {
// massiveBlockOfCycles = append(massiveBlockOfCycles, entry.Cycles...)
// }
//
// finalCycles.AllCycles = massiveBlockOfCycles
//
// return finalCycles
// }
//
// Averages out the cycle times from all entries, returning this average as well as if there were any times that were outside
// of the configured acceptable range
func avgCycleTimes(entries []TeamData) (float64, bool) {
var sum float64
var count int = 0

var allCycles [][]Cycle

for _, entry := range entries {
allCycles = append(allCycles, entry.Cycles)
entryAvg := GetAvgCycleTimeExclusive(entry.Cycles)
if entryAvg != 0 {
sum += entryAvg
count++
}
}

finalAvg := sum / float64(count)

if math.IsNaN(finalAvg) {
finalAvg = 0
}
return finalAvg, !CompareCycles(allCycles)
}
// func avgCycleTimes(entries []TeamData) (float64, bool) {
// var sum float64
// var count int = 0
//
// var allCycles [][]Cycle
//
// for _, entry := range entries {
// allCycles = append(allCycles, entry.Cycles)
// entryAvg := GetAvgCycleTimeExclusive(entry.Cycles)
// if entryAvg != 0 {
// sum += entryAvg
// count++
// }
// }
//
// finalAvg := sum / float64(count)
//
// if math.IsNaN(finalAvg) {
// finalAvg = 0
// }
// return finalAvg, !CompareCycles(allCycles)
// }

// Combines the pickup locations from all entries
// func compilePickupPositions(entries []TeamData) PickupLocations {
Expand Down
1 change: 0 additions & 1 deletion internal/json_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type TeamData struct {
Match MatchInfo `json:"match"`
Scouter string `json:"scouter"`
DriverStation DriverStationData `json:"driverStation"`
Cycles []Cycle `json:"cycles"` // The cycle data

Auto AutoData `json:"auto"`
Teleop TeleopData `json:"teleop"`
Expand Down
38 changes: 19 additions & 19 deletions internal/sheet_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ func WriteTeamDataToLine(teamData TeamData, row int) bool { // TODO: FIX FOR NEW
// This is ONE ROW. Each value is a cell in that row.
valuesToWrite := []interface{}{
GetDSString(teamData.DriverStation.IsBlue, uint(teamData.DriverStation.Number)),
teamData.Match.Number, // Match Number
teamData.TeamNumber, // Team Number
GetAvgCycleTime(teamData.Cycles), // Avg cycle time
GetNumCycles(teamData.Cycles), // Num Cycles
teamData.Match.Number, // Match Number
teamData.TeamNumber, // Team Number
// GetAvgCycleTime(teamData.Cycles), // Avg cycle time
// GetNumCycles(teamData.Cycles), // Num Cycles
GetCollection(teamData.Teleop.Collection),
TurnAutoFieldIntoAnAwesomeAndReadableString(teamData.Auto.Field),
teamData.Auto.CanAuto, // Had Auto
Expand Down Expand Up @@ -377,18 +377,18 @@ func WritePitDataToLine(pitData PitScoutingData, row int) bool {

// This is ONE ROW. Each value is a cell in that row.
valuesToWrite := []interface{}{
pitData.TeamNumber, //Team Number
pitData.Scouter, //Person/people who pit scouted
pitData.Weight, //The weight of the robot
pitData.AutoNum, //The number of autos they have
pitData.Dynamic, //Whether they have dynamic autos
pitData.Drivetrain, //The type of drivetrain
pitData.GearRatio, //The GearRatio on the top of my head
pitData.Coral, //The position(s) their robot is able to score
pitData.Algae, //The position(s) their robot is able to score
pitData.AlgaeGround, //Whether it can collect algae from the ground
pitData.AlgaeSource, //Whether it can collect algae from the source
pitData.Cycle, //Their cycle time
pitData.TeamNumber, //Team Number
pitData.Scouter, //Person/people who pit scouted
pitData.Weight, //The weight of the robot
pitData.AutoNum, //The number of autos they have
pitData.Dynamic, //Whether they have dynamic autos
pitData.Drivetrain, //The type of drivetrain
pitData.GearRatio, //The GearRatio on the top of my head
pitData.Coral, //The position(s) their robot is able to score
pitData.Algae, //The position(s) their robot is able to score
pitData.AlgaeGround, //Whether it can collect algae from the ground
pitData.AlgaeSource, //Whether it can collect algae from the source
// pitData.Cycle, //Their cycle time
pitData.Experience, //The driver's experience
pitData.Teleop, //The strategy for teleop??
pitData.Endgame, //The strategy for endgame
Expand Down Expand Up @@ -423,9 +423,9 @@ func WritePrescoutDataToLine(teamData TeamData, row int) bool { // TODO: FIX FOR
// This is ONE ROW. Each value is a cell in that row.
valuesToWrite := []interface{}{
GetDSString(teamData.DriverStation.IsBlue, uint(teamData.DriverStation.Number)),
teamData.TeamNumber, // Team Number
GetAvgCycleTime(teamData.Cycles), // Avg cycle time
GetNumCycles(teamData.Cycles), // Num Cycles
teamData.TeamNumber, // Team Number
// GetAvgCycleTime(teamData.Cycles), // Avg cycle time
// GetNumCycles(teamData.Cycles), // Num Cycles

teamData.Auto.CanAuto, // Had Auto
teamData.Auto.Scores, // Scores in auto
Expand Down
Loading