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

Load names from JSON if available

parent f6314de7
No related branches found
No related tags found
1 merge request!402Add Names to Locations
Pipeline #15985 passed
This commit is part of merge request !402. Comments created here will be created in the context of that merge request.
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <ArmarXCore/core/exceptions/local/ExpressionException.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/logging/Logging.h> #include <ArmarXCore/core/logging/Logging.h>
#include <RobotAPI/libraries/core/json_conversions.h>
namespace armarx::priorknowledge::util namespace armarx::priorknowledge::util
{ {
FramedLocationPtr FramedLocationPtr
...@@ -53,8 +55,18 @@ namespace armarx::priorknowledge::util ...@@ -53,8 +55,18 @@ namespace armarx::priorknowledge::util
pose, pose,
framedPose.at("pose").get<std::vector<std::vector<float>>>()); // load the 4x4 matrix framedPose.at("pose").get<std::vector<std::vector<float>>>()); // load the 4x4 matrix
FramedLocationPtr loc(new FramedLocation( std::optional<Names> names;
LocationId(source, locationName), LocationType::FRAMED_LOCATION, frame, agent, pose)); if (auto it = j.find("names"); it != j.end())
{
it->get_to(names.emplace());
}
FramedLocationPtr loc(new FramedLocation(LocationId(source, locationName),
LocationType::FRAMED_LOCATION,
frame,
agent,
pose,
names));
return loc; return loc;
} }
...@@ -133,7 +145,7 @@ namespace armarx::priorknowledge::util ...@@ -133,7 +145,7 @@ namespace armarx::priorknowledge::util
} }
for (const auto& [locationName, j] : for (const auto& [locationName, j] :
js["locations"].get<std::map<std::string, nlohmann::json>>()) js.at("locations").get<std::map<std::string, nlohmann::json>>())
{ {
if (j.find("framedPose") != j.end()) if (j.find("framedPose") != j.end())
{ {
......
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