diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eae23e..2fb38f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +Version 3.2 (to be relesaed) +--------------------- +- added Throw In Challenge for RoboCup 2024 + Version 3.1 (RoboCup 2023) --------------------- - Rolling Ball Challenge: add rule to prevent player from moving too far diff --git a/pom.xml b/pom.xml index 49cab9f..6a90f67 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ magmaoffenburg magmachallenge jar - 3.1 + 3.2-beta1 magmaChallenge https://github.com/magmaOffenburg/magmaChallenge @@ -35,11 +35,6 @@ commons-math3 3.6.1 - - org.apache.commons - commons-lang3 - 3.13.0 - diff --git a/src/main/java/magma/tools/benchmark/ChallengeType.java b/src/main/java/magma/tools/benchmark/ChallengeType.java index 116786d..ee97259 100644 --- a/src/main/java/magma/tools/benchmark/ChallengeType.java +++ b/src/main/java/magma/tools/benchmark/ChallengeType.java @@ -18,7 +18,8 @@ import magma.tools.benchmark.view.bench.runchallenge.RunBenchmarkTableView; import magma.tools.benchmark.view.bench.throwinchallenge.ThrowInBenchmarkTableView; -public enum ChallengeType { +public enum ChallengeType +{ RUN("Run", server -> new RunBenchmark(server, false), RunBenchmarkTableView::getInstance), KICK("Kick", KickBenchmark::new, KickBenchmarkTableView::getInstance), @@ -32,9 +33,9 @@ public enum ChallengeType { GOALIE("Goalie", GoalieBenchmark::new, GoalieBenchmarkTableView::getInstance), ROLLING_BALL("Rolling Ball", RollingBallBenchmark::new, RollingBallBenchmarkTableView::getInstance), - + THROW_IN("Throw In", ThrowInBenchmark::new, ThrowInBenchmarkTableView::getInstance); - + public static final ChallengeType DEFAULT = THROW_IN; public final String name; diff --git a/src/main/java/magma/tools/benchmark/UserInterface.java b/src/main/java/magma/tools/benchmark/UserInterface.java index fa58123..2091534 100644 --- a/src/main/java/magma/tools/benchmark/UserInterface.java +++ b/src/main/java/magma/tools/benchmark/UserInterface.java @@ -1,3 +1,7 @@ package magma.tools.benchmark; -public enum UserInterface { GUI, CLI } +public enum UserInterface +{ + GUI, + CLI +} diff --git a/src/main/java/magma/tools/benchmark/controller/BenchmarkController.java b/src/main/java/magma/tools/benchmark/controller/BenchmarkController.java index 3a819c7..95200f2 100644 --- a/src/main/java/magma/tools/benchmark/controller/BenchmarkController.java +++ b/src/main/java/magma/tools/benchmark/controller/BenchmarkController.java @@ -69,8 +69,9 @@ public static void run(String[] args, UserInterface userInterface) StringArgument defaultPathArgument = new StringArgument("defaultPath", "examples", "the initial path to use for file dialogs"); - IntegerArgument defaultRandomSeed = new IntegerArgument("randomSeed", (int) BenchmarkConfiguration.DEFAULT_RANDOM_SEED, 0, "the random seed to use"); - + IntegerArgument defaultRandomSeed = new IntegerArgument( + "randomSeed", (int) BenchmarkConfiguration.DEFAULT_RANDOM_SEED, 0, "the random seed to use"); + new HelpArgument(challengeArgument, startScriptFolderArgument, roboVizServerArgument, defaultPathArgument) .parse(args); diff --git a/src/main/java/magma/tools/benchmark/model/IModelReadOnly.java b/src/main/java/magma/tools/benchmark/model/IModelReadOnly.java old mode 100755 new mode 100644 index 52e33b6..c232179 --- a/src/main/java/magma/tools/benchmark/model/IModelReadOnly.java +++ b/src/main/java/magma/tools/benchmark/model/IModelReadOnly.java @@ -29,7 +29,8 @@ * * @author kdorer */ -public interface IModelReadOnly { +public interface IModelReadOnly +{ /** * @return the results per team */ diff --git a/src/main/java/magma/tools/benchmark/model/IModelReadWrite.java b/src/main/java/magma/tools/benchmark/model/IModelReadWrite.java old mode 100755 new mode 100644 index d3d0db1..3e066ca --- a/src/main/java/magma/tools/benchmark/model/IModelReadWrite.java +++ b/src/main/java/magma/tools/benchmark/model/IModelReadWrite.java @@ -27,7 +27,8 @@ * * @author kdorer */ -public interface IModelReadWrite extends IModelReadOnly { +public interface IModelReadWrite extends IModelReadOnly +{ void resetModel(); void start(BenchmarkConfiguration config, List teamConfig); diff --git a/src/main/java/magma/tools/benchmark/model/ISingleResult.java b/src/main/java/magma/tools/benchmark/model/ISingleResult.java old mode 100755 new mode 100644 index 7bc4b86..8527faa --- a/src/main/java/magma/tools/benchmark/model/ISingleResult.java +++ b/src/main/java/magma/tools/benchmark/model/ISingleResult.java @@ -1,6 +1,7 @@ package magma.tools.benchmark.model; -public interface ISingleResult { +public interface ISingleResult +{ boolean isFallen(); /** @@ -11,7 +12,6 @@ public interface ISingleResult { boolean isValid(); String getStatusText(); - - double getScore(); + double getScore(); } \ No newline at end of file diff --git a/src/main/java/magma/tools/benchmark/model/ITeamResult.java b/src/main/java/magma/tools/benchmark/model/ITeamResult.java old mode 100755 new mode 100644 index e29de2e..34efffe --- a/src/main/java/magma/tools/benchmark/model/ITeamResult.java +++ b/src/main/java/magma/tools/benchmark/model/ITeamResult.java @@ -1,6 +1,6 @@ package magma.tools.benchmark.model; -public interface ITeamResult extends ISingleResult +public interface ITeamResult extends ISingleResult { void addResult(ISingleResult result); diff --git a/src/main/java/magma/tools/benchmark/model/bench/BenchmarkMain.java b/src/main/java/magma/tools/benchmark/model/bench/BenchmarkMain.java old mode 100755 new mode 100644 index 85eb69f..c2dfeaa --- a/src/main/java/magma/tools/benchmark/model/bench/BenchmarkMain.java +++ b/src/main/java/magma/tools/benchmark/model/bench/BenchmarkMain.java @@ -401,8 +401,8 @@ protected boolean performAverageOutRuns(TeamConfiguration currentTeamConfig, Run if (runsInIDE()) { serverStartScript = "scripts/startServer.sh"; } - Runtime.getRuntime().exec(serverStartScript + " " + config.getServerPort() + - " " + config.getTrainerPort() + " " + scriptPath); + Runtime.getRuntime().exec(serverStartScript + " " + config.getServerPort() + " " + + config.getTrainerPort() + " " + scriptPath); } try { @@ -410,7 +410,7 @@ protected boolean performAverageOutRuns(TeamConfiguration currentTeamConfig, Run } catch (InterruptedException e) { e.printStackTrace(); } - + boolean success = startTrainer(config, currentTeamConfig, runInfo, roboVizServer); if (success) { collectResults(currentRunResult); @@ -427,7 +427,8 @@ protected boolean performAverageOutRuns(TeamConfiguration currentTeamConfig, Run } } String marker = "---------------------------"; - System.out.println(marker + "\nAverage " + avgRuns + " Score: " + currentRunResult.getScore() + "\n" + marker); + System.out.println( + marker + "\nAverage " + avgRuns + " Score: " + currentRunResult.getScore() + "\n" + marker); return stopped; } @@ -442,7 +443,8 @@ public void stopTeam() } } - private boolean runsInIDE() { + private boolean runsInIDE() + { String absPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); String libPath = absPath.substring(0, absPath.lastIndexOf(File.separator)); return libPath.substring(libPath.lastIndexOf(File.separator)).equals(File.separator + "classes"); diff --git a/src/main/java/magma/tools/benchmark/model/bench/RunInformation.java b/src/main/java/magma/tools/benchmark/model/bench/RunInformation.java old mode 100755 new mode 100644 index b4f4ddb..1bceb50 --- a/src/main/java/magma/tools/benchmark/model/bench/RunInformation.java +++ b/src/main/java/magma/tools/benchmark/model/bench/RunInformation.java @@ -48,7 +48,8 @@ public RunInformation(int runID, double ballX, double ballY, double ballVelX, do this(runID, 0, 0, ballX, ballY, ballVelX, ballVelY, ballVelZ); } - public RunInformation(int runID, double beamX, double beamY, double ballX, double ballY, double ballVelX, double ballVelY, double ballVelZ) + public RunInformation(int runID, double beamX, double beamY, double ballX, double ballY, double ballVelX, + double ballVelY, double ballVelZ) { super(); this.runID = runID; diff --git a/src/main/java/magma/tools/benchmark/model/bench/SinglePlayerLauncher.java b/src/main/java/magma/tools/benchmark/model/bench/SinglePlayerLauncher.java index f2f451c..fc52331 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/SinglePlayerLauncher.java +++ b/src/main/java/magma/tools/benchmark/model/bench/SinglePlayerLauncher.java @@ -23,10 +23,10 @@ import hso.autonomy.util.file.StreamBufferer; import hso.autonomy.util.misc.CommandUtil; - import java.io.File; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; +import java.util.Arrays; +import java.util.stream.Collectors; +import java.util.stream.Stream; public class SinglePlayerLauncher { @@ -112,8 +112,9 @@ private void runScript(String scriptName, Object[] arguments) return; } - Object[] commands = ArrayUtils.addAll(new Object[] {"bash", fullPath.getPath()}, arguments); - String command = StringUtils.join(commands, " "); + String command = + Stream.concat(Stream.of("bash", fullPath.getPath()), Arrays.stream(arguments).map(Object::toString)) + .collect(Collectors.joining(" ")); System.out.println(command); Process ps = CommandUtil.launch(command, null, workingDir); diff --git a/src/main/java/magma/tools/benchmark/model/bench/SingleResult.java b/src/main/java/magma/tools/benchmark/model/bench/SingleResult.java old mode 100755 new mode 100644 index 7b439e1..ee1f093 --- a/src/main/java/magma/tools/benchmark/model/bench/SingleResult.java +++ b/src/main/java/magma/tools/benchmark/model/bench/SingleResult.java @@ -30,7 +30,7 @@ public class SingleResult implements ISingleResult { private final double score; - + private final boolean fallen; private final boolean penalty; diff --git a/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkReferee.java b/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkReferee.java index fc297ac..11331e2 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkReferee.java +++ b/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkReferee.java @@ -32,7 +32,12 @@ public class PassingBenchmarkReferee extends BenchmarkRefereeBase private AgentState agentStates[] = new AgentState[PassingBenchmark.PLAYERS]; - private enum AgentState { NEUTRAL, TOUCHED, PASSED } + private enum AgentState + { + NEUTRAL, + TOUCHED, + PASSED + } private boolean goal; diff --git a/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkTeamResult.java b/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkTeamResult.java index 48e27ba..46cb965 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkTeamResult.java +++ b/src/main/java/magma/tools/benchmark/model/bench/passingchallenge/PassingBenchmarkTeamResult.java @@ -22,7 +22,7 @@ public double getScore() for (ISingleResult result : results) { scores.add(result.getScore()); } - + Collections.sort(scores); int end = PassingBenchmark.AVG_OUT_OF_BEST; diff --git a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmark.java b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmark.java index fa9f946..83d5ba4 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmark.java +++ b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmark.java @@ -21,10 +21,9 @@ package magma.tools.benchmark.model.bench.rollingballchallenge; -import java.util.Random; - import hso.autonomy.util.geometry.Angle; import hso.autonomy.util.geometry.Pose2D; +import java.util.Random; import magma.monitor.general.impl.MonitorComponentFactory; import magma.monitor.referee.IReferee.RefereeState; import magma.tools.benchmark.model.BenchmarkConfiguration; @@ -105,16 +104,17 @@ protected RunInformation createRunInformation(Random rand, int runID) double beamX = -12; double beamY = 0; Pose2D beamPose = new Pose2D(beamX, beamY); - + Vector2D direction = angle.applyTo(new Vector2D(1, 0)); - Vector2D destinationBallPosition = beamPose.getPosition().add(new Vector2D(0.15 + noise(rand, 0.05), 0 + noise(rand, 0.05))); + Vector2D destinationBallPosition = + beamPose.getPosition().add(new Vector2D(0.15 + noise(rand, 0.05), 0 + noise(rand, 0.05))); Vector2D ballStart = destinationBallPosition.add(direction.scalarMultiply(radius)); double ballX = ballStart.getX(); double ballY = ballStart.getY(); - + double speedX = -direction.getX() * speedFactor; double speedY = -direction.getY() * speedFactor; - + return new RunInformation(runID, beamX, beamY, ballX, ballY, speedX, speedY, 0); } diff --git a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkMonitorComponentFactory.java b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkMonitorComponentFactory.java index 6be2534..422d3ca 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkMonitorComponentFactory.java +++ b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkMonitorComponentFactory.java @@ -35,8 +35,9 @@ public RollingBallBenchmarkMonitorComponentFactory( public IReferee createReferee(IMonitorWorldModel worldModel, IServerCommander serverCommander) { BenchmarkFactoryParameters params = (BenchmarkFactoryParameters) this.params; - SinglePlayerLauncher launcher = new SinglePlayerLauncher(params.getServerIP(), params.getAgentPort(), - params.getTeamPath(), params.getStartScriptName(), ChallengeType.ROLLING_BALL.startScriptArgument, false); + SinglePlayerLauncher launcher = + new SinglePlayerLauncher(params.getServerIP(), params.getAgentPort(), params.getTeamPath(), + params.getStartScriptName(), ChallengeType.ROLLING_BALL.startScriptArgument, false); return new RollingBallBenchmarkReferee(worldModel, serverCommander, params.getServerPid(), launcher, params.getDropHeight(), runInfo, roboVizServer); } diff --git a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkReferee.java b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkReferee.java index 1f5889b..a76e729 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkReferee.java +++ b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkReferee.java @@ -1,5 +1,7 @@ package magma.tools.benchmark.model.bench.rollingballchallenge; +import hso.autonomy.util.geometry.Angle; +import java.awt.Color; import magma.common.spark.PlayMode; import magma.monitor.command.IServerCommander; import magma.monitor.worldmodel.IMonitorWorldModel; @@ -8,14 +10,9 @@ import magma.tools.benchmark.model.bench.SinglePlayerLauncher; import magma.util.roboviz.RoboVizDraw; import magma.util.roboviz.RoboVizParameters; - -import java.awt.Color; - import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; -import hso.autonomy.util.geometry.Angle; - public class RollingBallBenchmarkReferee extends BenchmarkRefereeBase { /** @@ -44,8 +41,9 @@ public class RollingBallBenchmarkReferee extends BenchmarkRefereeBase private int ballNotMoving; - public RollingBallBenchmarkReferee(IMonitorWorldModel mWorldModel, IServerCommander serverCommander, String serverPid, - SinglePlayerLauncher launcher, float dropHeight, RunInformation runInfo, String roboVizServer) + public RollingBallBenchmarkReferee(IMonitorWorldModel mWorldModel, IServerCommander serverCommander, + String serverPid, SinglePlayerLauncher launcher, float dropHeight, RunInformation runInfo, + String roboVizServer) { // ignoring passed runtime since the check should anyhow not fire super(mWorldModel, serverCommander, serverPid, launcher, 20, runInfo, false); @@ -77,7 +75,7 @@ protected boolean onStartBenchmark() serverCommander.beamBall((float) runInfo.getBallX(), (float) runInfo.getBallY()); roboVizDraw.drawMeterMarkers(false, Color.BLACK, (int) runInfo.getBeamX(), Angle.ZERO, 20); - + return true; } @@ -95,7 +93,7 @@ protected boolean onDuringBenchmark() if (hasFallen()) { hasFallen = true; } - + if (currentTime > runTime) { // finished this run runTime = currentTime; @@ -117,7 +115,7 @@ protected boolean onDuringBenchmark() oldBallPos = ballNow; return false; } - + if (!ballRolling) { serverCommander.beamBall((float) runInfo.getBallX(), (float) runInfo.getBallY(), 0.0f, (float) runInfo.getBallVelX(), (float) runInfo.getBallVelY(), (float) runInfo.getBallVelZ()); @@ -136,12 +134,12 @@ protected boolean onDuringBenchmark() ballNotMoving = 0; } } - + // stop if player is moving too much if (posPlayer.getX() > playerInitial.getX() + 1.5) { return true; } - + // stop if playmode changes (e.g. because someone scored an own goal) if (worldModel.getPlayMode() != PlayMode.PLAY_ON) { return true; @@ -157,7 +155,7 @@ protected void onStopBenchmark() { // evaluation function Vector2D start = new Vector2D(runInfo.getBeamX(), runInfo.getBeamY()); - + distance = 0; if (oldBallPos.getX() > start.getX()) { // only count forward movement of ball diff --git a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkSingleResult.java b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkSingleResult.java index cb3955f..f574699 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkSingleResult.java +++ b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkSingleResult.java @@ -32,8 +32,8 @@ public class RollingBallBenchmarkSingleResult extends SingleResult private final double distance; private final double deltaY; - public RollingBallBenchmarkSingleResult(boolean valid, boolean fallen, boolean penalty, String statusText, - double distance, double deltaY) + public RollingBallBenchmarkSingleResult( + boolean valid, boolean fallen, boolean penalty, String statusText, double distance, double deltaY) { super(calculateScore(distance, deltaY, fallen), valid, fallen, penalty, statusText); this.distance = distance; @@ -42,7 +42,7 @@ public RollingBallBenchmarkSingleResult(boolean valid, boolean fallen, boolean p private static double calculateScore(double distance, double deltaY, boolean fallen) { - return distance - deltaY - 3 * ((fallen) ?1 :0); + return distance - deltaY - 3 * ((fallen) ? 1 : 0); } public double getDistance() diff --git a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkTeamResult.java b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkTeamResult.java index 8720d4e..6a7a718 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkTeamResult.java +++ b/src/main/java/magma/tools/benchmark/model/bench/rollingballchallenge/RollingBallBenchmarkTeamResult.java @@ -23,7 +23,6 @@ import java.util.function.ToDoubleFunction; import java.util.stream.Collectors; - import magma.tools.benchmark.model.ISingleResult; import magma.tools.benchmark.model.bench.TeamResult; @@ -40,16 +39,18 @@ public RollingBallBenchmarkTeamResult(String name) public double getAverage(ToDoubleFunction method) { - return results.stream().map(obj -> (RollingBallBenchmarkSingleResult) obj) - .collect(Collectors.summarizingDouble(method)).getAverage(); + return results.stream() + .map(obj -> (RollingBallBenchmarkSingleResult) obj) + .collect(Collectors.summarizingDouble(method)) + .getAverage(); } - + @Override public ISingleResult createSingleResult() { double distance = getAverage(RollingBallBenchmarkSingleResult::getDistance); double deltaY = getAverage(RollingBallBenchmarkSingleResult::getDeltaY); - + return new RollingBallBenchmarkSingleResult( isValid(), isFallen(), hasPenalty(), getStatusText(), distance, deltaY); } diff --git a/src/main/java/magma/tools/benchmark/model/bench/runchallenge/RunBenchmarkTeamResult.java b/src/main/java/magma/tools/benchmark/model/bench/runchallenge/RunBenchmarkTeamResult.java old mode 100755 new mode 100644 index 61c7306..41c95a4 --- a/src/main/java/magma/tools/benchmark/model/bench/runchallenge/RunBenchmarkTeamResult.java +++ b/src/main/java/magma/tools/benchmark/model/bench/runchallenge/RunBenchmarkTeamResult.java @@ -23,7 +23,6 @@ import java.util.function.ToDoubleFunction; import java.util.stream.Collectors; - import magma.tools.benchmark.model.ISingleResult; import magma.tools.benchmark.model.bench.TeamResult; @@ -40,10 +39,12 @@ public RunBenchmarkTeamResult(String name) public double getAverage(ToDoubleFunction method) { - return results.stream().map(obj -> (RunBenchmarkSingleResult) obj) - .collect(Collectors.summarizingDouble(method)).getAverage(); + return results.stream() + .map(obj -> (RunBenchmarkSingleResult) obj) + .collect(Collectors.summarizingDouble(method)) + .getAverage(); } - + @Override public ISingleResult createSingleResult() { @@ -51,8 +52,8 @@ public ISingleResult createSingleResult() double offGround = getAverage(RunBenchmarkSingleResult::getOffGround); double oneLeg = getAverage(RunBenchmarkSingleResult::getOneLeg); double twoLegs = getAverage(RunBenchmarkSingleResult::getTwoLegs); - - return new RunBenchmarkSingleResult(isValid(), speed, offGround, oneLeg, twoLegs, - isFallen(), hasPenalty(), getStatusText()); + + return new RunBenchmarkSingleResult( + isValid(), speed, offGround, oneLeg, twoLegs, isFallen(), hasPenalty(), getStatusText()); } } diff --git a/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmark.java b/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmark.java index 99435b9..39cec1a 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmark.java +++ b/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmark.java @@ -89,12 +89,12 @@ protected TeamResult createTeamResult(TeamConfiguration currentTeamConfig) @Override protected RunInformation createRunInformation(Random rand, int runID) - { + { double beamX = -15; double beamY = 0; double ballX = beamX + DISTANCE_BEHIND_BALL + noise(rand, BEAM_NOISE); double ballY = beamY + noise(rand, BEAM_NOISE); - + return new RunInformation(runID, beamX, beamY, ballX, ballY); } diff --git a/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmarkReferee.java b/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmarkReferee.java index 5eb241d..0dbe4c4 100644 --- a/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmarkReferee.java +++ b/src/main/java/magma/tools/benchmark/model/bench/throwinchallenge/ThrowInBenchmarkReferee.java @@ -30,7 +30,7 @@ public class ThrowInBenchmarkReferee extends BenchmarkRefereeBase /** speed below which the ball is considered in rest (in m/cycle) */ private static final double BALL_STOPPED_SPEED = 0.001; - + /** minimal height from where the ball needs to be thrown to be considered a throw */ private static final double MIN_THROW_HEIGHT = 0.2; @@ -47,10 +47,10 @@ public class ThrowInBenchmarkReferee extends BenchmarkRefereeBase /** position of ball in last cycle */ private Vector2D oldBallPos; - + /** position of ball in last cycle */ private Vector3D oldBallPos3D; - + /** flag for checking if the ball was above MIN_TROW_HEIGHT */ private boolean wasThrown; @@ -80,7 +80,7 @@ protected boolean onDuringLaunching() protected boolean onStartBenchmark() { state = RefereeState.CONNECTED; - + wasThrown = false; serverCommander.setPlaymode(PlayMode.PLAY_ON); @@ -171,15 +171,15 @@ protected void onStopBenchmark() Vector3D posPlayer = getAgent().getPosition(); Vector2D playerNow = new Vector2D(posPlayer.getX(), posPlayer.getY()); Vector2D ballInitial = new Vector2D(runInfo.getBallX(), runInfo.getBallY()); - + distanceError = oldBallPos.distance(ballInitial); - + // we give a penalty if player left circle around ball if (playerNow.distance(ballInitial) > MAX_BALL_DISTANCE) { distanceError = 0; hasPenalty = true; } - + // we give a penalty if player did not threw the ball if (!wasThrown) { distanceError = 0; diff --git a/src/main/java/magma/tools/benchmark/model/proxy/BenchmarkAgentProxy.java b/src/main/java/magma/tools/benchmark/model/proxy/BenchmarkAgentProxy.java old mode 100755 new mode 100644 index 20e9dc4..7a4ef92 --- a/src/main/java/magma/tools/benchmark/model/proxy/BenchmarkAgentProxy.java +++ b/src/main/java/magma/tools/benchmark/model/proxy/BenchmarkAgentProxy.java @@ -24,7 +24,6 @@ import hso.autonomy.util.symboltreeparser.SymbolTreeParser; import java.net.Socket; import java.util.List; - import magma.tools.SAProxy.impl.AgentProxy; import magma.tools.benchmark.model.bench.RunInformation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; diff --git a/src/main/java/magma/tools/benchmark/view/BenchmarkView.java b/src/main/java/magma/tools/benchmark/view/BenchmarkView.java index 55899c6..816a94f 100644 --- a/src/main/java/magma/tools/benchmark/view/BenchmarkView.java +++ b/src/main/java/magma/tools/benchmark/view/BenchmarkView.java @@ -59,7 +59,7 @@ */ public class BenchmarkView extends JFrame implements IObserver { - public static final String VERSION = "3.2"; + public static final String VERSION = "3.2-beta1"; private final JComboBox challenge; diff --git a/src/main/java/magma/tools/benchmark/view/bench/BenchmarkTableView.java b/src/main/java/magma/tools/benchmark/view/bench/BenchmarkTableView.java old mode 100755 new mode 100644 index a953553..16c1f61 --- a/src/main/java/magma/tools/benchmark/view/bench/BenchmarkTableView.java +++ b/src/main/java/magma/tools/benchmark/view/bench/BenchmarkTableView.java @@ -136,7 +136,12 @@ protected ResultStatus getLocalStatus(int row, int column) /** * The states of a benchmark run */ - protected enum ResultStatus { NO_RESULT, SUCCESS, FAILED } + protected enum ResultStatus + { + NO_RESULT, + SUCCESS, + FAILED + } /** * Listener for status button clicks diff --git a/src/main/java/magma/tools/benchmark/view/bench/passingchallenge/PassingBenchmarkTableView.java b/src/main/java/magma/tools/benchmark/view/bench/passingchallenge/PassingBenchmarkTableView.java index 123bf70..ea1546c 100644 --- a/src/main/java/magma/tools/benchmark/view/bench/passingchallenge/PassingBenchmarkTableView.java +++ b/src/main/java/magma/tools/benchmark/view/bench/passingchallenge/PassingBenchmarkTableView.java @@ -38,10 +38,8 @@ public void update(IModelReadOnly arg0) table.setValueAt(averageScore, teamRow, PassingBenchmarkTableModelExtension.COLUMN_TIME); table.setValueAt(passResult.getScore(0), teamRow, PassingBenchmarkTableModelExtension.COLUMN_BEST_TIME); - table.setValueAt( - passResult.getScore(1), teamRow, PassingBenchmarkTableModelExtension.COLUMN_2_BEST_TIME); - table.setValueAt( - passResult.getScore(2), teamRow, PassingBenchmarkTableModelExtension.COLUMN_3_BEST_TIME); + table.setValueAt(passResult.getScore(1), teamRow, PassingBenchmarkTableModelExtension.COLUMN_2_BEST_TIME); + table.setValueAt(passResult.getScore(2), teamRow, PassingBenchmarkTableModelExtension.COLUMN_3_BEST_TIME); table.setValueAt("", teamRow, PassingBenchmarkTableModelExtension.COLUMN_STATUS); } diff --git a/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableModelExtension.java b/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableModelExtension.java index 72acc85..9bdf2fe 100644 --- a/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableModelExtension.java +++ b/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableModelExtension.java @@ -82,8 +82,8 @@ private RollingBallBenchmarkTableModelExtension(Object[][] data, Object[] column { super(data, columnNames); - columnTypes = new Class[] {String.class, Object.class, Double.class, Integer.class, Float.class, Float.class, Float.class, - String.class, Float.class}; + columnTypes = new Class[] {String.class, Object.class, Double.class, Integer.class, Float.class, Float.class, + Float.class, String.class, Float.class}; editableColumns = new boolean[] {true, false, false, false, false, false, false, true, true}; } diff --git a/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableView.java b/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableView.java index e6d4eec..e33aa97 100644 --- a/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableView.java +++ b/src/main/java/magma/tools/benchmark/view/bench/rollingballchallenge/RollingBallBenchmarkTableView.java @@ -60,7 +60,8 @@ public List getTeamConfiguration() do { String teamPath = (String) table.getValueAt(teamid, RollingBallBenchmarkTableModelExtension.COLUMN_PATH); teamName = (String) table.getValueAt(teamid, RollingBallBenchmarkTableModelExtension.COLUMN_TEAMNAME); - float dropHeight = (Float) table.getValueAt(teamid, RollingBallBenchmarkTableModelExtension.COLUMN_DROP_HEIGHT); + float dropHeight = + (Float) table.getValueAt(teamid, RollingBallBenchmarkTableModelExtension.COLUMN_DROP_HEIGHT); if (teamName != null && !teamName.isEmpty()) { TeamConfiguration config = new TeamConfiguration(teamName, teamPath, dropHeight); result.add(config); @@ -137,8 +138,8 @@ protected JTable createTeamTable(List config) table.getColumn("status").setCellRenderer(benchmarkTableCell); table.getColumn("status").setCellEditor(benchmarkTableCell); table.setRowHeight(30); - table.addMouseListener(new TableMouseListener( - RollingBallBenchmarkTableModelExtension.COLUMN_STATUS, RollingBallBenchmarkTableModelExtension.COLUMN_TEAMNAME)); + table.addMouseListener(new TableMouseListener(RollingBallBenchmarkTableModelExtension.COLUMN_STATUS, + RollingBallBenchmarkTableModelExtension.COLUMN_TEAMNAME)); return table; } diff --git a/src/main/java/magma/tools/benchmark/view/bench/throwinchallenge/ThrowInBenchmarkTableView.java b/src/main/java/magma/tools/benchmark/view/bench/throwinchallenge/ThrowInBenchmarkTableView.java index e3f763f..f149b54 100644 --- a/src/main/java/magma/tools/benchmark/view/bench/throwinchallenge/ThrowInBenchmarkTableView.java +++ b/src/main/java/magma/tools/benchmark/view/bench/throwinchallenge/ThrowInBenchmarkTableView.java @@ -132,8 +132,8 @@ protected JTable createTeamTable(List config) table.getColumn("status").setCellRenderer(benchmarkTableCell); table.getColumn("status").setCellEditor(benchmarkTableCell); table.setRowHeight(30); - table.addMouseListener(new TableMouseListener( - ThrowInBenchmarkTableModelExtension.COLUMN_STATUS, ThrowInBenchmarkTableModelExtension.COLUMN_TEAMNAME)); + table.addMouseListener(new TableMouseListener(ThrowInBenchmarkTableModelExtension.COLUMN_STATUS, + ThrowInBenchmarkTableModelExtension.COLUMN_TEAMNAME)); return table; }