Unverified Commit aa700062 authored by MarkG's avatar MarkG Committed by NicolaiO
Browse files

Resolve "Cleanup Geometry"

Closes #1580

See merge request main/Sumatra!1324

sumatra-commit: 718002673080ce4af784d06680dbb799901ccaa2
parent fae465d7
/*
* Copyright (c) 2009 - 2020, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.geometry;
......@@ -17,17 +17,17 @@ public class BallParameters
{
@Configurable(
comment = "Ball sliding acceleration [mm/s^2]",
defValue = "-3600.0",
defValue = "-3000.0",
spezis = { "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE", "NICOLAI" }
)
private double accSlide = -3600.0;
private double accSlide = -3000.0;
@Configurable(
comment = "Ball rolling acceleration [mm/s^2]",
defValue = "-400.0",
defValue = "-260.0",
spezis = { "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE", "NICOLAI" }
)
private double accRoll = -400.0;
private double accRoll = -260.0;
@Configurable(
comment = "Fraction of the initial velocity where the ball starts to roll",
......@@ -59,10 +59,10 @@ public class BallParameters
@Configurable(
comment = "Chip kick velocity damping factor in Z direction",
defValue = "0.6",
defValue = "0.5",
spezis = { "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE", "NICOLAI" }
)
private double chipDampingZ = 0.6;
private double chipDampingZ = 0.5;
@Configurable(
comment = "If a chipped ball does not reach this height it is considered rolling [mm]",
......
/*
* Copyright (c) 2009 - 2020, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.geometry;
......@@ -17,7 +17,6 @@ import edu.tigers.sumatra.ids.ETeamColor;
import edu.tigers.sumatra.math.SumatraMath;
import edu.tigers.sumatra.math.circle.Circle;
import edu.tigers.sumatra.math.circle.ICircle;
import edu.tigers.sumatra.math.line.v2.ILine;
import edu.tigers.sumatra.math.line.v2.ILineSegment;
import edu.tigers.sumatra.math.line.v2.Lines;
import edu.tigers.sumatra.math.rectangle.IRectangle;
......@@ -26,8 +25,7 @@ import edu.tigers.sumatra.math.vector.IVector2;
import edu.tigers.sumatra.math.vector.Vector2;
import edu.tigers.sumatra.math.vector.Vector2f;
import edu.tigers.sumatra.model.SumatraModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import lombok.extern.log4j.Log4j2;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -41,53 +39,104 @@ import java.util.Set;
/**
* Configuration object for geometry parameters.
*/
@Log4j2
public class Geometry
{
private static final Logger log = LogManager.getLogger(Geometry.class.getName());
/**
* Field Geometry
*/
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" })
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "12000.0"
)
private static double fieldLength = 12000;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" })
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "9000.0"
)
private static double fieldWidth = 9000;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValue = "350.0")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "350.0"
)
private static double boundaryWidth = 350;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValue = "425.0")
private static double judgesBorderWidth = 425;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValue = "500.0")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "500.0"
)
private static double centerCircleRadius = 500;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" })
private static double goalWidth = 1200;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValue = "180.0")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "1800.0"
)
private static double goalWidth = 1800;
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "180.0"
)
private static double goalDepth = 180;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValue = "155.0")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "155.0"
)
private static double goalHeight = 155;
@Configurable(comment = "Name of the CenterCircle arc defined in SSL-Vision", defValue = "CenterCircle")
@Configurable(
comment = "Name of the CenterCircle arc defined in SSL-Vision",
defValue = "CenterCircle"
)
private static String centerCircleName = "CenterCircle";
@Configurable(comment = "The team on the negative half", defValue = "BLUE")
@Configurable(
comment = "The team on the negative half",
defValue = "BLUE"
)
private static ETeamColor negativeHalfTeam = ETeamColor.BLUE;
/**
* Penalty Area
*/
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH",
"ROBOCUP", "ANDRE" }, comment = "Distance (goal line - penalty mark)")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
comment = "Distance (goal line - penalty mark)",
defValue = "8000.0"
)
private static double distanceToPenaltyMark = 8000;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH",
"ROBOCUP", "ANDRE" }, comment = "depth of the penalty area.")
private static double penaltyAreaDepth = 1200;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP",
"ANDRE" }, comment = "the length of the short line of the penalty area, that is parallel to the goal line")
private static double penaltyAreaFrontLineLength = 2400;
@Configurable(defValue = "LeftPenaltyStretch", comment = "Name of the LeftPenaltyStretch line defined in SSL-Vision")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValue = "1800.0"
)
private static double penaltyAreaDepth = 1800;
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
comment = "the length of the short line of the penalty area, that is parallel to the goal line",
defValue = "3600.0"
)
private static double penaltyAreaFrontLineLength = 3600;
@Configurable(
defValue = "LeftPenaltyStretch",
comment = "Name of the LeftPenaltyStretch line defined in SSL-Vision"
)
private static String leftPenaltyStretchName = "LeftPenaltyStretch";
@Configurable(defValue = "RightPenaltyStretch", comment = "Name of the RightPenaltyStretch line defined in SSL-Vision")
@Configurable(
defValue = "RightPenaltyStretch",
comment = "Name of the RightPenaltyStretch line defined in SSL-Vision"
)
private static String rightPenaltyStretchName = "RightPenaltyStretch";
@Configurable(defValue = "LeftFieldRightPenaltyArc")
private static String leftFieldRightPenaltyArcName = "LeftFieldRightPenaltyArc";
@Configurable(defValue = "false")
private static boolean legacyPenArea = false;
......@@ -114,15 +163,16 @@ public class Geometry
@Configurable(defValue = "0", spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" })
private static double boundaryOffset = 0;
@Configurable(spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" }, defValueSpezis = { "0.06",
"0.0", "0.06", "0.06", "0.06",
"0.06" }, comment = "Delay [s] from giving a robot command to receiving the reaction on this command from vision")
@Configurable(
spezis = { "NICOLAI", "SUMATRA", "LAB", "TISCH", "ROBOCUP", "ANDRE" },
defValueSpezis = { "0.06", "0.0", "0.06", "0.06", "0.06", "0.06" },
comment = "Delay [s] from giving a robot command to receiving the reaction on this command from vision"
)
private static double feedbackDelay = 0.06;
private final IRectangle field;
private final IRectangle fieldWBorders;
private final IRectangle fieldWReferee;
private final Goal goalOur;
private final Goal goalTheir;
private final IPenaltyArea penaltyAreaOur;
......@@ -130,7 +180,6 @@ public class Geometry
private final ICircle centerCircle;
private final IRectangle ourHalf;
private final IRectangle theirHalf;
private final ILine halfLine;
private final List<ILineSegment> touchLines;
private CamGeometry lastCamGeometry;
......@@ -157,14 +206,11 @@ public class Geometry
}
/**
*/
private Geometry()
{
// noinspection SuspiciousNameCombination
field = Rectangle.fromCenter(Vector2f.ZERO_VECTOR, fieldLength, fieldWidth);
fieldWBorders = field.withMargin(boundaryOffset + boundaryWidth);
fieldWReferee = fieldWBorders.withMargin(judgesBorderWidth);
goalOur = calcOurGoal(goalWidth, goalDepth, fieldLength);
goalTheir = calcTheirGoal(goalWidth, goalDepth, fieldLength);
......@@ -188,7 +234,6 @@ public class Geometry
field.xExtent() / 2,
field.yExtent());
halfLine = calcHalfLine();
touchLines = new ArrayList<>();
touchLines.addAll(calcTouchLines());
......@@ -208,12 +253,6 @@ public class Geometry
}
private ILine calcHalfLine()
{
return Lines.lineFromPoints(Vector2.fromY(-fieldWidth / 2), Vector2.fromY(fieldWidth / 2));
}
private static synchronized void update()
{
instance = new Geometry();
......@@ -475,17 +514,6 @@ public class Geometry
}
/**
* Field including referee area
*
* @return the fieldWBorders
*/
public static IRectangle getFieldWReferee()
{
return instance.fieldWReferee;
}
/**
* @return
*/
......@@ -605,12 +633,6 @@ public class Geometry
}
public static ILine getHalfLine()
{
return instance.halfLine;
}
public static List<ILineSegment> getTouchLines()
{
return instance.touchLines;
......
......@@ -25,37 +25,5 @@
"PENALTY_KICK_FAILED": "BEHAVIOR_ACCEPT",
"PLACEMENT_SUCCEEDED": "BEHAVIOR_ACCEPT",
"POSSIBLE_GOAL": "BEHAVIOR_ACCEPT"
},
"autoRefConfigs": {
"TIGERs AutoRef": {
"gameEventBehavior": {
"AIMLESS_KICK": "BEHAVIOR_ACCEPT",
"ATTACKER_DOUBLE_TOUCHED_BALL": "BEHAVIOR_ACCEPT",
"ATTACKER_TOO_CLOSE_TO_DEFENSE_AREA": "BEHAVIOR_ACCEPT",
"ATTACKER_TOUCHED_BALL_IN_DEFENSE_AREA": "BEHAVIOR_ACCEPT",
"BALL_LEFT_FIELD_GOAL_LINE": "BEHAVIOR_ACCEPT",
"BALL_LEFT_FIELD_TOUCH_LINE": "BEHAVIOR_ACCEPT",
"BOT_CRASH_DRAWN": "BEHAVIOR_ACCEPT",
"BOT_CRASH_UNIQUE": "BEHAVIOR_ACCEPT",
"BOT_DRIBBLED_BALL_TOO_FAR": "BEHAVIOR_ACCEPT",
"BOT_HELD_BALL_DELIBERATELY": "BEHAVIOR_ACCEPT",
"BOT_INTERFERED_PLACEMENT": "BEHAVIOR_ACCEPT",
"BOT_KICKED_BALL_TOO_FAST": "BEHAVIOR_ACCEPT",
"BOT_PUSHED_BOT": "BEHAVIOR_ACCEPT",
"BOT_TIPPED_OVER": "BEHAVIOR_ACCEPT",
"BOT_TOO_FAST_IN_STOP": "BEHAVIOR_ACCEPT",
"BOUNDARY_CROSSING": "BEHAVIOR_ACCEPT",
"DEFENDER_IN_DEFENSE_AREA": "BEHAVIOR_ACCEPT",
"DEFENDER_TOO_CLOSE_TO_KICK_POINT": "BEHAVIOR_ACCEPT",
"GOAL": "BEHAVIOR_ACCEPT",
"INVALID_GOAL": "BEHAVIOR_ACCEPT",
"KEEPER_HELD_BALL": "BEHAVIOR_ACCEPT",
"NO_PROGRESS_IN_GAME": "BEHAVIOR_ACCEPT",
"PENALTY_KICK_FAILED": "BEHAVIOR_ACCEPT",
"PLACEMENT_SUCCEEDED": "BEHAVIOR_ACCEPT",
"POSSIBLE_GOAL": "BEHAVIOR_ACCEPT"
}
}
},
"activeTrackerSource": "37cfbf2f-bc5a-4c47-8213-5e0f691f5d07"
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment