Class RectangleFieldObstacle

java.lang.Object
xbot.common.subsystems.pose.RectangleFieldObstacle
All Implemented Interfaces:
IFieldObstacle
Direct Known Subclasses:
SquareFieldObstacle

public class RectangleFieldObstacle extends Object implements IFieldObstacle
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 Details

    • RectangleFieldObstacle

      public RectangleFieldObstacle(Translation2d center, Distance halfWidth, Distance halfHeight, boolean isToughTerrain)
  • Method Details

    • isToughTerrain

      public boolean isToughTerrain()
      Description copied from interface: IFieldObstacle
      Returns this obstacle can still be moved through, but is slower terrain or more dangerous terrain to move through.
      Specified by:
      isToughTerrain in interface IFieldObstacle
      Returns:
      Whether the obstacle matches the description above for tough terrain.
    • center

      public Translation2d center()
      Description copied from interface: IFieldObstacle
      Returns the center of the obstacle to help determine closest obstacle.
      Specified by:
      center in interface IFieldObstacle
      Returns:
      A translation 2d for where the center of this obstacle
    • avoidanceRadius

      public Distance avoidanceRadius()
      Description copied from interface: IFieldObstacle
      What's the radius that we'll attempt to avoid when we need to move away from the obstacle.
      Specified by:
      avoidanceRadius in interface IFieldObstacle
      Returns:
      Whether the obstacle matches the description above for tough terrain.
    • doesRobotPathIntersect

      public boolean doesRobotPathIntersect(Translation2d start, Translation2d end, Distance robotRadius)
      Description copied from interface: IFieldObstacle
      Whether the described robot path will collide with this field obstacle or not.
      Specified by:
      doesRobotPathIntersect in interface IFieldObstacle
      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.