RobotReader.cpp
Go to the documentation of this file.
1#include "RobotReader.h"
2
3#include <chrono>
4#include <mutex>
5#include <optional>
6#include <thread>
7
14
22#include <RobotAPI/libraries/armem_robot_state/aron/Exteroception.aron.generated.h>
23#include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
24#include <RobotAPI/libraries/armem_robot_state/aron/Robot.aron.generated.h>
28
29
30namespace fs = ::std::filesystem;
31
33{
35 properties(r.properties),
36 propertyPrefix(r.propertyPrefix),
37 memoryReader(r.memoryReader),
38 transformReader(r.transformReader)
39 {
40 }
41
42 void
44 {
45 transformReader.registerPropertyDefinitions(def);
46 }
48 void
50 {
51 transformReader.connect(memoryNameSystem);
52
54
55 // Wait for the memory to become available and add it as dependency.
56 ARMARX_INFO << "RobotReader: Waiting for memory '" << constants::memoryName << "' ...";
57 try
58 {
59 // memoryReader = memoryNameSystem.useReader(constants::memoryName);
60 memoryReader = transformReader.getMemoryReader();
61 ARMARX_INFO << "RobotReader: Connected to memory '" << constants::memoryName << "'";
62 }
64 {
65 ARMARX_ERROR << e.what();
66 return;
67 }
68 }
69
70 std::optional<Robot>
71 RobotReader::get(const std::string& name, const armem::Time& timestamp) const
72 {
73 const auto description = queryDescription(name, timestamp);
74
75 if (not description)
76 {
77 ARMARX_ERROR << "Unknown object " << name;
78 return std::nullopt;
79 }
80
81 return get(*description, timestamp);
82 }
83
84 Robot
86 const armem::Time& timestamp) const
87 {
88 Robot robot{.description = description,
89 .instance = "", // TODO(fabian.reister):
90 .config = {}, // will be populated by synchronize
91 .timestamp = timestamp};
92
94
95 return robot;
96 }
97
98 void
100 {
101 syncTimeout = duration;
102 }
103
104 void
110
111 bool
113 {
114 const auto tsStartFunctionInvokation = armem::Time::Now();
115
116 while (true)
117 {
118 auto state = queryState(robot.description.name, timestamp);
119
120 if (not state) /* c++20 [[unlikely]] */
121 {
122 ARMARX_VERBOSE << "Could not synchronize object " << robot.description.name;
123
124 // if the syncTime is non-positive there will be no retry
125 const auto elapsedTime = armem::Time::Now() - tsStartFunctionInvokation;
126 if (elapsedTime > syncTimeout)
127 {
128 ARMARX_VERBOSE << "Could not synchronize object " << robot.description.name;
129 return false;
130 }
131
132 ARMARX_INFO << "Retrying to query robot state after failure";
134 }
135
136 robot.config = std::move(*state);
137 return true;
138 }
139 }
140
141 std::optional<description::RobotDescription>
142 RobotReader::queryDescription(const std::string& name, const armem::Time& timestamp) const
143 {
144
145 const auto sanitizedTimestamp = timestamp.isValid() ? timestamp : Clock::Now();
146
147 // Query all entities from provider.
149
150 // clang-format off
151 qb
154 .entities().all()
155 .snapshots().beforeOrAtTime(sanitizedTimestamp);
156 // clang-format on
157
158 ARMARX_DEBUG << "Lookup query in reader";
159
160 if (not memoryReader)
161 {
162 ARMARX_WARNING << "Memory reader is null. Did you forget to call "
163 "RobotReader::connect() in onConnectComponent()?";
164 return std::nullopt;
165 }
166
167 try
168 {
169 std::scoped_lock l(memoryReaderMutex);
170 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
171
172 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
173
174 if (not qResult.success) /* c++20 [[unlikely]] */
175 {
176 return std::nullopt;
177 }
178
179 return getRobotDescription(qResult.memory, name);
180 }
181 catch (...)
182 {
183 ARMARX_VERBOSE << "Query description failure" << GetHandledExceptionString();
184 }
185
186 return std::nullopt;
187 }
188
189 std::optional<RobotState>
190 RobotReader::queryState(const std::string& robotName, const armem::Time& timestamp) const
191 {
192 std::optional<RobotState> robotState = queryJointState(robotName, timestamp);
193
194 if (robotState)
195 {
196 const auto globalPose = queryGlobalPose(robotName, timestamp);
197 if (not globalPose)
198 {
199 ARMARX_VERBOSE << "Failed to query global pose for robot " << robotName;
200 return std::nullopt;
201 }
202 robotState->globalPose = *globalPose;
203 }
204
205 return robotState;
206 }
207
208 std::optional<RobotState>
209 RobotReader::queryJointState(const std::string& robotName, const armem::Time& timestamp) const
210 {
211 const auto proprioception = queryProprioception(robotName, timestamp);
212
213 if (not proprioception.has_value())
214 {
215 ARMARX_VERBOSE << "Failed to query proprioception for robot '" << robotName << "'.";
216 return std::nullopt;
217 }
218 const auto jointMap = proprioception->joints.position;
219
220 return RobotState{.timestamp = timestamp,
221 .globalPose = RobotState::Pose::Identity(),
222 .jointMap = jointMap,
223 .proprioception = proprioception};
224 }
225
226 std::optional<::armarx::armem::robot_state::localization::Transform>
227 RobotReader::queryOdometryPose(const std::string& robotName, const armem::Time& timestamp) const
228 {
229
231 .header = {.parentFrame = OdometryFrame,
233 .agent = robotName,
234 .timestamp = timestamp}};
235
236 // try
237 {
238 const auto result = transformReader.lookupTransform(query);
239 if (not result)
240 {
241 return std::nullopt;
242 }
243 return result.transform;
244 }
245 // catch (...)
246 // {
247 // ARMARX_VERBOSE << GetHandledExceptionString();
248 // return std::nullopt;
249 // }
250 }
251
252 std::optional<armarx::armem::arondto::Proprioception>
253 RobotReader::queryProprioception(const std::string& robotName,
254 const armem::Time& timestamp) const // Why timestamp?!?!
255 {
256 // TODO(fabian.reister): how to deal with multiple providers?
257
258 // Query all entities from provider.
260
261 ARMARX_DEBUG << "Querying robot description for robot: " << robotName;
262
263 // clang-format off
264 qb
266 .providerSegments().withName(robotName) // agent
267 .entities().all() // TODO
269 // clang-format on
270
271 try
272 {
273 std::scoped_lock l(memoryReaderMutex);
274 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
275
276 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
277
278 if (not qResult.success) /* c++20 [[unlikely]] */
279 {
280 ARMARX_VERBOSE << qResult.errorMessage;
281 return std::nullopt;
282 }
283
284 return getRobotProprioception(qResult.memory, robotName);
285 }
286 catch (...)
287 {
288 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query joint state. Reason: "
290 return std::nullopt;
291 }
292 }
293
295 RobotReader::queryJointStates(const std::string& robotName,
296 const armem::Time& begin,
297 const armem::Time& end) const
298 {
300
301 ARMARX_DEBUG << "Querying robot joint states for robot: `" << robotName
302 << "` on time interval [" << begin << "," << end << "]";
303
304 // clang-format off
305 qb
307 .providerSegments().withName(robotName) // agent
308 .entities().all() // TODO
309 .snapshots().timeRange(begin, end);
310 // clang-format on
311
312 try
313 {
314 std::scoped_lock l(memoryReaderMutex);
315 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
316
317 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
318
319 if (not qResult.success) /* c++20 [[unlikely]] */
320 {
321 ARMARX_VERBOSE << qResult.errorMessage;
322 return {};
323 }
324
325 return getRobotJointStates(qResult.memory, robotName);
326 }
327 catch (...)
328 {
329 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query joint states. Reason: "
331 return {};
332 }
333 }
334
335 std::optional<PlatformState>
336 RobotReader::queryPlatformState(const std::string& robotName,
337 const armem::Time& timestamp) const
338 {
339 // TODO(fabian.reister): how to deal with multiple providers?
340
341 // Query all entities from provider.
343
344 ARMARX_DEBUG << "Querying robot description for robot: " << robotName;
345
346 // clang-format off
347 qb
349 .providerSegments().withName(robotName) // agent
350 .entities().all() // TODO
352 // clang-format on
353
354 try
355 {
356 std::scoped_lock l(memoryReaderMutex);
357 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
358
359 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
360
361 if (not qResult.success) /* c++20 [[unlikely]] */
362 {
363 ARMARX_VERBOSE << qResult.errorMessage;
364 return std::nullopt;
365 }
366
367 return getRobotPlatformState(qResult.memory, robotName);
368 }
369 catch (...)
370 {
371 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query platform state. Reason: "
373 return std::nullopt;
374 }
375 }
376
377 std::optional<RobotState::Pose>
378 RobotReader::queryGlobalPose(const std::string& robotName, const armem::Time& timestamp) const
379 {
380 try
381 {
382 const auto result =
383 transformReader.getGlobalPose(robotName, constants::robotRootNodeName, timestamp);
384 if (not result)
385 {
386 return std::nullopt;
387 }
388
389 return result.transform.transform;
390 }
391 catch (...)
392 {
393 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query global pose. Reason: "
395 return std::nullopt;
396 }
397 }
398
399 std::optional<RobotState>
400 RobotReader::getRobotState(const armarx::armem::wm::Memory& memory,
401 const std::string& name) const
402 {
403 // clang-format off
404 const armem::wm::ProviderSegment& providerSegment = memory
406 .getProviderSegment(name);
407
408 // TODO entitiesToRobotState()
409
410 if (providerSegment.empty())
411 {
412 ARMARX_VERBOSE << "No entity found";
413 return std::nullopt;
414 }
415
416 // clang-format on
417
418 const armem::wm::EntityInstance* instance = nullptr;
419 providerSegment.forEachInstance(
420 [&instance](const wm::EntityInstance& i)
421 {
422 instance = &i;
423 return false; // break
424 });
425
426 if (instance == nullptr)
427 {
428 ARMARX_VERBOSE << "No entity snapshots found";
429 return std::nullopt;
430 }
431
432 // Here, we access the RobotUnit streaming data stored in the proprioception segment.
433 return convertRobotState(*instance);
434 }
435
436 // FIXME remove this, use armem/util/util.h
437 template <typename AronClass>
438 std::optional<AronClass>
440 {
441 static_assert(std::is_base_of<armarx::aron::codegenerator::cpp::AronGeneratedClass,
442 AronClass>::value);
443
444 try
445 {
446 return AronClass::FromAron(item.data());
447 }
449 {
450 return std::nullopt;
451 }
452 }
453
454 std::optional<armarx::armem::arondto::Proprioception>
455 RobotReader::getRobotProprioception(const armarx::armem::wm::Memory& memory,
456 const std::string& name) const
457 {
458 // clang-format off
459 const armem::wm::CoreSegment& coreSegment = memory
461 // clang-format on
462
463 std::optional<armarx::armem::arondto::Proprioception> proprioception;
464
465 coreSegment.forEachEntity(
466 [&proprioception](const wm::Entity& entity)
467 {
468 if (not entity.getLatestSnapshot().hasInstance(0))
469 {
470 return;
471 }
472
473 const auto& entityInstance = entity.getLatestSnapshot().getInstance(0);
474
475 proprioception = tryCast<::armarx::armem::arondto::Proprioception>(entityInstance);
476 });
477
478 return proprioception;
479 }
480
482 RobotReader::getRobotJointStates(const armarx::armem::wm::Memory& memory,
483 const std::string& name) const
484 {
485
486 RobotReader::JointTrajectory jointTrajectory;
487
488 // clang-format off
489 const armem::wm::CoreSegment& coreSegment = memory
491 // clang-format on
492
493 coreSegment.forEachEntity(
494 [&jointTrajectory](const wm::Entity& entity)
495 {
496 entity.forEachSnapshot(
497 [&](const auto& snapshot)
498 {
499 if (not snapshot.hasInstance(0))
500 {
501 return;
502 }
503
504 const auto& entityInstance = snapshot.getInstance(0);
505
506 const auto proprioception =
508 ARMARX_CHECK(proprioception.has_value());
509
510 const armarx::armem::prop::arondto::Joints& joints = proprioception->joints;
511
512 jointTrajectory.emplace(entityInstance.id().timestamp, joints.position);
513 });
514 });
515
516 ARMARX_INFO << "Joint trajectory with " << jointTrajectory.size() << " elements";
517
518 return jointTrajectory;
519 }
520
521 // force torque for left and right
522 std::optional<std::map<RobotReader::Hand, proprioception::ForceTorque>>
523 RobotReader::queryForceTorque(const std::string& robotName, const armem::Time& timestamp) const
524 {
525
526 // Query all entities from provider.
528
529 ARMARX_DEBUG << "Querying force torques description for robot: " << robotName;
530
531 // clang-format off
532 qb
534 .providerSegments().withName(robotName) // agent
535 .entities().all() // TODO
537 // clang-format on
538
539 try
540 {
541 std::scoped_lock l(memoryReaderMutex);
542 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
543
544 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
545
546 if (not qResult.success) /* c++20 [[unlikely]] */
547 {
548 ARMARX_VERBOSE << qResult.errorMessage;
549 return std::nullopt;
550 }
551
552 return getForceTorque(qResult.memory, robotName);
553 }
554 catch (...)
555 {
556 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query force torque. Reason: "
558 return std::nullopt;
559 }
560 }
561
562 // force torque for left and right
563 std::optional<std::map<RobotReader::Hand, std::map<armem::Time, proprioception::ForceTorque>>>
564 RobotReader::queryForceTorques(const std::string& robotName,
565 const armem::Time& start,
566 const armem::Time& end) const
567 {
568
569 // Query all entities from provider.
571
572 ARMARX_DEBUG << "Querying force torques description for robot: " << robotName;
573
574 // clang-format off
575 qb
577 .providerSegments().withName(robotName) // agent
578 .entities().all() // TODO
579 .snapshots().timeRange(start, end);
580 // clang-format on
581
582 try
583 {
584 std::scoped_lock l(memoryReaderMutex);
585 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
586
587 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
588
589 if (not qResult.success) /* c++20 [[unlikely]] */
590 {
591 ARMARX_VERBOSE << qResult.errorMessage;
592 return std::nullopt;
593 }
594
595 return getForceTorques(qResult.memory, robotName);
596 }
597 catch (...)
598 {
599 ARMARX_VERBOSE << deactivateSpam(1) << "Failed to query force torques. Reason: "
601 return std::nullopt;
602 }
603 }
604
605 std::optional<std::map<RobotReader::Hand, exteroception::ToF>>
606 RobotReader::queryToF(const std::string& robotName, const armem::Time& timestamp) const
607 {
608 // Query all entities from provider.
610
611 ARMARX_DEBUG << "Querying ToF data for robot: " << robotName;
612
613 // clang-format off
614 qb
616 .providerSegments().withName(robotName) // agent
617 .entities().all() // TODO
619 // clang-format on
620
621 try
622 {
623 std::scoped_lock l(memoryReaderMutex);
624 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
625
626 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
627
628 if (not qResult.success) /* c++20 [[unlikely]] */
629 {
630 ARMARX_VERBOSE << qResult.errorMessage;
631 return std::nullopt;
632 }
633
634 return getToF(qResult.memory, robotName);
635 }
636 catch (...)
637 {
639 << "Failed to query ToF. Reason: " << GetHandledExceptionString();
640 return std::nullopt;
641 }
642 }
643
644 std::optional<PlatformState>
645 RobotReader::getRobotPlatformState(const armarx::armem::wm::Memory& memory,
646 const std::string& name) const
647 {
648 std::optional<PlatformState> platformState;
649
650 // clang-format off
651 const armem::wm::CoreSegment& coreSegment = memory
653 // clang-format on
654
655 coreSegment.forEachEntity(
656 [&platformState](const wm::Entity& entity)
657 {
658 if (not entity.getLatestSnapshot().hasInstance(0))
659 {
660 return;
661 }
662
663 const auto& entityInstance = entity.getLatestSnapshot().getInstance(0);
664
665 const auto proprioception =
667 ARMARX_CHECK(proprioception.has_value());
668
669 platformState = PlatformState(); // initialize optional
670 fromAron(proprioception->platform, platformState.value());
671 });
672
673 return platformState;
674 }
675
676 inline RobotReader::Hand
677 fromHandName(const std::string& name)
678 {
679 if (name == "Left")
680 {
682 }
683
684 if (name == "Right")
685 {
687 }
688
689 throw LocalException("Unknown hand name `" + name + "`!");
690 }
691
692 std::map<RobotReader::Hand, proprioception::ForceTorque>
693 RobotReader::getForceTorque(const armarx::armem::wm::Memory& memory,
694 const std::string& name) const
695 {
696 std::map<RobotReader::Hand, proprioception::ForceTorque> forceTorques;
697
698 // clang-format off
699 const armem::wm::CoreSegment& coreSegment = memory
701 // clang-format on
702
703 coreSegment.forEachEntity(
704 [&forceTorques](const wm::Entity& entity)
705 {
706 if (not entity.getLatestSnapshot().hasInstance(0))
707 {
708 return;
709 }
710
711 const auto& entityInstance = entity.getLatestSnapshot().getInstance(0);
712
713 const auto proprioception =
715 ARMARX_CHECK(proprioception.has_value());
716
717 for (const auto& [handName, dtoFt] : proprioception->forceTorque)
718 {
719 proprioception::ForceTorque forceTorque;
720 fromAron(dtoFt, forceTorque);
721
722 const auto hand = fromHandName(handName);
723 forceTorques.emplace(hand, forceTorque);
724 }
725 });
726
727 return forceTorques;
728 }
729
730 std::map<RobotReader::Hand, std::map<armem::Time, proprioception::ForceTorque>>
731 RobotReader::getForceTorques(const armarx::armem::wm::Memory& memory,
732 const std::string& name) const
733 {
734 std::map<RobotReader::Hand, std::map<armem::Time, proprioception::ForceTorque>>
735 forceTorques;
736
737 // clang-format off
738 const armem::wm::CoreSegment& coreSegment = memory
740 // clang-format on
741
742 coreSegment.forEachInstance(
743 [&forceTorques](const wm::EntityInstance& entityInstance)
744 {
745 const auto proprioception =
747 ARMARX_CHECK(proprioception.has_value());
748
749
750 for (const auto& [handName, dtoFt] : proprioception->forceTorque)
751 {
752 proprioception::ForceTorque forceTorque;
753 fromAron(dtoFt, forceTorque);
754
755 const auto hand = fromHandName(handName);
756 forceTorques[hand].emplace(entityInstance.id().timestamp, forceTorque);
757 }
758 });
759
760 return forceTorques;
761 }
762
763 std::map<RobotReader::Hand, exteroception::ToF>
764 RobotReader::getToF(const armarx::armem::wm::Memory& memory, const std::string& name) const
765 {
766 std::map<RobotReader::Hand, exteroception::ToF> tofs;
767
768 // clang-format off
769 const armem::wm::CoreSegment& coreSegment = memory
771 // clang-format on
772
773 coreSegment.forEachEntity(
774 [&tofs](const wm::Entity& entity)
775 {
776 ARMARX_DEBUG << "Processing ToF element";
777
778 if (not entity.getLatestSnapshot().hasInstance(0))
779 {
780 return;
781 }
782 const auto& entityInstance = entity.getLatestSnapshot().getInstance(0);
783
784 const auto exteroception =
786 ARMARX_CHECK(exteroception.has_value());
787
788
789 for (const auto& [handName, dtoFt] : exteroception->tof)
790 {
791 ARMARX_DEBUG << "Processing ToF element for hand `" << handName << "`";
792
793 exteroception::ToF tof;
794 fromAron(dtoFt, tof);
795
796 const auto hand = fromHandName(handName);
797 tofs.emplace(hand, tof);
798 }
799 });
800
801 return tofs;
802 }
803
804 std::optional<description::RobotDescription>
805 RobotReader::getRobotDescription(const armarx::armem::wm::Memory& memory,
806 const std::string& name) const
807 {
808 // clang-format off
809 const armem::wm::ProviderSegment& providerSegment = memory
811 .getProviderSegment(name);
812 // clang-format on
813
814 const armem::wm::EntityInstance* instance = nullptr;
815 providerSegment.forEachInstance([&instance](const wm::EntityInstance& i)
816 { instance = &i; });
817 if (instance == nullptr)
818 {
819 ARMARX_VERBOSE << "No entity snapshots found in provider segment `" << name << "`";
820 return std::nullopt;
821 }
822
823 return convertRobotDescription(*instance);
824 }
825
826 std::vector<description::RobotDescription>
827 RobotReader::getRobotDescriptions(const armarx::armem::wm::Memory& memory) const
828 {
829 const armem::wm::CoreSegment& coreSegment =
831
832 std::vector<description::RobotDescription> descriptions;
833
834 coreSegment.forEachInstance(
835 [&descriptions](const wm::EntityInstance& instance)
836 {
837 if (const std::optional<description::RobotDescription> desc =
838 convertRobotDescription(instance))
839 {
840 descriptions.push_back(desc.value());
841 }
842 });
843
844 return descriptions;
845 }
846
847 std::vector<description::RobotDescription>
849 {
850 const auto sanitizedTimestamp = timestamp.isValid() ? timestamp : Clock::Now();
851
852 // Query all entities from provider.
854
855 // clang-format off
856 qb
859 .entities().all()
860 .snapshots().beforeOrAtTime(sanitizedTimestamp);
861 // clang-format on
862
863 ARMARX_DEBUG << "Lookup query in reader";
864
865 if (not memoryReader)
866 {
867 ARMARX_WARNING << "Memory reader is null. Did you forget to call "
868 "RobotReader::connect() in onConnectComponent()?";
869 return {};
870 }
871
872 try
873 {
874 std::scoped_lock l(memoryReaderMutex);
875 const armem::client::QueryResult qResult = memoryReader.query(qb.buildQueryInput());
876
877 ARMARX_DEBUG << "Lookup result in reader: " << qResult;
878
879 if (not qResult.success) /* c++20 [[unlikely]] */
880 {
881 return {};
882 }
883
884 return getRobotDescriptions(qResult.memory);
885 }
886 catch (...)
887 {
888 ARMARX_VERBOSE << "Query description failure" << GetHandledExceptionString();
889 }
890
891 return {};
892 }
893} // namespace armarx::armem::robot_state
std::string timestamp()
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
static DateTime Now()
Current time on the virtual clock.
Definition Clock.cpp:93
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
Definition Clock.cpp:99
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
bool forEachSnapshot(SnapshotFunctionT &&func)
Definition EntityBase.h:391
CoreSegmentT & getCoreSegment(const std::string &name)
Definition MemoryBase.h:134
The memory name system (MNS) client.
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition Builder.h:22
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Definition Builder.cpp:42
CoreSegmentSelector & withName(const std::string &name) override
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition selectors.cpp:92
ProviderSegmentSelector & withName(const std::string &name) override
EntitySelector & entities()
Start specifying entities.
ProviderSegmentSelector & all() override
SnapshotSelector & beforeOrAtTime(Time timestamp)
Definition selectors.cpp:73
SnapshotSelector & timeRange(Time min, Time max)
Definition selectors.cpp:46
Indicates that a query to the Memory Name System failed.
Definition mns.h:25
std::optional< armarx::armem::arondto::Proprioception > queryProprioception(const std::string &robotName, const armem::Time &timestamp) const
std::map< armem::Time, RobotState::JointMap > JointTrajectory
Definition RobotReader.h:76
std::vector< description::RobotDescription > queryDescriptions(const armem::Time &timestamp) const
std::optional<::armarx::armem::robot_state::localization::Transform > queryOdometryPose(const std::string &robotName, const armem::Time &timestamp) const
retrieve the robot's pose in the odometry frame.
virtual void connect(armem::client::MemoryNameSystem &memoryNameSystem)
bool synchronize(Robot &obj, const armem::Time &timestamp) const override
std::optional< RobotState > queryState(const std::string &robotName, const armem::Time &timestamp) const
std::optional< std::map< RobotReader::Hand, std::map< armem::Time, proprioception::ForceTorque > > > queryForceTorques(const std::string &robotName, const armem::Time &start, const armem::Time &end) const
std::optional< std::map< Hand, exteroception::ToF > > queryToF(const std::string &robotName, const armem::Time &timestamp) const
void setSleepAfterSyncFailure(const armem::Duration &duration)
void setSyncTimeout(const armem::Duration &duration)
JointTrajectory queryJointStates(const std::string &robotName, const armem::Time &begin, const armem::Time &end) const
std::optional< description::RobotDescription > queryDescription(const std::string &name, const armem::Time &timestamp) const
std::optional< PlatformState > queryPlatformState(const std::string &robotName, const armem::Time &timestamp) const
std::optional< std::map< Hand, proprioception::ForceTorque > > queryForceTorque(const std::string &robotName, const armem::Time &timestamp) const
std::optional< RobotState > queryJointState(const std::string &robotName, const armem::Time &timestamp) const
virtual void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr &def)
std::optional< RobotState::Pose > queryGlobalPose(const std::string &robotName, const armem::Time &timestamp) const
std::optional< Robot > get(const std::string &name, const armem::Time &timestamp) const override
Client-side working memory core segment.
Client-side working entity instance.
Client-side working memory.
Client-side working memory provider segment.
A base class for aron exceptions.
Definition Exception.h:37
static DateTime Now()
Definition DateTime.cpp:51
std::int64_t toMicroSeconds() const
Returns the amount of microseconds.
Definition Duration.cpp:36
Brief description of class memory.
Definition memory.h:39
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_CHECK_NONNEGATIVE(number)
Check whether number is nonnegative (>= 0).
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
const std::string descriptionCoreSegment
Definition constants.h:28
const std::string proprioceptionCoreSegment
Definition constants.h:30
const std::string exteroceptionCoreSegment
Definition constants.h:31
std::optional< description::RobotDescription > convertRobotDescription(const armem::wm::EntityInstance &instance)
std::optional< RobotState > convertRobotState(const armem::wm::EntityInstance &instance)
void fromAron(const arondto::ObjectInstance &dto, RobotState &bo)
RobotReader::Hand fromHandName(const std::string &name)
std::optional< AronClass > tryCast(const wm::EntityInstance &item)
armem::wm::EntityInstance EntityInstance
armarx::core::time::DateTime Time
armarx::core::time::Duration Duration
aron::cpp::AronGeneratedClass AronGeneratedClass
std::string GetHandledExceptionString()
std::string const OdometryFrame
Definition FramedPose.h:66
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
auto & getLatestSnapshot(int snapshotIndex=0)
Retrieve the latest entity snapshot.
Result of a QueryInput.
Definition Query.h:51
wm::Memory memory
The slice of the memory that matched the query.
Definition Query.h:58
description::RobotDescription description
Definition types.h:128