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 invalid input: '<'=> segment intersects the rectangle
inflated by robotRadius in X and Y.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.wpilib.math.geometry.Translation2dprotected final org.wpilib.units.measure.Distanceprotected final org.wpilib.units.measure.Distance -
Constructor Summary
ConstructorsConstructorDescriptionRectangleFieldObstacle(org.wpilib.math.geometry.Translation2d center, org.wpilib.units.measure.Distance halfWidth, org.wpilib.units.measure.Distance halfHeight, boolean isToughTerrain) -
Method Summary
Modifier and TypeMethodDescriptionorg.wpilib.units.measure.DistanceWhat's the radius that we'll attempt to avoid when we need to move away from the obstacle.org.wpilib.math.geometry.Translation2dcenter()Returns the center of the obstacle to help determine closest obstacle.booleandoesRobotPathIntersect(org.wpilib.math.geometry.Translation2d start, org.wpilib.math.geometry.Translation2d end, org.wpilib.units.measure.Distance robotRadius) Whether the described robot path will collide with this field obstacle or not.org.wpilib.units.measure.Distanceorg.wpilib.units.measure.DistancebooleanReturns this obstacle can still be moved through, but is slower terrain or more dangerous terrain to move through.
-
Field Details
-
center
protected final org.wpilib.math.geometry.Translation2d center -
halfWidth
protected final org.wpilib.units.measure.Distance halfWidth -
halfHeight
protected final org.wpilib.units.measure.Distance halfHeight
-
-
Constructor Details
-
RectangleFieldObstacle
public RectangleFieldObstacle(org.wpilib.math.geometry.Translation2d center, org.wpilib.units.measure.Distance halfWidth, org.wpilib.units.measure.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
public org.wpilib.math.geometry.Translation2d 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
-
getHalfWidth
public org.wpilib.units.measure.Distance getHalfWidth() -
getHalfHeight
public org.wpilib.units.measure.Distance getHalfHeight() -
avoidanceRadius
public org.wpilib.units.measure.Distance 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
public boolean doesRobotPathIntersect(org.wpilib.math.geometry.Translation2d start, org.wpilib.math.geometry.Translation2d end, org.wpilib.units.measure.Distance robotRadius) 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.
-