13#ifndef __FPSDK_COMMON_TO_JSON_ROS_HPP__
14#define __FPSDK_COMMON_TO_JSON_ROS_HPP__
19#include <nlohmann/json.hpp>
30inline void to_json(nlohmann::json& j,
const Time& m)
32 j = nlohmann::json::object({ {
"sec", m.sec }, {
"nsec", m.nsec } });
39inline void to_json(nlohmann::json& j,
const Header& m)
41 j = nlohmann::json::object({ {
"seq", m.seq }, {
"stamp", m.stamp }, {
"frame_id", m.frame_id } });
46namespace geometry_msgs {
48inline void to_json(nlohmann::json& j,
const Vector3& m)
50 j = nlohmann::json::object({ {
"x", m.x }, {
"y", m.y }, {
"z", m.z } });
55inline void to_json(nlohmann::json& j,
const Point& m)
57 j = nlohmann::json::object({ {
"x", m.x }, {
"y", m.y }, {
"z", m.z } });
62inline void to_json(nlohmann::json& j,
const Quaternion& m)
64 j = nlohmann::json::object({ {
"x", m.x }, {
"y", m.y }, {
"z", m.z }, {
"w", m.w } });
69inline void to_json(nlohmann::json& j,
const Transform& m)
71 j = nlohmann::json::object({
72 {
"translation", m.translation },
73 {
"rotation", m.rotation },
79inline void to_json(nlohmann::json& j,
const TransformStamped& m)
81 j = nlohmann::json::object({
82 {
"header", m.header },
83 {
"child_frame_id", m.child_frame_id },
84 {
"transform", m.transform },
90inline void to_json(nlohmann::json& j,
const Pose& m)
92 j = nlohmann::json::object({
93 {
"position", m.position },
94 {
"orientation", m.orientation },
100inline void to_json(nlohmann::json& j,
const PoseWithCovariance& m)
102 j = nlohmann::json::object({
104 {
"covariance", m.covariance },
110inline void to_json(nlohmann::json& j,
const Twist& m)
112 j = nlohmann::json::object({
113 {
"linear", m.linear },
114 {
"angular", m.angular },
120inline void to_json(nlohmann::json& j,
const TwistWithCovariance& m)
122 j = nlohmann::json::object({
123 {
"twist", m.twist },
124 {
"covariance", m.covariance },
130namespace sensor_msgs {
132inline void to_json(nlohmann::json& j,
const Imu& m)
134 j = nlohmann::json::object({
135 {
"header", m.header },
136 {
"orientation", m.orientation },
137 {
"orientation_covariance", m.orientation_covariance },
138 {
"angular_velocity", m.angular_velocity },
139 {
"linear_acceleration", m.linear_acceleration },
140 {
"linear_acceleration_covariance", m.linear_acceleration_covariance },
146inline void to_json(nlohmann::json& j,
const Temperature& m)
148 j = nlohmann::json::object({
149 {
"header", m.header },
150 {
"temperature", m.temperature },
151 {
"variance", m.variance },
157inline void to_json(nlohmann::json& j,
const Image& m)
159 j = nlohmann::json::object({
160 {
"header", m.header },
161 {
"height", m.height },
162 {
"width", m.width },
163 {
"encoding", m.encoding },
164 {
"is_bigendian", m.is_bigendian },
174inline void to_json(nlohmann::json& j,
const TFMessage& m)
176 j = nlohmann::json::object({
177 {
"transforms", m.transforms },
185inline void to_json(nlohmann::json& j,
const Odometry& m)
187 j = nlohmann::json::object({
188 {
"header", m.header },
189 {
"child_frame_id", m.child_frame_id },
191 {
"twist", m.twist },
Fixposition SDK: ROS1 types and utils.
std::string Base64Enc(const std::vector< uint8_t > &buf)
Encode to base64.
Fixposition SDK: String utilities.
Fixposition SDK: Time utilities.