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.
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/math/geometry/Pose3d.hpp"
|
2022-05-06 08:41:23 -07:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/util/json.hpp"
|
2022-11-04 12:56:22 -04:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
void wpi::math::to_json(wpi::util::json& json, const Pose3d& pose) {
|
|
|
|
|
json = wpi::util::json{{"translation", pose.Translation()},
|
2025-11-07 20:01:58 -05:00
|
|
|
{"rotation", pose.Rotation()}};
|
2022-11-04 12:56:22 -04:00
|
|
|
}
|
|
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
void wpi::math::from_json(const wpi::util::json& json, Pose3d& pose) {
|
2022-11-04 12:56:22 -04:00
|
|
|
pose = Pose3d{json.at("translation").get<Translation3d>(),
|
|
|
|
|
json.at("rotation").get<Rotation3d>()};
|
|
|
|
|
}
|