WPILibC++ 2024.1.1-beta-4
TrajectoryUtil.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <string>
8#include <string_view>
9
10#include <wpi/SymbolExports.h>
11
13
14namespace frc {
16 public:
17 TrajectoryUtil() = delete;
18
19 /**
20 * Exports a Trajectory to a PathWeaver-style JSON file.
21 *
22 * @param trajectory the trajectory to export
23 * @param path the path of the file to export to
24 */
25 static void ToPathweaverJson(const Trajectory& trajectory,
26 std::string_view path);
27 /**
28 * Imports a Trajectory from a JSON file exported from PathWeaver.
29 *
30 * @param path The path of the json file to import from.
31 *
32 * @return The trajectory represented by the file.
33 */
35
36 /**
37 * Deserializes a Trajectory from JSON exported from PathWeaver.
38 *
39 * @param trajectory the trajectory to export
40 *
41 * @return the string containing the serialized JSON
42 */
43 static std::string SerializeTrajectory(const Trajectory& trajectory);
44
45 /**
46 * Serializes a Trajectory to PathWeaver-style JSON.
47 *
48 * @param jsonStr the string containing the serialized JSON
49 *
50 * @return the trajectory represented by the JSON
51 */
53};
54} // namespace frc
#define WPILIB_DLLEXPORT
Definition: SymbolExports.h:36
Represents a time-parameterized trajectory.
Definition: Trajectory.h:25
Definition: TrajectoryUtil.h:15
static std::string SerializeTrajectory(const Trajectory &trajectory)
Deserializes a Trajectory from JSON exported from PathWeaver.
static void ToPathweaverJson(const Trajectory &trajectory, std::string_view path)
Exports a Trajectory to a PathWeaver-style JSON file.
static Trajectory FromPathweaverJson(std::string_view path)
Imports a Trajectory from a JSON file exported from PathWeaver.
static Trajectory DeserializeTrajectory(std::string_view jsonStr)
Serializes a Trajectory to PathWeaver-style JSON.
basic_string_view< char > string_view
Definition: core.h:501
Definition: AprilTagPoseEstimator.h:15