Class JsonUtilities
java.lang.Object
io.github.roboblazers7617.limelight.JsonUtilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
extractArrayEntry
(double[] inData, int position) static double[]
pose2dToArray
(Pose2d pose) Converts a Pose2d object to an array of doubles in the format [x, y, z, roll, pitch, yaw].static double[]
pose3dToArray
(Pose3d pose) Converts a Pose3d object to an array of doubles in the format [x, y, z, roll, pitch, yaw].static Pose2d
toPose2D
(double[] inData) Takes a 6-length array of pose data and converts it to a Pose2d object.static Pose3d
toPose3D
(double[] inData) Takes a 6-length array of pose data and converts it to a Pose3d object.static double[]
translation3dToArray
(Translation3d translation) Converts aTranslation3d
object to an array of doubles in format [x, y, z].
-
Constructor Details
-
JsonUtilities
public JsonUtilities()
-
-
Method Details
-
translation3dToArray
Converts aTranslation3d
object to an array of doubles in format [x, y, z]. Measurements are in Meters.- Parameters:
translation
-Translation3d
to convert.- Returns:
- Double array containing [x, y, z]
-
toPose3D
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
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
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
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)
-