Segment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <experimental/memory>
4 #include <map>
5 #include <string>
6 
7 #include <SimoxUtility/caching/CacheMap.h>
8 #include <SimoxUtility/shapes/OrientedBox.h>
9 
11 
14 #include <RobotAPI/interface/core/RobotState.h>
15 #include <RobotAPI/interface/objectpose/ObjectPoseStorageInterface.h>
23 #include <RobotAPI/libraries/armem_objects/aron/FamiliarObjectInstance.aron.generated.h>
24 
25 #include "Decay.h"
26 
27 namespace armarx::armem::arondto
28 {
29  class ObjectInstance;
30 }
31 
33 {
34 
36  {
37  public:
38  struct CommitStats
39  {
40  int numUpdated = 0;
41  };
42 
45  using ObjectPoseMap = std::map<ObjectID, ObjectPose>;
46 
47  struct Calibration
48  {
49  std::string robotName = "";
50  std::string robotNode = "Neck_2_Pitch";
51  float offset = 0.0f;
52 
54  const std::string& prefix = "calibration.");
55  };
56 
57 
58  public:
60  virtual ~Segment() override;
61 
62 
64  const std::string& prefix = "") override;
65  void init() override;
66  void connect(viz::Client arviz);
67 
68  void commit(const std::vector<armarx::armem::arondto::FamiliarObjectInstance>&
69  familiarObjectInstances,
70  const std::string& providerName);
71 
72 
73  std::vector<armarx::armem::arondto::FamiliarObjectInstance>
74  getFamiliarObjects(const DateTime& now);
75 
76  std::map<std::string, std::vector<armarx::armem::arondto::FamiliarObjectInstance>>
78 
79  private:
80  friend struct DetachVisitor;
81 
82 
83  public:
84  /// Loaded robot models identified by the robot name.
85  struct RobotsCache : public armarx::Logging
86  {
88  std::string fallbackName;
89 
90  std::map<std::string, VirtualRobot::RobotPtr> loaded;
91 
92  VirtualRobot::RobotPtr get(const std::string& robotName,
93  const std::string& providerName = "");
94  };
95 
97 
98 
99  objpose::ProviderInfoMap providers;
100 
101 
103 
104  /// Decay model.
106 
107 
108  private:
109  struct Properties
110  {
111  };
112 
113  Properties p;
114 
115 
116  static const std::string timestampPlaceholder;
117  };
118 
119 } // namespace armarx::armem::server::obj::familiar_object_instance
armarx::armem::server::obj::familiar_object_instance::Decay
Models decay of object localizations by decreasing the confidence the longer the object was not local...
Definition: Decay.h:18
Client.h
armarx::armem::server::obj::familiar_object_instance::Segment::getFamiliarObjects
std::vector< armarx::armem::arondto::FamiliarObjectInstance > getFamiliarObjects(const DateTime &now)
Definition: Segment.cpp:146
SpecializedSegment.h
armarx::armem::server::obj::familiar_object_instance::Segment::getFamiliarObjectsByProvider
std::map< std::string, std::vector< armarx::armem::arondto::FamiliarObjectInstance > > getFamiliarObjectsByProvider(const DateTime &now)
Definition: Segment.cpp:170
armarx::armem::server::obj::familiar_object_instance::Segment::init
void init() override
Definition: Segment.cpp:93
armarx::armem::server::obj::familiar_object_instance::Segment::Segment
Segment(server::MemoryToIceAdapter &iceMemory)
Definition: Segment.cpp:65
armarx::armem::server::segment::SpecializedCoreSegment
A base class for core segments.
Definition: SpecializedCoreSegment.h:19
armarx::objpose::ObjectPoseSeq
std::vector< ObjectPose > ObjectPoseSeq
Definition: forward_declarations.h:20
armarx::armem::server::obj::familiar_object_instance::Segment::ObjectPoseSeq
objpose::ObjectPoseSeq ObjectPoseSeq
Definition: Segment.h:44
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
armarx::armem::server::obj::familiar_object_instance::Segment::DetachVisitor
friend struct DetachVisitor
Definition: Segment.h:80
armarx::armem::server::obj::familiar_object_instance::Segment::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition: Segment.cpp:78
Prediction.h
armarx::armem::server::obj::familiar_object_instance::Segment::connect
void connect(viz::Client arviz)
Definition: Segment.cpp:101
std::experimental::fundamentals_v2::observer_ptr
Definition: ManagedIceObject.h:53
armarx::armem::server::obj::familiar_object_instance::Segment::~Segment
virtual ~Segment() override
Definition: Segment.cpp:73
armarx::armem::server::obj::familiar_object_instance::Segment::providers
objpose::ProviderInfoMap providers
Definition: Segment.h:99
Decay.h
armarx::armem::arondto
Definition: aron_conversions.h:17
memory_definitions.h
armarx::ObjectFinder
Used to find objects in the ArmarX objects repository [1] (formerly [2]).
Definition: ObjectFinder.h:22
armarx::armem::server::obj::familiar_object_instance::Segment::RobotsCache::reader
std::experimental::observer_ptr< robot_state::VirtualRobotReader > reader
Definition: Segment.h:87
armarx::armem::server::obj::familiar_object_instance::Segment::Calibration::robotName
std::string robotName
Definition: Segment.h:49
ObjectID.h
armarx::armem::server::obj::familiar_object_instance::Segment::RobotsCache::loaded
std::map< std::string, VirtualRobot::RobotPtr > loaded
Definition: Segment.h:90
armarx::armem::server::obj::familiar_object_instance::Segment::CommitStats
Definition: Segment.h:38
armarx::armem::server::obj::familiar_object_instance::Segment::Calibration::offset
float offset
Definition: Segment.h:51
armarx::armem::server::obj::familiar_object_instance::Segment::Calibration::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="calibration.")
Definition: Segment.cpp:55
ObjectPose.h
VirtualRobotReader.h
armarx::armem::server::obj::familiar_object_instance::Segment::robots
RobotsCache robots
Definition: Segment.h:96
TaskUtil.h
armarx::armem::server::obj::familiar_object_instance::Segment
Definition: Segment.h:35
armarx::armem::server::obj::familiar_object_instance::Segment::RobotsCache
Loaded robot models identified by the robot name.
Definition: Segment.h:85
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
forward_declarations.h
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:239
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition: SpecializedSegment.h:58
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::server::obj::familiar_object_instance::Segment::decay
Decay decay
Decay model.
Definition: Segment.h:105
armarx::armem::server::obj::familiar_object_instance
Definition: Decay.cpp:8
armarx::armem::server::obj::familiar_object_instance::Segment::CommitStats::numUpdated
int numUpdated
Definition: Segment.h:40
armarx::armem::server::obj::familiar_object_instance::Segment::commit
void commit(const std::vector< armarx::armem::arondto::FamiliarObjectInstance > &familiarObjectInstances, const std::string &providerName)
Definition: Segment.cpp:110
armarx::viz::Client
Definition: Client.h:117
armarx::armem::server::obj::familiar_object_instance::Segment::ObjectPoseMap
std::map< ObjectID, ObjectPose > ObjectPoseMap
Definition: Segment.h:45
armarx::armem::server::obj::familiar_object_instance::Segment::objectFinder
ObjectFinder objectFinder
Definition: Segment.h:102
armarx::armem::server::obj::familiar_object_instance::Segment::RobotsCache::fallbackName
std::string fallbackName
Definition: Segment.h:88
armarx::armem::server::obj::familiar_object_instance::Segment::Calibration::robotNode
std::string robotNode
Definition: Segment.h:50
armarx::objpose::ObjectPose
An object pose as stored by the ObjectPoseStorage.
Definition: ObjectPose.h:33
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
ObjectFinder.h
armarx::armem::server::obj::familiar_object_instance::Segment::Calibration
Definition: Segment.h:47
armarx::armem::server::obj::familiar_object_instance::Segment::RobotsCache::get
VirtualRobot::RobotPtr get(const std::string &robotName, const std::string &providerName="")
Definition: Segment.cpp:203