mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
16 lines
589 B
C++
16 lines
589 B
C++
// 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 "wpi/math/geometry/Rotation2d.hpp"
|
|
|
|
#include "wpi/util/json.hpp"
|
|
|
|
void wpi::math::to_json(wpi::util::json& json, const Rotation2d& rotation) {
|
|
json = wpi::util::json::object("radians", rotation.Radians().value());
|
|
}
|
|
|
|
void wpi::math::from_json(const wpi::util::json& json, Rotation2d& rotation) {
|
|
rotation = Rotation2d{wpi::units::radian_t{json.at("radians").get_number()}};
|
|
}
|