json_conversions.cpp
Go to the documentation of this file.
1#include "json_conversions.h"
2
5
6void
7armarx::to_json(nlohmann::json& j, const FramedPose& fp)
8{
9 j = nlohmann::json{{"agent", fp.agent},
10 {"frame", fp.frame},
11 {"qw", fp.orientation->qw},
12 {"qx", fp.orientation->qx},
13 {"qy", fp.orientation->qy},
14 {"qz", fp.orientation->qz},
15 {"x", fp.position->x},
16 {"y", fp.position->y},
17 {"z", fp.position->z}};
18}
19
20void
21armarx::from_json(const nlohmann::json& j, FramedPose& fp)
22{
23 j.at("agent").get_to(fp.agent);
24 j.at("frame").get_to(fp.frame);
25 j.at("qw").get_to(fp.orientation->qw);
26 j.at("qx").get_to(fp.orientation->qx);
27 j.at("qy").get_to(fp.orientation->qy);
28 j.at("qz").get_to(fp.orientation->qz);
29 j.at("x").get_to(fp.position->x);
30 j.at("y").get_to(fp.position->y);
31 j.at("z").get_to(fp.position->z);
32}
33
34void
35armarx::to_json(simox::json::json& j, const Names& value)
36{
37 j["recognized"] = value.recognized;
38 j["spoken"] = value.spoken;
39}
40
41void
42armarx::from_json(const simox::json::json& j, Names& value)
43{
44 j.at("recognized").get_to(value.recognized);
45 j.at("spoken").get_to(value.spoken);
46}
The FramedPose class.
Definition FramedPose.h:281
void from_json(const nlohmann::json &j, Vector2f &value)
void to_json(nlohmann::json &j, const Vector2f &value)