2022-05-06 08:41:23 -07:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#include "frc/geometry/Pose3d.h"
|
|
|
|
|
|
2022-11-04 12:56:22 -04:00
|
|
|
#include <wpi/json.h>
|
|
|
|
|
|
|
|
|
|
void frc::to_json(wpi::json& json, const Pose3d& pose) {
|
|
|
|
|
json = wpi::json{{"translation", pose.Translation()},
|
|
|
|
|
{"rotation", pose.Rotation()}};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void frc::from_json(const wpi::json& json, Pose3d& pose) {
|
|
|
|
|
pose = Pose3d{json.at("translation").get<Translation3d>(),
|
|
|
|
|
json.at("rotation").get<Rotation3d>()};
|
|
|
|
|
}
|