Skip to content

Commit

Permalink
Implemented analysis metrics
Browse files Browse the repository at this point in the history
Still need to update client team report info
  • Loading branch information
spencerng committed Apr 21, 2017
1 parent 7f5ba24 commit 5262510
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 51 deletions.
Binary file modified .gradle/2.13/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified .gradle/2.13/taskArtifacts/fileHashes.bin
Binary file not shown.
7 changes: 4 additions & 3 deletions Spreadsheet generator code generator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
fields = ['teamNum','teamName','avgAutoScore', 'sdAutoScore','avgTeleOpScore',
'sdTeleOpScore','avgMatchScore','sdMatchScore',
'reachBaselinePercentage','avgAutoKpa', 'sdAutoKpa','avgTeleOpKpa', 'sdTeleOpKpa',
'avgAutoGears','sdAutoGears','avgTeleOpGears', 'sdTeleOpGears',
'avgAutoGears','sdAutoGears','autoGearAttemptSuccessPercent','autoGearPegLoc','leftPegPercent',
'rightPegPercent','centerPegPercent','avgTeleOpGears', 'sdTeleOpGears','avgDroppedGears',
'avgHighGoals','sdHighGoals','avgLowGoals',
'sdLowGoals',
'avgHoppers','avgPointsPerCycle','sdPointsPerCycle','avgCycles',
'sdCycles',
'takeoffPercentage','takeoffAttemptPercentage','takeoffAttemptSuccessPercentage',
'pilotPlayPercentage', 'autoShootsKey',
'pilotPlayPercentage', 'hasPickup','hasIntake','isActive','doNotPick',
'frequentRobotCommentStr','frequentPilotCommentStr',
'allComments']

Expand All @@ -19,7 +20,7 @@
for field in fields:
fileContents+='report.'+field+'+COMMA+'

fileContents+='+\'\\n\';'
fileContents+='\'\\n\';'

