SegmentAdapter.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::armem_objects::SegmentAdapter
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "SegmentAdapter.h"
24 
30 #include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h>
32 
38 
39 #include <VirtualRobot/Robot.h>
40 
41 #include <SimoxUtility/algorithm/get_map_keys_values.h>
42 
43 
45 {
46 
48  segment(iceMemory)
49  {
50  }
51 
52 
53  std::string SegmentAdapter::getName() const
54  {
55  return Logging::tag.tagName;
56  }
57 
58 
60  {
61  calibration.defineProperties(defs, prefix + "calibration.");
62  segment.defineProperties(defs, prefix);
63  robotHead.defineProperties(defs, prefix + "head.");
64  visu.defineProperties(defs, prefix + "visu.");
65  }
66 
67 
69  {
70  segment.setTag(getName());
71  segment.decay.setTag(getName());
73  robotHead.setTag(getName());
74  visu.setTag(getName());
75 
76  segment.init();
77  }
78 
79 
81  robot_state::VirtualRobotReader* virtualRobotReader,
82  KinematicUnitObserverInterfacePrx kinematicUnitObserver,
83  viz::Client arviz,
84  DebugObserverInterfacePrx debugObserver
85  )
86  {
87  this->debugObserver = debugObserver;
88  this->arviz = arviz;
89 
90  segment.robots.reader = virtualRobotReader;
91 
92  robotHead.kinematicUnitObserver = kinematicUnitObserver;
93  robotHead.debugObserver = debugObserver;
94  robotHead.fetchDatafields();
95 
96  visu.arviz = arviz;
97 
98  if (!visu.updateTask)
99  {
100  visu.updateTask = new SimpleRunningTask<>([this]()
101  {
102  this->visualizeRun();
103  });
104  visu.updateTask->start();
105  }
106 
107  segment.connect(arviz);
108  }
109 
110 
111  void SegmentAdapter::reportProviderAvailable(const std::string& providerName, const objpose::ProviderInfo& info, const Ice::Current&)
112  {
113  updateProviderInfo(providerName, info);
114  }
115 
116 
118  const std::string& providerName, const objpose::data::ProvidedObjectPoseSeq& providedPoses, const Ice::Current&)
119  {
120  ARMARX_VERBOSE << "Received " << providedPoses.size() << " object poses from provider '" << providerName << "'.";
121  updateObjectPoses(providerName, providedPoses);
122  }
123 
124 
125  void SegmentAdapter::updateProviderInfo(const std::string& providerName, const objpose::ProviderInfo& info)
126  {
127  if (!info.proxy)
128  {
129  ARMARX_WARNING << "Received availability signal by provider '" << providerName << "' "
130  << "with invalid provider proxy.\nIgnoring provider '" << providerName << "'.";
131  return;
132  }
133  segment.doLocked([this, &providerName, &info]()
134  {
135  std::stringstream ss;
136  for (const auto& id : info.supportedObjects)
137  {
138  ss << "- " << id << "\n";
139  }
140  ARMARX_VERBOSE << "Provider '" << providerName << "' available.\n"
141  << "Supported objects: \n" << ss.str();
142  segment.providers[providerName] = info;
143  });
144  }
145 
146 
147  void SegmentAdapter::updateObjectPoses(
148  const std::string& providerName,
149  const objpose::data::ProvidedObjectPoseSeq& providedPoses)
150  {
151  TIMING_START(tReportObjectPoses);
152 
153  RobotHeadMovement::Discard discard;
154  {
155  std::scoped_lock lock(robotHeadMutex);
156  discard = robotHead.getDiscard();
157  }
158  if (debugObserver)
159  {
161  map["Discarding All Updates"] = new Variant(discard.all ? 1.f : 0.f);
162  if (discard.all)
163  {
164  map["Proportion Updated Poses"] = new Variant(0.f);
165  }
166  debugObserver->setDebugChannel(getName(), map);
167  }
168 
169  if (discard.all)
170  {
171  return;
172  }
173 
174  segment.doLocked([&]()
175  {
176  const auto timestamp = armarx::Clock::Now();
177 
178  TIMING_START(tCommitObjectPoses);
179  Segment::CommitStats stats =
180  segment.commitObjectPoses(providerName, providedPoses, calibration, discard.updatesUntil);
181  TIMING_END_STREAM(tCommitObjectPoses, ARMARX_VERBOSE);
182 
183  if (debugObserver)
184  {
185  debugObserver->setDebugChannel(getName(),
186  {
187  { "Discarding All Updates", new Variant(discard.all ? 1 : 0) },
188  { "Proportion Updated Poses", new Variant(static_cast<float>(stats.numUpdated) / providedPoses.size()) }
189  });
190  }
191 
192  handleProviderUpdate(providerName);
193 
194  TIMING_END_STREAM(tReportObjectPoses, ARMARX_VERBOSE);
195  if (debugObserver)
196  {
197  debugObserver->setDebugChannel(getName(),
198  {
199  { "t ReportObjectPoses [ms]", new Variant(tReportObjectPoses.toMilliSecondsDouble()) },
200  { "t MemorySetObjectPoses [ms]", new Variant(tCommitObjectPoses.toMilliSecondsDouble()) },
201  });
202  }
203  });
204  }
205 
206 
207  void SegmentAdapter::handleProviderUpdate(const std::string& providerName)
208  {
209  // Initialized to 0 on first access.
210  if (segment.providers.count(providerName) == 0)
211  {
212  segment.providers[providerName] = objpose::ProviderInfo();
213  }
214  }
215 
216 
218  {
219  TIMING_START(tGetObjectPoses);
220 
221  const Time now = Time::Now();
222  const objpose::ObjectPoseSeq objectPoses = segment.doLocked([this, &now]()
223  {
224  return simox::alg::get_values(segment.getObjectPoses(now));
225  });
226  const objpose::data::ObjectPoseSeq result = objpose::toIce(objectPoses);
227 
228  TIMING_END_STREAM(tGetObjectPoses, ARMARX_VERBOSE);
229 
230  if (debugObserver)
231  {
232  debugObserver->setDebugChannel(getName(),
233  {
234  { "t GetObjectPoses() [ms]", new Variant(tGetObjectPoses.toMilliSecondsDouble()) },
235  });
236  }
237 
238  return result;
239  }
240 
241  objpose::data::ObjectPoseSeq SegmentAdapter::getObjectPosesByProvider(const std::string& providerName, const Ice::Current&)
242  {
243  TIMING_START(GetObjectPoses);
244 
245  const Time now = Time::Now();
246  const objpose::ObjectPoseSeq objectPoses = segment.doLocked([this, &now, &providerName]()
247  {
248  return simox::alg::get_values(segment.getObjectPosesByProvider(providerName, now));
249  });
250  const objpose::data::ObjectPoseSeq result = objpose::toIce(objectPoses);
251 
252  TIMING_END_STREAM(GetObjectPoses, ARMARX_VERBOSE);
253 
254  if (debugObserver)
255  {
256  debugObserver->setDebugChannel(getName(),
257  {
258  { "t GetObjectPosesByProvider() [ms]", new Variant(GetObjectPoses.toMilliSecondsDouble()) },
259  });
260  }
261 
262  return result;
263  }
264 
265 
266  objpose::observer::RequestObjectsOutput SegmentAdapter::requestObjects(
267  const objpose::observer::RequestObjectsInput& input, const Ice::Current&)
268  {
269  std::map<std::string, objpose::provider::RequestObjectsInput> providerRequests;
270  std::map<std::string, objpose::ObjectPoseProviderPrx> proxies;
271 
272  objpose::observer::RequestObjectsOutput output;
273 
274  auto updateProxy = [&](const std::string & providerName)
275  {
276  if (proxies.count(providerName) == 0)
277  {
278  if (auto it = segment.providers.find(providerName); it != segment.providers.end())
279  {
280  proxies[providerName] = it->second.proxy;
281  }
282  else
283  {
284  ARMARX_ERROR << "No proxy for provider ' " << providerName << "'.";
285  proxies[providerName] = nullptr;
286  }
287  }
288  };
289 
290  if (input.provider.size() > 0)
291  {
292  providerRequests[input.provider] = input.request;
293  updateProxy(input.provider);
294  }
295  else
296  {
297  segment.doLocked([&]()
298  {
299  for (const auto& objectID : input.request.objectIDs)
300  {
301  bool found = true;
302  for (const auto& [providerName, info] : segment.providers)
303  {
304  // ToDo: optimize look up.
305  if (std::find(info.supportedObjects.begin(), info.supportedObjects.end(), objectID) != info.supportedObjects.end())
306  {
307  providerRequests[providerName].objectIDs.push_back(objectID);
308  updateProxy(providerName);
309  break;
310  }
311  }
312  if (!found)
313  {
314  ARMARX_ERROR << "Did not find a provider for " << objectID << ".";
315  output.results[objectID].providerName = "";
316  }
317  }
318  });
319  }
320 
321  for (const auto& [providerName, request] : providerRequests)
322  {
323  if (objpose::ObjectPoseProviderPrx proxy = proxies.at(providerName); proxy)
324  {
325  ARMARX_INFO << "Requesting " << request.objectIDs.size() << " objects by provider '"
326  << providerName << "' for " << request.relativeTimeoutMS << " ms.";
327  objpose::provider::RequestObjectsOutput providerOutput = proxy->requestObjects(request);
328 
329  int successful = 0;
330  for (const auto& [objectID, result] : providerOutput.results)
331  {
332  objpose::observer::ObjectRequestResult& res = output.results[objectID];
333  res.providerName = providerName;
334  res.result = result;
335  successful += int(result.success);
336  }
337  ARMARX_INFO << successful << " of " << request.objectIDs.size() << " object requests successful.";
338  }
339  }
340  return output;
341  }
342 
343 
344  objpose::ProviderInfoMap SegmentAdapter::getAvailableProvidersInfo(const Ice::Current&)
345  {
346  return segment.doLocked([this]()
347  {
348  return segment.providers;
349  });
350  }
351 
352 
353  Ice::StringSeq SegmentAdapter::getAvailableProviderNames(const Ice::Current&)
354  {
355  return segment.doLocked([this]()
356  {
357  return simox::alg::get_keys(segment.providers);
358  });
359  }
360 
361 
362  objpose::ProviderInfo SegmentAdapter::getProviderInfo(const std::string& providerName, const Ice::Current&)
363  {
364  return segment.doLocked([this, &providerName]()
365  {
366  return segment.getProviderInfo(providerName);
367  });
368  }
369 
370 
371  bool SegmentAdapter::hasProvider(const std::string& providerName, const Ice::Current&)
372  {
373  return segment.doLocked([this, &providerName]()
374  {
375  return segment.providers.count(providerName) > 0;
376  });
377  }
378 
379 
380  objpose::AttachObjectToRobotNodeOutput SegmentAdapter::attachObjectToRobotNode(
381  const objpose::AttachObjectToRobotNodeInput& input, const Ice::Current&)
382  {
383  return segment.doLocked([this, &input]()
384  {
385  return segment.attachObjectToRobotNode(input);
386  });
387  }
388 
389 
390  objpose::DetachObjectFromRobotNodeOutput SegmentAdapter::detachObjectFromRobotNode(
391  const objpose::DetachObjectFromRobotNodeInput& input, const Ice::Current&)
392  {
393  return segment.doLocked([this, &input]()
394  {
395  return segment.detachObjectFromRobotNode(input);
396  });
397  }
398 
399 
400  objpose::DetachAllObjectsFromRobotNodesOutput SegmentAdapter::detachAllObjectsFromRobotNodes(
401  const objpose::DetachAllObjectsFromRobotNodesInput& input, const Ice::Current&)
402  {
403  return segment.doLocked([this, &input]()
404  {
405  return segment.detachAllObjectsFromRobotNodes(input);
406  });
407  }
408 
409 
410  objpose::AgentFramesSeq SegmentAdapter::getAttachableFrames(const Ice::Current&)
411  {
412  return segment.doLocked([this]()
413  {
414  objpose::AgentFramesSeq output;
415  for (const auto& [name, agent] : segment.robots.loaded)
416  {
417  objpose::AgentFrames& frames = output.emplace_back();
418  frames.agent = agent->getName();
419  frames.frames = agent->getRobotNodeNames();
420  }
421  return output;
422  });
423  }
424 
425 
426  objpose::SignalHeadMovementOutput
427  SegmentAdapter::signalHeadMovement(const objpose::SignalHeadMovementInput& input, const Ice::Current&)
428  {
429  std::scoped_lock lock(robotHeadMutex);
430  return robotHead.signalHeadMovement(input);
431  }
432 
433  objpose::ObjectPosePredictionResultSeq
434  SegmentAdapter::predictObjectPoses(const objpose::ObjectPosePredictionRequestSeq& requests,
435  const Ice::Current&)
436  {
437  objpose::ObjectPosePredictionResultSeq results;
438  std::vector<std::map<DateTime, objpose::ObjectPose>> poses;
439  std::vector<objpose::ObjectPose> latestPoses;
440 
441  segment.doLocked(
442  [this, &requests, &results, &poses, &latestPoses]()
443  {
444  for (const auto& request : requests)
445  {
446  auto& result = results.emplace_back();
447  const ObjectID objID = armarx::fromIce(request.objectID);
448 
449  const Duration timeWindow = armarx::fromIce<Duration>(request.timeWindow);
450 
451  const wm::Entity* entity = segment.findObjectEntity(objID);
452  // Use result.success as a marker for whether to continue later
453  result.success = false;
454  poses.emplace_back();
455  latestPoses.emplace_back();
456  if (!entity)
457  {
458  std::stringstream sstream;
459  sstream << "Could not find object with ID " << objID << ".";
460  result.errorMessage = sstream.str();
461  continue;
462  }
463 
464  const auto dto = entity->findLatestInstanceDataAs<arondto::ObjectInstance>();
465  if (!dto)
466  {
467  std::stringstream sstream;
468  sstream << "No snapshots of the object " << objID << " were found."
469  << " Cannot make a prediction.";
470  result.errorMessage = sstream.str();
471  continue;
472  }
473 
474  result.success = true;
475  poses.back() = segment.getObjectPosesInRange(
476  *entity, Time::Now() - timeWindow, Time::Invalid());
477  latestPoses.back() = aron::fromAron<objpose::ObjectPose>(dto.value().pose);
478  }
479  });
480 
481  for (size_t i = 0; i < requests.size(); ++i)
482  {
483  const objpose::ObjectPosePredictionRequest& request = requests.at(i);
484  objpose::ObjectPosePredictionResult& result = results.at(i);
485 
486  if (result.success)
487  {
488  armem::PredictionSettings settings =
489  armem::PredictionSettings::fromIce(request.settings);
490 
491  if (settings.predictionEngineID.empty()
492  or settings.predictionEngineID == linearPredictionEngineID)
493  {
495  poses.at(i),
496  armarx::fromIce<DateTime>(request.timestamp),
497  latestPoses.at(i));
498  }
499  else
500  {
501  result.errorMessage = "Prediction engine '" + settings.predictionEngineID +
502  "' not available for object pose prediction.";
503  result.success = false;
504  }
505  }
506  }
507  return results;
508  }
509 
510  armem::prediction::data::PredictionEngineSeq
511  SegmentAdapter::getAvailableObjectPoseEngines(const Ice::Current&)
512  {
513  return armarx::toIce<armem::prediction::data::PredictionEngineSeq>(predictionEngines);
514  }
515 
516  void
517  SegmentAdapter::visualizeRun()
518  {
519  ObjectFinder objectFinder;
520 
521  CycleUtil cycle(static_cast<int>(1000 / visu.frequencyHz));
522  while (visu.updateTask && !visu.updateTask->isStopped())
523  {
524  {
525  std::scoped_lock lock(visuMutex);
526 
527  if (visu.enabled)
528  {
529  TIMING_START(tVisu);
530 
531  objpose::ObjectPoseMap objectPoses;
532  std::map<ObjectID, std::map<DateTime, objpose::ObjectPose>> poseHistories;
533  visu.minConfidence = -1;
534 
535  segment.doLocked([this, &objectPoses, &poseHistories, &objectFinder]()
536  {
537  const Time now = Time::Now();
538 
539  // Also include decayed objects in result
540  // Store original setting.
541  const float minConf = segment.decay.removeObjectsBelowConfidence;
542  segment.decay.removeObjectsBelowConfidence = -1;
543  // Get result.
544  objectPoses = segment.getObjectPoses(now);
545  // Restore original setting.
546  segment.decay.removeObjectsBelowConfidence = minConf;
547 
548  objectFinder = segment.objectFinder;
549  if (segment.decay.enabled)
550  {
551  visu.minConfidence = segment.decay.removeObjectsBelowConfidence;
552  }
553 
554  // Get histories.
555  for (const auto& [id, objectPose] : objectPoses)
556  {
557  const wm::Entity* entity = segment.findObjectEntity(id);
558  if (entity != nullptr)
559  {
560  poseHistories[id] = instance::Segment::getObjectPosesInRange(
561  *entity,
563  visu.linearPredictions.timeWindowSeconds),
564  Time::Invalid());
565  }
566  }
567  });
568 
569  const std::vector<viz::Layer> layers =
570  visu.visualizeCommit(objectPoses, poseHistories, objectFinder);
571  arviz.commit(layers);
572 
573 
575 
576  if (debugObserver)
577  {
578  armarx::StringVariantBaseMap debugValues;
579  debugValues["t Visualize [ms]"] = new Variant(tVisu.toMilliSecondsDouble());
580  for (const auto& [id, pose] : objectPoses)
581  {
582  debugValues["confidence(" + id.str() + ")"] = new Variant(pose.confidence);
583  }
584  debugObserver->setDebugChannel(getName(), debugValues);
585  }
586  }
587  }
588  cycle.waitForCycleDuration();
589  }
590  }
591 
592 
593  const std::string SegmentAdapter::linearPredictionEngineID = "Linear Position Regression";
594  const std::vector<PredictionEngine> SegmentAdapter::predictionEngines{{linearPredictionEngineID}};
595 
596 
597  void SegmentAdapter::RemoteGui::setup(const SegmentAdapter& adapter)
598  {
599  using namespace armarx::RemoteGui::Client;
600 
601  this->visu.setup(adapter.visu);
602  this->segment.setup(adapter.segment);
603  this->decay.setup(adapter.segment.decay);
604  this->robotHead.setup(adapter.robotHead);
605 
606  layout = VBoxLayout
607  {
608  this->visu.group, this->segment.group, this->decay.group, this->robotHead.group,
609  VSpacer()
610  };
611 
612  group = {};
613  group.setLabel("Instance");
614  group.addChild(layout);
615  }
616 
617 
619  {
620  // Non-atomic variables need to be guarded by a mutex if accessed by multiple threads
621  {
622  std::scoped_lock lock(adapter.visuMutex);
623  this->visu.update(adapter.visu);
624  }
625  this->segment.update(adapter.segment);
626  {
627  adapter.segment.doLocked([this, &adapter]()
628  {
629  this->decay.update(adapter.segment.decay);
630  });
631  }
632  {
633  std::scoped_lock lock(adapter.robotHeadMutex);
634  this->robotHead.update(adapter.robotHead);
635  }
636  }
637 
638 }
armarx::SimpleRunningTask
Usage:
Definition: TaskUtil.h:70
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
RemoteRobot.h
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::armem::server::obj::instance::Segment::getObjectPoses
objpose::ObjectPoseMap getObjectPoses(const DateTime &now)
Definition: Segment.cpp:486
TIMING_START
#define TIMING_START(name)
Definition: TimeUtil.h:280
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:40
ice_conversions.h
armarx::ObjectID
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
Definition: ObjectID.h:11
predictions.h
armarx::armem::server::obj::instance::RobotHeadMovement::getDiscard
Discard getDiscard()
Definition: RobotHeadMovement.cpp:123
armarx::armem::server::obj::instance::Segment::providers
objpose::ProviderInfoMap providers
Definition: Segment.h:180
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::objpose::ObjectPoseSeq
std::vector< ObjectPose > ObjectPoseSeq
Definition: forward_declarations.h:20
armarx::armem::server::obj::instance::SegmentAdapter::getObjectPosesByProvider
virtual objpose::data::ObjectPoseSeq getObjectPosesByProvider(const std::string &providerName, ICE_CURRENT_ARG) override
Definition: SegmentAdapter.cpp:241
armarx::LogTag::tagName
std::string tagName
Definition: LoggingUtil.h:70
armarx::RemoteGui::Client::VBoxLayout
Definition: Widgets.h:167
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
armarx::core::time::DateTime::Now
static DateTime Now()
Definition: DateTime.cpp:55
armarx::armem::server::obj::instance::SegmentAdapter::getName
std::string getName() const
Definition: SegmentAdapter.cpp:53
armarx::armem::PredictionSettings
Definition: Prediction.h:41
armarx::armem::server::obj::instance::SegmentAdapter::init
void init()
Definition: SegmentAdapter.cpp:68
armarx::CycleUtil
This util class helps with keeping a cycle time during a control cycle.
Definition: CycleUtil.h:40
armarx::armem::server::obj::instance::RobotHeadMovement::kinematicUnitObserver
KinematicUnitObserverInterfacePrx kinematicUnitObserver
Definition: RobotHeadMovement.h:60
armarx::armem::server::obj::instance::RobotHeadMovement::fetchDatafields
void fetchDatafields()
Definition: RobotHeadMovement.cpp:21
SegmentAdapter.h
armarx::armem::server::obj::instance::Segment::init
void init() override
Definition: Segment.cpp:163
ice_conversions.h
armarx::armem::server::obj::instance::SegmentAdapter::reportObjectPoses
virtual void reportObjectPoses(const std::string &providerName, const objpose::data::ProvidedObjectPoseSeq &objectPoses, ICE_CURRENT_ARG) override
Definition: SegmentAdapter.cpp:117
aron_conversions.h
armarx::armem::server::wm::Entity
Definition: memory_definitions.h:30
armarx::RemoteGui::Client::VSpacer
Definition: Widgets.h:204
TIMING_END_STREAM
#define TIMING_END_STREAM(name, os)
Definition: TimeUtil.h:300
armarx::armem::server::obj::instance::RobotHeadMovement::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="head.")
Definition: RobotHeadMovement.cpp:11
Clock.h
armarx::armem::server::obj::instance
Definition: ArticulatedObjectVisu.cpp:16
armarx::armem::server::obj::instance::Segment::connect
void connect(viz::Client arviz)
Definition: Segment.cpp:259
armarx::ObjectFinder
Used to find objects in the ArmarX objects repository [1] (formerly [2]).
Definition: ObjectFinder.h:23
armarx::armem::server::obj::instance::Visu::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="visu.")
Definition: Visu.cpp:18
if
if(!yyvaluep)
Definition: Grammar.cpp:724
armarx::armem::server::segment::SpecializedCoreSegment::doLocked
auto doLocked(FunctionT &&function) const
Definition: SpecializedCoreSegment.h:39
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
ObjectID.h
armarx::core::time::Duration::SecondsDouble
static Duration SecondsDouble(double seconds)
Constructs a duration in seconds.
Definition: Duration.cpp:90
armarx::armem::wm::detail::FindInstanceDataMixinForEntity::findLatestInstanceDataAs
std::optional< AronDtoT > findLatestInstanceDataAs(int instanceIndex=0) const
Definition: data_lookup_mixins.h:71
armarx::armem::server::obj::instance::Segment::Calibration::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="calibration.")
Definition: Segment.cpp:52
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::armem::server::obj::instance::Segment::decay
Decay decay
Decay model.
Definition: Segment.h:186
armarx::armem::server::obj::instance::SegmentAdapter::SegmentAdapter
SegmentAdapter(MemoryToIceAdapter &iceMemory)
Definition: SegmentAdapter.cpp:47
armarx::armem::server::obj::instance::Segment::RobotsCache::reader
robot_state::VirtualRobotReader * reader
Definition: Segment.h:168
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::armem::server::obj::instance::Visu::arviz
viz::Client arviz
Definition: Visu.h:73
armarx::objpose::ProvidedObjectPoseSeq
std::vector< ProvidedObjectPose > ProvidedObjectPoseSeq
Definition: forward_declarations.h:25
armarx::fromIce
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:26
armarx::armem::server::obj::instance::SegmentAdapter::getObjectPoses
virtual objpose::data::ObjectPoseSeq getObjectPoses(ICE_CURRENT_ARG) override
Definition: SegmentAdapter.cpp:217
CycleUtil.h
armarx::armem::PredictionSettings::fromIce
static PredictionSettings fromIce(const armem::prediction::data::PredictionSettings &ice)
Definition: Prediction.cpp:44
armarx::armem::server::obj::instance::Segment::getObjectPosesByProvider
objpose::ObjectPoseMap getObjectPosesByProvider(const std::string &providerName, const DateTime &now)
Definition: Segment.cpp:494
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::objpose::toIce
objpose::AABB toIce(const simox::AxisAlignedBoundingBox &aabb)
Definition: ice_conversions.cpp:94
armarx::armem::server::obj::instance::Segment::commitObjectPoses
CommitStats commitObjectPoses(const std::string &providerName, const objpose::data::ProvidedObjectPoseSeq &providedPoses, const Calibration &calibration, std::optional< Time > discardUpdatesUntil=std::nullopt)
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::core::time::Duration
Represents a duration.
Definition: Duration.h:17
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::Logging::tag
LogTag tag
Definition: Logging.h:271
armarx::armem::server::obj::instance::SegmentAdapter
Helps implementing the armarx::armem::server::ObjectInstanceSegmentInterface.
Definition: SegmentAdapter.h:53
armarx::armem::server::obj::instance::SegmentAdapter::reportProviderAvailable
virtual void reportProviderAvailable(const std::string &providerName, const objpose::ProviderInfo &info, ICE_CURRENT_ARG) override
Definition: SegmentAdapter.cpp:111
armarx::core::time::Clock::Now
static DateTime Now()
Current time on the virtual clock.
Definition: Clock.cpp:97
ice_conversions_templates.h
armarx::armem::server::segment::SpecializedCoreSegment::setPredictionEngines
void setPredictionEngines(const std::vector< PredictionEngine > &predictionEngines)
Definition: SpecializedCoreSegment.cpp:87
armarx::Logging::setTag
void setTag(const LogTag &tag)
Definition: Logging.cpp:55
armarx::armem::server::obj::instance::Visu::updateTask
SimpleRunningTask ::pointer_type updateTask
Definition: Visu.h:110
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::viz::Client
Definition: Client.h:109
armarx::RemoteGui::Client
Definition: EigenWidgets.cpp:8
armarx::armem::server::obj::instance::Segment::robots
RobotsCache robots
Definition: Segment.h:177
armarx::armem::server::obj::instance::Segment::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition: Segment.cpp:106
Variant.h
aron_conversions.h
armarx::armem::server::obj::instance::SegmentAdapter::requestObjects
virtual objpose::observer::RequestObjectsOutput requestObjects(const objpose::observer::RequestObjectsInput &input, ICE_CURRENT_ARG) override
Definition: SegmentAdapter.cpp:266
armarx::core::time::DateTime::Invalid
static DateTime Invalid()
Definition: DateTime.cpp:60
armarx::armem::server::obj::instance::SegmentAdapter::predictionEngines
static const std::vector< PredictionEngine > predictionEngines
Definition: SegmentAdapter.h:136
armarx::armem::server::obj::instance::SegmentAdapter::connect
void connect(robot_state::VirtualRobotReader *virtualRobotReader, KinematicUnitObserverInterfacePrx kinematicUnitObserver, viz::Client arviz, DebugObserverInterfacePrx debugObserver)
Definition: SegmentAdapter.cpp:80
armarx::objpose::predictObjectPoseLinear
objpose::ObjectPosePredictionResult predictObjectPoseLinear(const std::map< DateTime, ObjectPose > &poses, const DateTime &time, const ObjectPose &latestPose)
Predict the pose of an object given a history of poses based on a linear regression.
Definition: predictions.cpp:37
armarx::armem::server::obj::instance::RobotHeadMovement::debugObserver
DebugObserverInterfacePrx debugObserver
Definition: RobotHeadMovement.h:64
armarx::ObjectID::str
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
Definition: ObjectID.cpp:55
armarx::armem::server::obj::instance::SegmentAdapter::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="")
Definition: SegmentAdapter.cpp:59
armarx::armem::PredictionSettings::predictionEngineID
std::string predictionEngineID
Definition: Prediction.h:43
armarx::armem::server::obj::instance::Segment::getObjectPosesInRange
static std::map< DateTime, ObjectPose > getObjectPosesInRange(const wm::Entity &entity, const DateTime &start, const DateTime &end)
Definition: Segment.cpp:766
armarx::objpose::ObjectPoseMap
std::map< ObjectID, ObjectPose > ObjectPoseMap
Definition: forward_declarations.h:21