diff --git a/source/RobotAPI/libraries/PriorKnowledge/util/LocationLoader/LocationLoader.cpp b/source/RobotAPI/libraries/PriorKnowledge/util/LocationLoader/LocationLoader.cpp index cfeb43db57231ff85188667c60773c6d0e30390c..ebde885d2ffcd0128385815954e0b2b5b2ecf9b3 100644 --- a/source/RobotAPI/libraries/PriorKnowledge/util/LocationLoader/LocationLoader.cpp +++ b/source/RobotAPI/libraries/PriorKnowledge/util/LocationLoader/LocationLoader.cpp @@ -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()) {