Package edu.wpi.first.wpilibj.trajectory
Class TrajectoryUtil
- java.lang.Object
-
- edu.wpi.first.wpilibj.trajectory.TrajectoryUtil
-
public final class TrajectoryUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TrajectorydeserializeTrajectory(String json)Deserializes a Trajectory from PathWeaver-style JSON.static TrajectoryfromPathweaverJson(Path path)Imports a Trajectory from a PathWeaver-style JSON file.static StringserializeTrajectory(Trajectory trajectory)Serializes a Trajectory to PathWeaver-style JSON.static voidtoPathweaverJson(Trajectory trajectory, Path path)Exports a Trajectory to a PathWeaver-style JSON file.
-
-
-
Method Detail
-
fromPathweaverJson
public static Trajectory fromPathweaverJson(Path path) throws IOException
Imports a Trajectory from a PathWeaver-style JSON file.- Parameters:
path- the path of the json file to import from- Returns:
- The trajectory represented by the file.
- Throws:
IOException- if reading from the file fails
-
toPathweaverJson
public static void toPathweaverJson(Trajectory trajectory, Path path) throws IOException
Exports a Trajectory to a PathWeaver-style JSON file.- Parameters:
trajectory- the trajectory to exportpath- the path of the file to export to- Throws:
IOException- if writing to the file fails
-
deserializeTrajectory
public static Trajectory deserializeTrajectory(String json) throws com.fasterxml.jackson.core.JsonProcessingException
Deserializes a Trajectory from PathWeaver-style JSON.- Parameters:
json- the string containing the serialized JSON- Returns:
- the trajectory represented by the JSON
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if deserializing the JSON fails
-
serializeTrajectory
public static String serializeTrajectory(Trajectory trajectory) throws com.fasterxml.jackson.core.JsonProcessingException
Serializes a Trajectory to PathWeaver-style JSON.- Parameters:
trajectory- the trajectory to export- Returns:
- the string containing the serialized JSON
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if serializing the Trajectory fails
-
-