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
......@@ -6,6 +6,8 @@
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/logging/Logging.h>
#include <RobotAPI/libraries/core/json_conversions.h>
namespace armarx::priorknowledge::util
{
FramedLocationPtr
......@@ -53,8 +55,18 @@ namespace armarx::priorknowledge::util
pose,
framedPose.at("pose").get<std::vector<std::vector<float>>>()); // load the 4x4 matrix
FramedLocationPtr loc(new FramedLocation(
LocationId(source, locationName), LocationType::FRAMED_LOCATION, frame, agent, pose));
std::optional<Names> names;
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;
}
......@@ -133,7 +145,7 @@ namespace armarx::priorknowledge::util
}
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())
{
......
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