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 invalid input: '<'=> segment intersects the rectangle inflated by robotRadius in X and Y.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.wpilib.math.geometry.Translation2d
     
    protected final org.wpilib.units.measure.Distance
     
    protected final org.wpilib.units.measure.Distance
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RectangleFieldObstacle(org.wpilib.math.geometry.Translation2d center, org.wpilib.units.measure.Distance halfWidth, org.wpilib.units.measure.Distance halfHeight, boolean isToughTerrain)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.wpilib.units.measure.Distance
    What's the radius that we'll attempt to avoid when we need to move away from the obstacle.
    org.wpilib.math.geometry.Translation2d
    Returns the center of the obstacle to help determine closest obstacle.
    boolean
    doesRobotPathIntersect(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.Distance
     
    org.wpilib.units.measure.Distance
     
    boolean
    Returns this obstacle can still be moved through, but is slower terrain or more dangerous terrain to move through.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: 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 org.wpilib.math.geometry.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
    • 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: 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(org.wpilib.math.geometry.Translation2d start, org.wpilib.math.geometry.Translation2d end, org.wpilib.units.measure.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.