Package edu.wpi.first.math.trajectory
Class TrajectoryUtil
java.lang.Object
edu.wpi.first.math.trajectory.TrajectoryUtil
public final class TrajectoryUtil extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTrajectoryUtil.TrajectorySerializationException -
Method Summary
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 Details
-
fromPathweaverJson
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
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 PathWeaver-style JSON.- 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.
-