28 #include <Eigen/Geometry>
38 #include <RobotAPI/interface/core/RobotLocalization.h>
39 #include <RobotAPI/interface/units/LocalizationUnitInterface.h>
40 #include <RobotAPI/interface/units/PlatformUnitInterface.h>
44 #include <RobotComponents/interface/components/LaserScannerSelfLocalisation.h>
46 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
47 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
52 class TransformWriterInterface;
53 class TransformReaderInterface;
61 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
85 [[deprecated(
"This class was moved to armarx::localization_and_mapping. It is kept for ArmarXSimulation but should not be removed after CMake modernization of ArmarXSimulation.")]]
97 void publishSelfLocalization(
const PoseStamped& map_T_robot);
99 [[nodiscard]] std::optional<Eigen::Affine3f> globalPoseFromLongTermMemory()
const;
102 void onInitComponent()
override;
105 void onConnectComponent()
override;
107 void onReconnectComponent();
110 void onDisconnectComponent()
override;
121 virtual Eigen::Isometry3f worldToMapTransform()
const = 0;
123 const std::string& getAgentName() const noexcept;
124 const
std::
string& getRobotRootFrame() const noexcept;
127 armem::robot_state::client::localization::TransformWriterInterface&
128 getTransformWriter() const;
129 const
armem::robot_state::client::localization::TransformReaderInterface&
130 getTransformReader() const;
133 void publishSelfLocalizationOnTopic(const
PoseStamped& map_T_robot);
135 void publishSelfLocalizationToWorkingMemory(const
PoseStamped& map_T_robot);
136 void publishSelfLocalizationToLongtermMemory(const
PoseStamped& map_T_robot);
137 void publishSelfLocalizationToArMem(const
PoseStamped& map_T_robot);
141 void setupWorkingMemory();
142 void setupLongTermMemory();
145 TransformStamped toTransformStamped(const
PoseStamped& poseStamped);
146 armem::robot_state::localization::Transform toTransform(const
PoseStamped& poseStamped);
149 LaserScannerSelfLocalisationListenerPrx reportTopic;
150 GlobalRobotPoseLocalizationListenerPrx globalRobotPoseTopic;
151 GlobalRobotPoseLocalizationCorrectionListenerPrx gobalRobotPoseCorrectionTopic;
154 memoryx::LongtermMemoryInterfacePrx longtermMemory;
155 memoryx::PersistentEntitySegmentBasePrx ltmSelfLocalisationSegment;
156 std::optional<
std::
string> ltmPoseEntityId;
159 memoryx::WorkingMemoryInterfacePrx workingMemory;
160 memoryx::AgentInstancesSegmentBasePrx wmAgentsMemory;
165 LocalizationUnitInterfacePrx localizationUnitPrx;
173 bool updateWorkingMemory =
true;
174 float workingMemoryUpdateFrequency = 50.F;
177 std::string longtermMemoryName =
"LongtermMemory";
178 bool updateLongTermMemory =
true;
179 float longtermMemoryUpdateFrequency = 1.F;
180 bool initialPoseFromLTM =
true;
183 bool updateArMem =
true;
184 float armMemUpdateFrequency = 1000.F;
187 bool useLocalizationUnit =
true;
188 std::string localizationUnitName =
"";
191 std::string agentName;
192 std::string robotRootFrame;
194 std::shared_ptr<VirtualRobot::Robot> robot;
196 armem::client::plugins::ReaderWriterPlugin<armem::robot_state::client::localization::TransformWriter>* transformWriterPlugin =
nullptr;
197 armem::client::plugins::ReaderWriterPlugin<armem::robot_state::client::localization::TransformReader>* transformReaderPlugin =
nullptr;
199 Eigen::Isometry3f global_T_map;
201 std::atomic_bool connected{
false};
203 bool onConnectCalled{
false};