Class TrajectoryUtilJNI

java.lang.Object
edu.wpi.first.math.jni.WPIMathJNI
edu.wpi.first.math.jni.TrajectoryUtilJNI

public final class TrajectoryUtilJNI extends WPIMathJNI
TrajectoryUtil JNI.
  • Method Details

    • fromPathweaverJson

      public static double[] fromPathweaverJson(String path) throws IOException
      Loads a Pathweaver JSON.
      Parameters:
      path - The path to the JSON.
      Returns:
      A double array with the trajectory states from the JSON.
      Throws:
      IOException - if the JSON could not be read.
    • toPathweaverJson

      public static void toPathweaverJson(double[] elements, String path) throws IOException
      Converts a trajectory into a Pathweaver JSON and saves it.
      Parameters:
      elements - The elements of the trajectory.
      path - The location to save the JSON to.
      Throws:
      IOException - if the JSON could not be written.
    • deserializeTrajectory

      public static double[] deserializeTrajectory(String json)
      Deserializes a trajectory JSON into a double[] of trajectory elements.
      Parameters:
      json - The JSON containing the serialized trajectory.
      Returns:
      A double array with the trajectory states.
    • serializeTrajectory

      public static String serializeTrajectory(double[] elements)
      Serializes the trajectory into a JSON string.
      Parameters:
      elements - The elements of the trajectory.
      Returns:
      A JSON containing the serialized trajectory.