Skip to content
Snippets Groups Projects
Commit 4918d7c2 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add isStatic to Scene

parent 2e88ba08
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@ namespace armarx::objects
Eigen::Vector3f position = Eigen::Vector3f::Zero();
Eigen::Quaternionf orientation = Eigen::Quaternionf::Identity();
std::optional<bool> isStatic;
std::map<std::string, float> jointValues;
ObjectID getClassID() const;
......
......@@ -79,31 +79,51 @@ void armarx::objpose::from_json(const nlohmann::json& j, ObjectPose& op)
void armarx::objects::to_json(nlohmann::json& j, const SceneObject& rhs)
{
// j["instanceID"] = rhs.instanceID;
j["class"] = rhs.className;
j["instanceName"] = rhs.instanceName;
j["collection"] = rhs.collection;
j["position"] = rhs.position;
j["orientation"] = rhs.orientation;
if (rhs.isStatic.has_value())
{
j["isStatic"] = rhs.isStatic.value();
}
j["jointValues"] = rhs.jointValues;
}
void armarx::objects::from_json(const nlohmann::json& j, SceneObject& rhs)
{
// j.at("instanceID").get_to(rhs.instanceID);
j.at("class").get_to(rhs.className);
if (j.count("instanceName"))
{
j["instanceName"].get_to(rhs.instanceName);
}
else
{
rhs.instanceName.clear();
}
j.at("collection").get_to(rhs.collection);
j.at("position").get_to(rhs.position);
j.at("orientation").get_to(rhs.orientation);
if (j.count("isStatic"))
{
rhs.isStatic = j.at("isStatic").get<bool>();
}
else
{
rhs.isStatic = std::nullopt;
}
if (j.count("jointValues"))
{
j.at("jointValues").get_to(rhs.jointValues);
}
else
{
rhs.jointValues.clear();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment