mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Add JSON support for Trajectories (#2025)
This commit is contained in:
committed by
Peter Johnson
parent
2b6811eddb
commit
ed30d5d40e
@@ -11,6 +11,10 @@
|
||||
#include "Translation2d.h"
|
||||
#include "Twist2d.h"
|
||||
|
||||
namespace wpi {
|
||||
class json;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
@@ -167,4 +171,9 @@ class Pose2d {
|
||||
Translation2d m_translation;
|
||||
Rotation2d m_rotation;
|
||||
};
|
||||
|
||||
void to_json(wpi::json& json, const Pose2d& pose);
|
||||
|
||||
void from_json(const wpi::json& json, Pose2d& pose);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <units/units.h>
|
||||
#include <wpi/math>
|
||||
|
||||
namespace wpi {
|
||||
class json;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
@@ -175,4 +179,9 @@ class Rotation2d {
|
||||
double m_cos = 1;
|
||||
double m_sin = 0;
|
||||
};
|
||||
|
||||
void to_json(wpi::json& json, const Rotation2d& rotation);
|
||||
|
||||
void from_json(const wpi::json& json, Rotation2d& rotation);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
#include "Rotation2d.h"
|
||||
|
||||
namespace wpi {
|
||||
class json;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
@@ -211,4 +215,9 @@ class Translation2d {
|
||||
units::meter_t m_x = 0_m;
|
||||
units::meter_t m_y = 0_m;
|
||||
};
|
||||
|
||||
void to_json(wpi::json& json, const Translation2d& state);
|
||||
|
||||
void from_json(const wpi::json& json, Translation2d& state);
|
||||
|
||||
} // namespace frc
|
||||
|
||||
Reference in New Issue
Block a user