2020-12-26 14:12:05 -08: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.
|
2019-07-24 02:57:39 -04:00
|
|
|
|
|
|
|
|
#include "frc/geometry/Rotation2d.h"
|
|
|
|
|
|
2019-11-02 13:35:03 -05:00
|
|
|
#include <wpi/json.h>
|
|
|
|
|
|
|
|
|
|
void frc::to_json(wpi::json& json, const Rotation2d& rotation) {
|
2021-10-25 08:58:12 -07:00
|
|
|
json = wpi::json{{"radians", rotation.Radians().value()}};
|
2019-11-02 13:35:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void frc::from_json(const wpi::json& json, Rotation2d& rotation) {
|
|
|
|
|
rotation = Rotation2d{units::radian_t{json.at("radians").get<double>()}};
|
|
|
|
|
}
|