29 #include <SimoxUtility/algorithm/get_map_keys_values.h>
30 #include <VirtualRobot/Robot.h>
49 #include <RobotAPI/libraries/armem_objects/aron/FamiliarObjectInstance.aron.generated.h>
50 #include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h>
92 this->debugObserver = debugObserver;
112 const std::string& providerName,
113 const ::armarx::objpose::ProvidedFamiliarObjectPoseSeq&
data,
124 std::optional<armarx::DateTime> syncTimestamp;
127 const auto convertAndFillFamiliarObjectInstances =
129 -> armarx::armem::arondto::FamiliarObjectInstance
131 auto famObjInstance = armarx::armem::arondto::FamiliarObjectInstance::FromAron(
data);
135 famObjInstance.poseSensFrame.header.frame,
136 famObjInstance.poseSensFrame.header.agent);
142 segment.
robots.
get(famObjInstance.poseSensFrame.header.agent, providerName);
146 if (not syncTimestamp.has_value() or syncTimestamp.value() != famObjInstance.timestamp)
149 segment.
robots.
reader->synchronizeRobot(*robot, famObjInstance.timestamp));
150 syncTimestamp = famObjInstance.timestamp;
155 if (not famObjInstance.poseGlobal.has_value())
157 famObjInstance.poseGlobal.emplace();
158 famObjInstance.poseGlobal->pose = framedPose.
toGlobalEigen(robot);
159 famObjInstance.poseGlobal->header.agent = famObjInstance.poseSensFrame.header.agent;
168 return famObjInstance;
171 std::vector<armarx::armem::arondto::FamiliarObjectInstance> familiarObjectInstances;
172 familiarObjectInstances.reserve(
data.size());
176 std::back_inserter(familiarObjectInstances),
177 convertAndFillFamiliarObjectInstances);
179 segment.
commit(familiarObjectInstances, providerName);
183 SegmentAdapter::handleProviderUpdate(
const std::string& providerName)
186 if (segment.
providers.count(providerName) == 0)
188 segment.
providers[providerName] = objpose::ProviderInfo();
193 SegmentAdapter::visualizeRun()
206 std::scoped_lock lock(visuMutex);
208 const std::map<std::string,
209 std::vector<armarx::armem::arondto::FamiliarObjectInstance>>
210 familiarObjectsByProvider = segment.
doLocked(
214 ARMARX_VERBOSE <<
"Visualizing " << familiarObjectsByProvider.size()
219 metronome.waitForNextTick();