Class DataUtils

java.lang.Object
com.titaniumtigers4829.utils.DataUtils

public class DataUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    extractArrayEntry(double[] inData, int position)
     
    static double[]
    pose2dToArray(edu.wpi.first.math.geometry.Pose2d pose)
    Converts a Pose2d object to an array of doubles in the format [x, y, z, roll, pitch, yaw].
    static double[]
    pose3dToArray(edu.wpi.first.math.geometry.Pose3d pose)
    Converts a Pose3d object to an array of doubles in the format [x, y, z, roll, pitch, yaw].
    static edu.wpi.first.math.geometry.Pose2d
    toPose2D(double[] inData)
    Takes a 6-length array of pose data and converts it to a Pose2d object.
    static edu.wpi.first.math.geometry.Pose3d
    toPose3D(double[] inData)
    Takes a 6-length array of pose data and converts it to a Pose3d object.
    unpackBotPoseEstimate(String limelightName, String entryName, boolean isMegaTag2)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DataUtils

      public DataUtils()
  • Method Details

    • toPose3D

      public static edu.wpi.first.math.geometry.Pose3d toPose3D(double[] inData)
      Takes a 6-length array of pose data and converts it to a Pose3d object. Array format: [x, y, z, roll, pitch, yaw] where angles are in degrees.
      Parameters:
      inData - Array containing pose data [x, y, z, roll, pitch, yaw]
      Returns:
      Pose3d object representing the pose, or empty Pose3d if invalid data
    • toPose2D

      public static edu.wpi.first.math.geometry.Pose2d toPose2D(double[] inData)
      Takes a 6-length array of pose data and converts it to a Pose2d object. Uses only x, y, and yaw components, ignoring z, roll, and pitch. Array format: [x, y, z, roll, pitch, yaw] where angles are in degrees.
      Parameters:
      inData - Array containing pose data [x, y, z, roll, pitch, yaw]
      Returns:
      Pose2d object representing the pose, or empty Pose2d if invalid data
    • pose3dToArray

      public static double[] pose3dToArray(edu.wpi.first.math.geometry.Pose3d pose)
      Converts a Pose3d object to an array of doubles in the format [x, y, z, roll, pitch, yaw]. Translation components are in meters, rotation components are in degrees.
      Parameters:
      pose - The Pose3d object to convert
      Returns:
      A 6-element array containing [x, y, z, roll, pitch, yaw]
    • pose2dToArray

      public static double[] pose2dToArray(edu.wpi.first.math.geometry.Pose2d pose)
      Converts a Pose2d object to an array of doubles in the format [x, y, z, roll, pitch, yaw]. Translation components are in meters, rotation components are in degrees. Note: z, roll, and pitch will be 0 since Pose2d only contains x, y, and yaw.
      Parameters:
      pose - The Pose2d object to convert
      Returns:
      A 6-element array containing [x, y, 0, 0, 0, yaw]
    • extractArrayEntry

      public static double extractArrayEntry(double[] inData, int position)
    • unpackBotPoseEstimate

      public static PoseEstimate unpackBotPoseEstimate(String limelightName, String entryName, boolean isMegaTag2)