Package ftclib.vision

Class FtcLimelightVision.DetectedObject

java.lang.Object
ftclib.vision.FtcLimelightVision.DetectedObject
All Implemented Interfaces:
TrcVisionTargetInfo.ObjectInfo
Enclosing class:
FtcLimelightVision

public static class FtcLimelightVision.DetectedObject extends Object implements TrcVisionTargetInfo.ObjectInfo
This class encapsulates info of the detected object. It extends TrcOpenCvDetector.DetectedObject that requires it to provide a method to return the detected object rect and area.
  • Field Details

    • llResult

      public final com.qualcomm.hardware.limelightvision.LLResult llResult
    • resultType

      public final FtcLimelightVision.ResultType resultType
    • result

      public final Object result
    • label

      public final String label
    • targetGroundOffset

      public final FtcLimelightVision.TargetGroundOffset targetGroundOffset
    • targetPose

      public final TrcPose2D targetPose
    • robotPose

      public final TrcPose2D robotPose
    • vertices

      public final org.opencv.core.Point[] vertices
    • pixelWidth

      public final double pixelWidth
    • pixelHeight

      public final double pixelHeight
    • rotatedAngle

      public final double rotatedAngle
    • targetRect

      public final org.opencv.core.Rect targetRect
    • targetArea

      public final double targetArea
    • targetDepth

      public double targetDepth
  • Constructor Details

    • DetectedObject

      public DetectedObject(com.qualcomm.hardware.limelightvision.LLResult llResult, FtcLimelightVision.ResultType resultType, Object result, String label, org.firstinspires.ftc.robotcore.external.navigation.Pose3D robotPose, FtcLimelightVision.TargetGroundOffset targetGroundOffset, TrcPose3D cameraPose)
      Constructor: Creates an instance of the object.
      Parameters:
      llResult - specifies the Limelight detection result.
      resultType - specifies the detected object result type.
      result - specifies the detected object.
      label - specifies the detected object label if there is one.
      robotPose - specifies the robot's 3D position.
      targetGroundOffset - specifies the method to call to get target ground offset.
      cameraPose - specifies the camera position on the robot.
  • Method Details

    • toString

      @NonNull public String toString()
      This method returns the string form of the target info.
      Overrides:
      toString in class Object
      Returns:
      string form of the target info.
    • getObjectRect

      public org.opencv.core.Rect getObjectRect()
      This method returns the rect of the detected object.
      Specified by:
      getObjectRect in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rect of the detected object.
    • getObjectArea

      public double getObjectArea()
      This method returns the area of the detected object.
      Specified by:
      getObjectArea in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      area of the detected object.
    • getPixelWidth

      public Double getPixelWidth()
      This method returns the object's pixel width.
      Specified by:
      getPixelWidth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object pixel width, null if not supported.
    • getPixelHeight

      public Double getPixelHeight()
      This method returns the object's pixel height.
      Specified by:
      getPixelHeight in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object pixel height, null if not supported.
    • getRotatedAngle

      public Double getRotatedAngle()
      This method returns the object's rotated rectangle angle.
      Specified by:
      getRotatedAngle in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rotated rectangle angle.
    • getObjectPose

      public TrcPose2D getObjectPose()
      This method returns the pose of the detected object relative to the camera.
      Specified by:
      getObjectPose in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      pose of the detected object relative to camera.
    • getObjectWidth

      public Double getObjectWidth()
      This method returns the objects real world width.
      Specified by:
      getObjectWidth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object real world width, null if not supported.
    • getObjectDepth

      public Double getObjectDepth()
      This method returns the objects real world depth.
      Specified by:
      getObjectDepth in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      object real world depth, null if not supported.
    • getRotatedRectVertices

      public org.opencv.core.Point[] getRotatedRectVertices()
      This method returns the rotated rect vertices of the detected object.
      Specified by:
      getRotatedRectVertices in interface TrcVisionTargetInfo.ObjectInfo
      Returns:
      rotated rect vertices.
    • getTargetPose

      private TrcPose2D getTargetPose(TrcPose3D cameraPose)
      This method calculates the target pose of the detected object.
      Parameters:
      cameraPose - specifies the the camera position on the robot.
      Returns:
      target pose from the camera.
    • getRobotPose

      private TrcPose2D getRobotPose(org.firstinspires.ftc.robotcore.external.navigation.Pose3D botpose, TrcPose3D cameraPose)
      This method returns the robot's field position as a TrcPose2D.
      Parameters:
      botpose - specifies the robot's field position in 3D space.
      cameraPose - specifies the camera position relative to robot ground center.
      Returns:
      robot's 2D field position.