print(header)
print('\n')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,27 @@ public void setTeamNameList(File list){

public void generateTeamReportSpreadsheet(File outputDirectory){
final String COMMA = ",";
String header = "teamNum,teamName,avgAutoScore,sdAutoScore,avgTeleOpScore,sdTeleOpScore,avgMatchScore,"
+ "sdMatchScore,reachBaselinePercentage,avgAutoKpa,sdAutoKpa,avgTeleOpKpa,sdTeleOpKpa,avgAutoGears,"
+ "sdAutoGears,autoGearPeg,avgTeleOpGears,sdTeleOpGears,avgHighGoals,sdHighGoals,avgLowGoals,sdLowGoals,avgHoppers,"
+ "avgPointsPerCycle,sdPointsPerCycle,avgCycles,sdCycles,takeoffPercentage,takeoffAttemptPercentage,"
+ "takeoffAttemptSuccessPercentage,pilotPlayPercentage,autoShootsKey,frequentRobotCommentStr,frequentPilotCommentStr,allComments,\n";
String header = "teamNum,teamName,avgAutoScore,sdAutoScore,avgTeleOpScore,sdTeleOpScore,avgMatchScore,sdMatchScore,"
+ "reachBaselinePercentage,avgAutoKpa,sdAutoKpa,avgTeleOpKpa,sdTeleOpKpa,avgAutoGears,sdAutoGears,"
+ "autoGearAttemptSuccessPercent,autoGearPegLoc,leftPegPercent,rightPegPercent,centerPegPercent,avgTeleOpGears,"
+ "sdTeleOpGears,avgDroppedGears,avgHighGoals,sdHighGoals,avgLowGoals,sdLowGoals,avgHoppers,avgPointsPerCycle,"
+ "sdPointsPerCycle,avgCycles,sdCycles,takeoffPercentage,takeoffAttemptPercentage,takeoffAttemptSuccessPercentage,"
+ "pilotPlayPercentage,hasPickup,hasIntake,isActive,doNotPick,frequentRobotCommentStr,frequentPilotCommentStr,allComments,\n";

String fileContents = header;
for(int key : teamReports.keySet()){
TeamReport report = teamReports.get(key);
fileContents += report.teamNum+COMMA+report.teamName+COMMA+report.avgAutoScore+COMMA+report.sdAutoScore+COMMA+
report.avgTeleOpScore+COMMA+report.sdTeleOpScore+COMMA+report.avgMatchScore+COMMA+report.sdMatchScore+
COMMA+report.reachBaselinePercentage+COMMA+report.avgAutoKpa+COMMA+report.sdAutoKpa+COMMA+report.avgTeleOpKpa
+COMMA+report.sdTeleOpKpa+COMMA+report.avgAutoGears+COMMA+report.sdAutoGears+COMMA+report.autoGearPeg+COMMA+report.avgTeleOpGears+COMMA+
report.sdTeleOpGears+COMMA+report.avgHighGoals+COMMA+report.sdHighGoals+COMMA+report.avgLowGoals+COMMA+
report.sdLowGoals+COMMA+report.avgHoppers+COMMA+report.avgPointsPerCycle+COMMA+report.sdPointsPerCycle+COMMA+
report.avgCycles+COMMA+report.sdCycles+COMMA+report.takeoffPercentage+COMMA+report.takeoffAttemptPercentage+
COMMA+report.takeoffAttemptSuccessPercentage+COMMA+report.pilotPlayPercentage+COMMA+report.autoShootsKey+COMMA
+report.frequentRobotCommentStr+COMMA+report.frequentPilotCommentStr+COMMA+report.allComments+COMMA+'\n';
report.avgTeleOpScore+COMMA+report.sdTeleOpScore+COMMA+report.avgMatchScore+COMMA+report.sdMatchScore+COMMA+
report.reachBaselinePercentage+COMMA+report.avgAutoKpa+COMMA+report.sdAutoKpa+COMMA+report.avgTeleOpKpa
+COMMA+report.sdTeleOpKpa+COMMA+report.avgAutoGears+COMMA+report.sdAutoGears+COMMA+report.autoGearAttemptSuccessPercent
+COMMA+report.autoGearPegLoc+COMMA+report.leftPegPercent+COMMA+report.rightPegPercent+COMMA+report.centerPegPercent+
COMMA+report.avgTeleOpGears+COMMA+report.sdTeleOpGears+COMMA+report.avgDroppedGears+COMMA+report.avgHighGoals+COMMA+
report.sdHighGoals+COMMA+report.avgLowGoals+COMMA+report.sdLowGoals+COMMA+report.avgHoppers+COMMA+report.avgPointsPerCycle+
COMMA+report.sdPointsPerCycle+COMMA+report.avgCycles+COMMA+report.sdCycles+COMMA+report.takeoffPercentage+COMMA+
report.takeoffAttemptPercentage+COMMA+report.takeoffAttemptSuccessPercentage+COMMA+report.pilotPlayPercentage+
COMMA+report.hasPickup+COMMA+report.hasIntake+COMMA+report.isActive+COMMA+report.doNotPick+COMMA+
report.frequentRobotCommentStr+COMMA+report.frequentPilotCommentStr+COMMA+report.allComments+COMMA+'\n';

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public static double average(ArrayList<Double> dataset){
return sum(dataset)/dataset.size();
}



/** Calculates the success rate of an event in all matches
*
* @param success Array with number of successes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ public class TeamReport {

double avgPointsPerCycle, avgCycles, sdCycles , reachBaselinePercentage,
avgHighGoals, avgLowGoals,sdHighGoals, sdLowGoals, sdPointsPerCycle;
boolean hasPickup, hasIntake, isActive;

double avgAutoScore, avgTeleOpScore, avgMatchScore, avgAutoKpa, avgTeleOpKpa, avgAutoGears,
avgTeleOpGears, avgTotalFuel, avgHoppers, avgDroppedGears;
avgTeleOpGears, avgTotalFuel, avgHoppers;


double sdAutoScore, sdTeleOpScore, sdMatchScore, sdAutoKpa, sdTeleOpKpa,
sdAutoGears, sdTeleOpGears, sdTotalFuel;

String autoGearPeg = "";

double autoGearPercent, autoGearAttemptSuccessPercent, leftPegPercent, centerPegPercent, rightPegPercent;
String autoGearPegLoc = "";

double avgTeleOpKpaFuelFocus, avgTeleOpGearsGearFocus, fuelFocusPercent, gearFocusPercent;

double takeoffAttemptPercentage, takeoffAttemptSuccessPercentage, takeoffPercentage;// attempt is out of all matches; success is for each attempt
double pilotPlayPercentage;

ArrayList<String> frequentRobotComment, frequentPilotComment;

double autoGearAttemptSuccessPercent, leftPegPercent, centerPegPercent, rightPegPercent, avgDroppedGears;
boolean hasPickup, hasIntake, isActive, doNotPick;

double avgTeleOpKpaFuelFocus, avgTeleOpGearsGearFocus, fuelFocusPercent, gearFocusPercent;

//TODO calculate these values and update EventReport
transient double autoAbility, teleOpAbility, driveTeamAbility, robotQualities;
Expand All @@ -52,8 +54,12 @@ public class TeamReport {
totalReachBaseline, totalAutoShootsKey;
ArrayList<Integer> totalHoppers= new ArrayList<>(), totalFuel= new ArrayList<>(), teleOpGears= new ArrayList<>(),
autoScores= new ArrayList<>(), teleOpScores= new ArrayList<>(), matchScores= new ArrayList<>(),
totalCycles= new ArrayList<>(), totalHighGoals= new ArrayList<>(), totalLowGoals= new ArrayList<>(), autoGears= new ArrayList<>();
ArrayList<Double> totalPointsPerCycle = new ArrayList<>(), autoKpas= new ArrayList<>(), teleOpKpa= new ArrayList<>();
totalCycles= new ArrayList<>(), totalHighGoals= new ArrayList<>(), totalLowGoals= new ArrayList<>(), autoGears= new ArrayList<>(),
totalDroppedGears= new ArrayList<>(), totalTeleOpGearsGearFocus = new ArrayList<>();
ArrayList<Double> totalPointsPerCycle = new ArrayList<>(), autoKpas= new ArrayList<>(), teleOpKpa= new ArrayList<>(),totalTeleOpKpaFuelFocus = new ArrayList<>();

int totalAutoGearAttempt, totalAutoGearSuccess, totalLeftPegAttempt, totalLeftPegSuccess, totalCenterPegAttempt, totalCenterPegSuccess,
totalRightPegAttempt, totalRightPegSuccess;

public TeamReport(int teamNum){
this.teamNum = teamNum;
Expand Down Expand Up @@ -81,38 +87,69 @@ void calculateTotals(){

totalTakeoffAttempts = totalTakeoffSuccesses = 0;
totalPilotPlaying = totalReachBaseline = totalAutoShootsKey = 0;
totalAutoGearSuccess = totalAutoGearAttempt = 0;
totalLeftPegAttempt = totalLeftPegSuccess = totalCenterPegAttempt = totalCenterPegSuccess = 0;
totalRightPegSuccess = totalRightPegAttempt = 0;



for(int i = 0; i < entries.size(); i++){
if(entries.get(i).getTeleOp().isAttemptTakeoff())
for(ScoutEntry entry : entries){
if(entry.getTeleOp().isAttemptTakeoff())
totalTakeoffAttempts++;
if(entries.get(i).getTeleOp().isReadyTakeoff())
if(entry.getTeleOp().isReadyTakeoff())
totalTakeoffSuccesses++;

if(entries.get(i).getPreMatch().isPilotPlaying())
if(entry.getPreMatch().isPilotPlaying())
totalPilotPlaying++;
if(entries.get(i).auto.isBaselineCrossed())
if(entry.auto.isBaselineCrossed())
totalReachBaseline++;
/*if(entries.get(i).getAuto().isShootsFromKey())
/*if(entry.getAuto().isShootsFromKey())
totalAutoShootsKey++;*/

totalHoppers.add((entries.get(i).auto.isUseHoppers() ? 1 : 0)
+ entries.get(i).teleOp.getHopppersUsed());
totalFuel.add(entries.get(i).auto.getHighGoals()+entries.get(i).auto.getLowGoals()
+entries.get(i).teleOp.getHighGoals()+entries.get(i).teleOp.getLowGoals());
autoGears.add(entries.get(i).getAuto().isSuccessGear()? 1 : 0);
teleOpGears.add(entries.get(i).getTeleOp().getGearsDelivered());
teleOpKpa.add(entries.get(i).teleOpKpa);
autoKpas.add(entries.get(i).autoKpa);
autoScores.add(entries.get(i).autoScore);
teleOpScores.add( entries.get(i).teleScore);
matchScores.add(entries.get(i).totalScore);
totalPointsPerCycle.add(entries.get(i).pointsPerCycle);
totalCycles.add(entries.get(i).teleOp.getNumCycles());
if(entry.auto.isAttemptGear()){
totalAutoGearAttempt++;
if(entry.auto.getGearPeg().equals("Left"))
totalLeftPegAttempt++;
if(entry.auto.getGearPeg().equals("Center"))
totalCenterPegAttempt++;
if(entry.auto.getGearPeg().equals("Right"))
totalRightPegAttempt++;

}

if(entry.auto.isSuccessGear()){
totalAutoGearSuccess++;
if(entry.auto.getGearPeg().equals("Left"))
totalLeftPegSuccess++;
if(entry.auto.getGearPeg().equals("Center"))
totalCenterPegSuccess++;
if(entry.auto.getGearPeg().equals("Right"))
totalRightPegSuccess++;

}


totalHoppers.add((entry.auto.isUseHoppers() ? 1 : 0)
+ entry.teleOp.getHopppersUsed());
totalFuel.add(entry.auto.getHighGoals()+entry.auto.getLowGoals()
+entry.teleOp.getHighGoals()+entry.teleOp.getLowGoals());
autoGears.add(entry.getAuto().isSuccessGear()? 1 : 0);
teleOpGears.add(entry.getTeleOp().getGearsDelivered());
teleOpKpa.add(entry.teleOpKpa);
autoKpas.add(entry.autoKpa);
autoScores.add(entry.autoScore);
teleOpScores.add( entry.teleScore);
matchScores.add(entry.totalScore);
totalPointsPerCycle.add(entry.pointsPerCycle);
totalCycles.add(entry.teleOp.getNumCycles());
totalDroppedGears.add(entry.teleOp.getGearsDropped());

totalHighGoals.add( entries.get(i).getAuto().getHighGoals()+entries.get(i).getTeleOp().getHighGoals());
totalLowGoals.add(entries.get(i).getAuto().getLowGoals()+entries.get(i).getTeleOp().getLowGoals());
totalHighGoals.add( entry.getAuto().getHighGoals()+entry.getTeleOp().getHighGoals());
totalLowGoals.add(entry.getAuto().getLowGoals()+entry.getTeleOp().getLowGoals());

if(entry.postMatch.getFocus().equals("Gears"))
totalTeleOpGearsGearFocus.add(entry.teleOp.getGearsDelivered());
if(entry.postMatch.getFocus().equals("Fuel"))
totalTeleOpKpaFuelFocus.add(entry.teleOpKpa);
}


Expand Down Expand Up @@ -142,6 +179,8 @@ public void calculateStats(){
avgTeleOpGears = Statistics.average(Statistics.toDoubleArrayList(teleOpGears));
sdTeleOpGears = Statistics.popStandardDeviation(Statistics.toDoubleArrayList(teleOpGears));

avgDroppedGears = Statistics.average(Statistics.toDoubleArrayList(totalDroppedGears));


avgAutoKpa = Statistics.average(autoKpas);
sdAutoKpa = Statistics.popStandardDeviation(autoKpas);
Expand All @@ -153,6 +192,11 @@ public void calculateStats(){
sdAutoGears = Statistics.popStandardDeviation(Statistics.toDoubleArrayList(autoGears));


autoGearAttemptSuccessPercent = totalAutoGearAttempt!=0 ? (double) totalAutoGearSuccess/totalAutoGearAttempt*100 : 0;
leftPegPercent = totalLeftPegAttempt!= 0 ? (double) totalLeftPegSuccess / totalLeftPegAttempt * 100 : 0;
rightPegPercent = totalRightPegAttempt!= 0 ? (double) totalRightPegSuccess / totalRightPegAttempt * 100 : 0;
centerPegPercent = totalCenterPegAttempt!=0 ? (double) totalCenterPegSuccess / totalCenterPegAttempt * 100 : 0;

avgAutoScore = Statistics.average(Statistics.toDoubleArrayList(autoScores));
sdAutoScore = Statistics.popStandardDeviation(Statistics.toDoubleArrayList(autoScores));

Expand Down Expand Up @@ -180,9 +224,15 @@ public void calculateStats(){
avgLowGoals = Statistics.average(Statistics.toDoubleArrayList(totalLowGoals));
sdLowGoals = Statistics.popStandardDeviation(Statistics.toDoubleArrayList(totalLowGoals));

if(totalAutoShootsKey/((double)entries.size())>=0.50)
avgTeleOpKpaFuelFocus = Statistics.average(totalTeleOpKpaFuelFocus);
avgTeleOpGearsGearFocus = Statistics.average(Statistics.toDoubleArrayList(totalTeleOpGearsGearFocus));

fuelFocusPercent = (double) totalTeleOpKpaFuelFocus.size() / entries.size() * 100;
gearFocusPercent = (double) totalTeleOpGearsGearFocus.size() / entries.size() * 100;

/*if(totalAutoShootsKey/((double)entries.size())>=0.50)
autoShootsKey = true;
else autoShootsKey = false;
else autoShootsKey = false;*/

HashMap<String, Integer> commentFrequencies = new HashMap<>();

Expand All @@ -200,6 +250,17 @@ public void calculateStats(){
if(commentFrequencies.get(key)>=entries.size()/4.0)
frequentRobotComment.add(key);


doNotPick = frequentRobotComment.contains("Do not pick (explain)");
isActive = frequentRobotComment.contains("Active gear mech.");
hasIntake = frequentRobotComment.contains("Fuel intake");
hasPickup = frequentRobotComment.contains("Gear pickup");

frequentRobotComment.remove("Do not pick (explain)");
frequentRobotComment.remove("Active gear mech.");
frequentRobotComment.remove("Fuel intake");
frequentRobotComment.remove("Gear pickup");

commentFrequencies = new HashMap<>();

for(String key : entries.get(0).getPostMatch().getPilotQuickCommentSelections().keySet()){
Expand Down Expand Up @@ -229,8 +290,8 @@ public void calculateStats(){
allComments+=entry.getPostMatch().getRobotComment() + "; ";
if(!entry.getPostMatch().getPilotComment().equals(""))
allComments+=entry.getPostMatch().getPilotComment()+"; ";
if(!autoGearPeg.contains(entry.getAuto().getGearPeg()))
autoGearPeg+=entry.getAuto().getGearPeg()+"; ";
if(!autoGearPegLoc.contains(entry.getAuto().getGearPeg()))
autoGearPegLoc+=entry.getAuto().getGearPeg()+"; ";
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static JFrame addIcon(JFrame frame){

public static void initialize(){

JLabel introText = new JLabel("<html><h1>Team 25 Scouting Client - v1.3</h1><br>Press start to select data folder</html>");
JLabel introText = new JLabel("<html><h1>Team 25 Scouting Client - v1.4</h1><br>Press start to select data folder</html>");
introText.setHorizontalAlignment(JLabel.CENTER);
introText.setFont(new Font("Arial", Font.PLAIN, 16));

Expand Down

0 comments on commit 5262510

Please # to comment.