Package edu.wpi.first.math.trajectory
Class TrajectoryUtil
java.lang.Object
edu.wpi.first.math.trajectory.TrajectoryUtil
Trajectory utilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException for trajectory serialization failure. -
Method Summary
Modifier and TypeMethodDescriptionstatic TrajectorydeserializeTrajectory(String json) Deserializes a Trajectory from JSON exported from PathWeaver.static TrajectoryfromPathweaverJson(Path path) Imports a Trajectory from a JSON file exported from PathWeaver.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 Details
-
fromPathweaverJson
Imports a Trajectory from a JSON file exported from PathWeaver.- 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
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
Deserializes a Trajectory from JSON exported from PathWeaver.- Parameters:
json- The string containing the serialized JSON- Returns:
- the trajectory represented by the JSON
- Throws:
TrajectoryUtil.TrajectorySerializationException- if deserialization of the string fails.
-
serializeTrajectory
Serializes a Trajectory to PathWeaver-style JSON.- Parameters:
trajectory- The trajectory to export- Returns:
- The string containing the serialized JSON
- Throws:
TrajectoryUtil.TrajectorySerializationException- if serialization of the trajectory fails.
-