Package xbot.common.subsystems.pose
Class RectangleFieldObstacle
java.lang.Object
xbot.common.subsystems.pose.RectangleFieldObstacle
- All Implemented Interfaces:
IFieldObstacle
- Direct Known Subclasses:
SquareFieldObstacle
Rectangle obstacle defined by center + half extents.
Collision is tested as: (segment swept by robotRadius) intersects rectangle
<=> segment intersects the rectangle inflated by robotRadius in X and Y.
-
Constructor Summary
ConstructorsConstructorDescriptionRectangleFieldObstacle(Translation2d center, Distance halfWidth, Distance halfHeight, boolean isToughTerrain) -
Method Summary
Modifier and TypeMethodDescriptionWhat's the radius that we'll attempt to avoid when we need to move away from the obstacle.center()Returns the center of the obstacle to help determine closest obstacle.booleandoesRobotPathIntersect(Translation2d start, Translation2d end, Distance robotRadius) Whether the described robot path will collide with this field obstacle or not.booleanReturns this obstacle can still be moved through, but is slower terrain or more dangerous terrain to move through.
-
Constructor Details
-
RectangleFieldObstacle
public RectangleFieldObstacle(Translation2d center, Distance halfWidth, Distance halfHeight, boolean isToughTerrain)
-
-
Method Details
-
isToughTerrain
public boolean isToughTerrain()Description copied from interface:IFieldObstacleReturns this obstacle can still be moved through, but is slower terrain or more dangerous terrain to move through.- Specified by:
isToughTerrainin interfaceIFieldObstacle- Returns:
- Whether the obstacle matches the description above for tough terrain.
-
center
Description copied from interface:IFieldObstacleReturns the center of the obstacle to help determine closest obstacle.- Specified by:
centerin interfaceIFieldObstacle- Returns:
- A translation 2d for where the center of this obstacle
-
avoidanceRadius
Description copied from interface:IFieldObstacleWhat's the radius that we'll attempt to avoid when we need to move away from the obstacle.- Specified by:
avoidanceRadiusin interfaceIFieldObstacle- Returns:
- Whether the obstacle matches the description above for tough terrain.
-
doesRobotPathIntersect
Description copied from interface:IFieldObstacleWhether the described robot path will collide with this field obstacle or not.- Specified by:
doesRobotPathIntersectin interfaceIFieldObstacle- Parameters:
start- The start of the path.end- The end of the path.robotRadius- The radius we should use to determine whether the robot can make the path through this obstacle.- Returns:
- Whether the path will work for this obstacle.
-