diff --git a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp index d6966d179fa408ca925f63d28b96dca76ea669f7..6fe11f3196b211677110b31dd697a3eb4f055d5d 100644 --- a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp +++ b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp @@ -33,20 +33,18 @@ #include <RobotAPI/libraries/armem/core/Prediction.h> #include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h> #include <RobotAPI/libraries/armem_objects/aron/Marker.aron.generated.h> +#include <RobotAPI/libraries/armem_objects/memory_ids.h> namespace armarx::armem::server::obj { - const std::string ObjectMemory::defaultMemoryName = "Object"; - - armarx::PropertyDefinitionsPtr ObjectMemory::createPropertyDefinitions() { armarx::PropertyDefinitionsPtr defs(new ComponentPropertyDefinitions(getConfigIdentifier())); const std::string prefix = "mem."; - workingMemory().name() = defaultMemoryName; + workingMemory().name() = objects::memoryID.memoryName; classSegment.defineProperties(defs, prefix + "cls."); instance::SegmentAdapter::defineProperties(defs, prefix + "inst."); diff --git a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.h b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.h index 869beea33f6878cc7dde20db9a03bd352e870fd7..566d1fec8a6ea1fe39f12edabbaaaa76b08ea9e0 100644 --- a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.h +++ b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.h @@ -22,8 +22,8 @@ #pragma once -#include "RobotAPI/libraries/armem/client/plugins/ReaderWriterPlugin.h" -#include "RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.h" +#include <RobotAPI/libraries/armem/client/plugins/ReaderWriterPlugin.h> +#include <RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.h> #include <RobotAPI/libraries/armem_objects/server/class/Segment.h> #include <RobotAPI/libraries/armem_objects/server/instance/SegmentAdapter.h> #include <RobotAPI/libraries/armem_objects/server/attachments/Segment.h> @@ -66,11 +66,6 @@ namespace armarx::armem::server::obj , virtual public armarx::LightweightRemoteGuiComponentPluginUser , virtual public armarx::ArVizComponentPluginUser { - public: - - static const std::string defaultMemoryName; - - public: ObjectMemory(); diff --git a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp index 8233df3d685339da7f43c134e588a21324a8ec79..e3f006eaf4a554d13705868eaf812955b2fcfb12 100644 --- a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp +++ b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp @@ -21,13 +21,14 @@ */ #include "RobotStateMemory.h" -#include "RobotAPI/libraries/armem/core/forward_declarations.h" +#include <RobotAPI/libraries/armem/core/forward_declarations.h> #include <RobotAPI/interface/core/PoseBase.h> #include <RobotAPI/libraries/core/Pose.h> #include <RobotAPI/libraries/armem/core/Prediction.h> #include <RobotAPI/libraries/armem_robot_state/server/proprioception/aron_conversions.h> #include <RobotAPI/libraries/armem_robot_state/server/common/Visu.h> +#include <RobotAPI/libraries/armem_robot_state/memory_ids.h> #include <RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h> @@ -82,7 +83,7 @@ namespace armarx::armem::server::robot_state const std::string prefix = "mem."; - setMemoryName("RobotState"); + setMemoryName(armem::robot_state::memoryID.memoryName); descriptionSegment.defineProperties(defs, prefix + "desc."); proprioceptionSegment.defineProperties(defs, prefix + "prop."); diff --git a/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.cpp b/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.cpp index 132f0b639df824fe91a3b6bd9f25427f50950d7d..bd0e2d4c957a53562996fad7e7f2b64b1851a2e6 100644 --- a/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.cpp +++ b/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.cpp @@ -26,6 +26,8 @@ #include <RobotAPI/gui-plugins/PlatformUnitPlugin/ui_PlatformUnitConfigDialog.h> #include <ArmarXCore/core/system/ArmarXDataPath.h> +#include <Eigen/Geometry> + // Qt headers #include <Qt> #include <QtGlobal> @@ -35,6 +37,8 @@ #include <QHBoxLayout> //std +#include <RobotAPI/interface/core/RobotLocalization.h> +#include <SimoxUtility/math/convert/mat3f_to_rpy.h> #include <memory> #include <cmath> @@ -86,8 +90,8 @@ PlatformUnitWidget::PlatformUnitWidget() : void PlatformUnitWidget::onInitComponent() { usingProxy(platformUnitProxyName); - usingTopic(platformName + "State"); - ARMARX_INFO << "Listening on Topic: " << platformName + "State"; + usingTopic(globalRobotPoseLocalizationListenerName); + // ARMARX_INFO << "Listening on Topic: " << platformName + "State"; } @@ -177,7 +181,6 @@ void PlatformUnitWidget::setNewPlatformPoseLabels(float x, float y, float alpha) ui.labelCurrentPositionX->setText(QString::number(x)); ui.labelCurrentPositionY->setText(QString::number(y)); ui.labelCurrentRotation->setText(QString::number(alpha)); - } @@ -203,26 +206,16 @@ void PlatformUnitWidget::stopControlTimer() } -void PlatformUnitWidget::reportPlatformPose(PlatformPose const& currentPose, const Ice::Current& c) +void PlatformUnitWidget::reportGlobalRobotPose(const ::armarx::TransformStamped& transformStamped, const ::Ice::Current&) { - // moved to qt thread for thread safety - QMetaObject::invokeMethod(this, "setNewPlatformPoseLabels", Q_ARG(float, currentPose.x), Q_ARG(float, currentPose.y), Q_ARG(float, currentPose.rotationAroundZ)); - platformRotation = currentPose.rotationAroundZ; -} + const Eigen::Isometry3f global_T_robot(transformStamped.transform); + const float x = global_T_robot.translation().x(); + const float y = global_T_robot.translation().y(); + const float yaw = simox::math::mat3f_to_rpy(global_T_robot.linear()).z(); - -void PlatformUnitWidget::reportNewTargetPose(::Ice::Float newPlatformPositionX, ::Ice::Float newPlatformPositionY, ::Ice::Float newPlatformRotation, const Ice::Current& c) -{ // moved to qt thread for thread safety - QMetaObject::invokeMethod(this, "setNewTargetPoseLabels", - Q_ARG(float, newPlatformPositionX), - Q_ARG(float, newPlatformPositionY), - Q_ARG(float, newPlatformRotation)); -} - -void PlatformUnitWidget::reportPlatformVelocity(::Ice::Float currentPlatformVelocityX, ::Ice::Float currentPlatformVelocityY, ::Ice::Float currentPlatformVelocityRotation, const Ice::Current& c) -{ - + QMetaObject::invokeMethod(this, "setNewPlatformPoseLabels", Q_ARG(float, x), Q_ARG(float, y), Q_ARG(float, yaw)); + platformRotation = yaw; } @@ -396,9 +389,3 @@ void KeyboardPlatformHookWidget::keyReleaseEvent(QKeyEvent* event) } QWidget::keyReleaseEvent(event); } - - -void armarx::PlatformUnitWidget::reportPlatformOdometryPose(Ice::Float, Ice::Float, Ice::Float, const Ice::Current&) -{ - // ignore for now -} diff --git a/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.h b/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.h index aeb8e8ce8f414bac77ec83e9e9237679b76873c8..7587750d212e51f88666dffcf236556370b432c3 100644 --- a/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.h +++ b/source/RobotAPI/gui-plugins/PlatformUnitPlugin/PlatformUnitGuiPlugin.h @@ -30,6 +30,7 @@ #include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h> #include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h> +#include <RobotAPI/interface/core/RobotLocalization.h> #include <RobotAPI/interface/units/PlatformUnitInterface.h> /* Qt headers */ @@ -101,7 +102,7 @@ namespace armarx */ class PlatformUnitWidget : public ArmarXComponentWidgetControllerTemplate<PlatformUnitWidget>, - public PlatformUnitListener + public GlobalRobotPoseLocalizationListener { Q_OBJECT public: @@ -116,11 +117,8 @@ namespace armarx void onExitComponent() override; // slice interface implementation - void reportPlatformPose(PlatformPose const& currentPose, const Ice::Current& c = Ice::emptyCurrent) override; - void reportNewTargetPose(::Ice::Float newPlatformPositionX, ::Ice::Float newPlatformPositionY, ::Ice::Float newPlatformRotation, const Ice::Current& c = Ice::emptyCurrent) override; - void reportPlatformVelocity(::Ice::Float currentPlatformVelocityX, ::Ice::Float currentPlatformVelocityY, ::Ice::Float currentPlatformVelocityRotation, const Ice::Current& c = Ice::emptyCurrent) override; - void reportPlatformOdometryPose(Ice::Float, Ice::Float, Ice::Float, const Ice::Current&) override; - + void reportGlobalRobotPose(const ::armarx::TransformStamped& transformStamped, const ::Ice::Current& = ::Ice::emptyCurrent) override; + // inherited of ArmarXWidget static QString GetWidgetName() { @@ -228,4 +226,3 @@ namespace armarx }; using PlatformUnitGuiPluginPtr = std::shared_ptr<PlatformUnitWidget>; } - diff --git a/source/RobotAPI/libraries/armem_objects/CMakeLists.txt b/source/RobotAPI/libraries/armem_objects/CMakeLists.txt index 7265e46d24e5e046e55a7e01365018d725c167c7..63da8444d40d90e6c4e73a1a4fd755082f4914f9 100644 --- a/source/RobotAPI/libraries/armem_objects/CMakeLists.txt +++ b/source/RobotAPI/libraries/armem_objects/CMakeLists.txt @@ -20,6 +20,9 @@ armarx_add_library( HEADERS aron_conversions.h aron_forward_declarations.h + memory_ids.h + types.h + utils.h server/class/FloorVis.h server/class/Segment.h @@ -48,7 +51,9 @@ armarx_add_library( SOURCES aron_conversions.cpp + memory_ids.cpp types.cpp + utils.cpp client/articulated_object/Reader.cpp client/articulated_object/Writer.cpp diff --git a/source/RobotAPI/libraries/armem_objects/memory_ids.cpp b/source/RobotAPI/libraries/armem_objects/memory_ids.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad77419a2e5d3288aefae77a038cca62808e81dd --- /dev/null +++ b/source/RobotAPI/libraries/armem_objects/memory_ids.cpp @@ -0,0 +1,35 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_objects + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "memory_ids.h" + + +namespace armarx::armem +{ + + const MemoryID objects::memoryID { "Object" }; + + const MemoryID objects::attachmentsSegmentID = memoryID.withCoreSegmentName("Attachments"); + const MemoryID objects::classSegmentID = memoryID.withCoreSegmentName("Class"); + const MemoryID objects::instaceSegmentID = memoryID.withCoreSegmentName("Instance"); + +} diff --git a/source/RobotAPI/libraries/armem_objects/memory_ids.h b/source/RobotAPI/libraries/armem_objects/memory_ids.h new file mode 100644 index 0000000000000000000000000000000000000000..50408b82f550fe2ecf80b4cc5d4930ee9b69b012 --- /dev/null +++ b/source/RobotAPI/libraries/armem_objects/memory_ids.h @@ -0,0 +1,38 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_objects + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +#include <RobotAPI/libraries/armem/core/MemoryID.h> + + +namespace armarx::armem::objects +{ + + extern const MemoryID memoryID; + + extern const MemoryID attachmentsSegmentID; + extern const MemoryID classSegmentID; + extern const MemoryID instaceSegmentID; + + +} // namespace armarx::armem::objects diff --git a/source/RobotAPI/libraries/armem_objects/server/attachments/Segment.h b/source/RobotAPI/libraries/armem_objects/server/attachments/Segment.h index 4f8cd20ccd9a0ce456bb664f5f5eb8a25f1981e0..9f4636fa9484d8c9d4fdd4d0a825442f06340637 100644 --- a/source/RobotAPI/libraries/armem_objects/server/attachments/Segment.h +++ b/source/RobotAPI/libraries/armem_objects/server/attachments/Segment.h @@ -25,6 +25,7 @@ #include <RobotAPI/libraries/armem/core/forward_declarations.h> #include <RobotAPI/libraries/armem/server/forward_declarations.h> #include <RobotAPI/libraries/armem_objects/types.h> +#include <RobotAPI/libraries/armem_objects/memory_ids.h> #include <ArmarXCore/core/application/properties/forward_declarations.h> #include <ArmarXCore/core/logging/Logging.h> @@ -57,7 +58,7 @@ namespace armarx::armem::server::obj::attachments struct Properties { - std::string coreSegmentName = "Attachments"; + std::string coreSegmentName = objects::attachmentsSegmentID.coreSegmentName; int64_t maxHistorySize = -1; }; Properties p; diff --git a/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp b/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp index 3250a1cca34d47df08e4d9218c0bfeda729163b0..a95e98d011e52c7f6251a2119b66b971b9d5a045 100644 --- a/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp +++ b/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp @@ -5,6 +5,7 @@ #include <RobotAPI/libraries/ArmarXObjects/aron_conversions.h> #include <RobotAPI/libraries/armem/server/MemoryToIceAdapter.h> #include <RobotAPI/libraries/armem_objects/aron_conversions.h> +#include <RobotAPI/libraries/armem_objects/memory_ids.h> #include <RobotAPI/libraries/armem_objects/aron/ObjectClass.aron.generated.h> #include <ArmarXCore/core/application/properties/PropertyDefinitionContainer.h> @@ -22,7 +23,7 @@ namespace armarx::armem::server::obj::clazz { Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) : - SpecializedCoreSegment(memoryToIceAdapter, "Class", arondto::ObjectClass::ToAronType(), -1) + SpecializedCoreSegment(memoryToIceAdapter, objects::classSegmentID.coreSegmentName, arondto::ObjectClass::ToAronType(), -1) { } diff --git a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp index 9076cedadf778bb46f64f2c90388ff8d197436e7..7f3aee34f4d6382fd08eb466116b62a803293b80 100644 --- a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp +++ b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp @@ -6,6 +6,7 @@ #include <RobotAPI/libraries/armem_objects/aron/ObjectClass.aron.generated.h> #include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h> #include <RobotAPI/libraries/armem_objects/aron_conversions.h> +#include <RobotAPI/libraries/armem_objects/memory_ids.h> #include <RobotAPI/libraries/armem/core/aron_conversions.h> #include <RobotAPI/libraries/armem/core/error.h> @@ -15,6 +16,7 @@ #include <RobotAPI/libraries/armem/server/MemoryToIceAdapter.h> #include <RobotAPI/libraries/armem/util/util.h> + #include <RobotAPI/libraries/aron/common/aron_conversions.h> #include <RobotAPI/libraries/ArmarXObjects/ObjectFinder.h> @@ -51,7 +53,7 @@ namespace armarx::armem::server::obj::instance Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) : SpecializedCoreSegment(memoryToIceAdapter, - "Instance", + objects::instaceSegmentID.coreSegmentName, arondto::ObjectInstance::ToAronType(), 64) { diff --git a/source/RobotAPI/libraries/armem_objects/utils.cpp b/source/RobotAPI/libraries/armem_objects/utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3025f5264ebcbc5a50de330cb229f792b6f421f --- /dev/null +++ b/source/RobotAPI/libraries/armem_objects/utils.cpp @@ -0,0 +1,45 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_objects + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "utils.h" + +#include <RobotAPI/libraries/ArmarXObjects/ObjectPose.h> +#include <RobotAPI/libraries/armem/core/MemoryID.h> +#include <RobotAPI/libraries/armem_objects/memory_ids.h> + + +namespace armarx::armem +{ + + MemoryID + objects::reconstructObjectInstanceID(const objpose::ObjectPose& objectPose) + { + armem::MemoryID id = + armem::objects::instaceSegmentID.withProviderSegmentName(objectPose.providerName) + .withEntityName(objectPose.objectID.str()) + .withTimestamp(objectPose.timestamp) + .withInstanceIndex(0); + return id; + } + + +} // namespace armarx::armem diff --git a/source/RobotAPI/libraries/armem_objects/utils.h b/source/RobotAPI/libraries/armem_objects/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..bc0068234ac8c55d4985d25ab17fab8040c987d7 --- /dev/null +++ b/source/RobotAPI/libraries/armem_objects/utils.h @@ -0,0 +1,36 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_objects + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +#include <RobotAPI/libraries/armem/core/forward_declarations.h> +#include <RobotAPI/libraries/ArmarXObjects/forward_declarations.h> + + +namespace armarx::armem::objects +{ + + armem::MemoryID + reconstructObjectInstanceID(const objpose::ObjectPose& objectPose); + + +} // namespace armarx::armem::objects diff --git a/source/RobotAPI/libraries/armem_robot_state/CMakeLists.txt b/source/RobotAPI/libraries/armem_robot_state/CMakeLists.txt index aafe0978d9d41e95b51dfabfe49d33783e2791ea..a9c0ceb1b8cd552915819a052a2ffd73bbfdec29 100644 --- a/source/RobotAPI/libraries/armem_robot_state/CMakeLists.txt +++ b/source/RobotAPI/libraries/armem_robot_state/CMakeLists.txt @@ -38,6 +38,7 @@ armarx_add_library( client/localization/TransformWriter.h aron_conversions.h + memory_ids.h utils.h SOURCES @@ -52,6 +53,7 @@ armarx_add_library( client/localization/TransformWriter.cpp aron_conversions.cpp + memory_ids.cpp utils.cpp ) diff --git a/source/RobotAPI/libraries/armem_robot_state/memory_ids.cpp b/source/RobotAPI/libraries/armem_robot_state/memory_ids.cpp new file mode 100644 index 0000000000000000000000000000000000000000..926c2e843e252efdc9c4711bbe2b03a3a7394bba --- /dev/null +++ b/source/RobotAPI/libraries/armem_robot_state/memory_ids.cpp @@ -0,0 +1,36 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_robot_state + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "memory_ids.h" + + +namespace armarx::armem +{ + + const MemoryID robot_state::memoryID { "RobotState" }; + + const MemoryID robot_state::descriptionSegmentID { memoryID.withCoreSegmentName("Description") }; + const MemoryID robot_state::proprioceptionSegmentID { memoryID.withCoreSegmentName("Proprioception") }; + const MemoryID robot_state::localizationSegmentID { memoryID.withCoreSegmentName("Localization") }; + + +} diff --git a/source/RobotAPI/libraries/armem_robot_state/memory_ids.h b/source/RobotAPI/libraries/armem_robot_state/memory_ids.h new file mode 100644 index 0000000000000000000000000000000000000000..1d8008d4db8d7a71da0a8ca47420040060382ca6 --- /dev/null +++ b/source/RobotAPI/libraries/armem_robot_state/memory_ids.h @@ -0,0 +1,37 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::armem_robot_state + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2022 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +#include <RobotAPI/libraries/armem/core/MemoryID.h> + + +namespace armarx::armem::robot_state +{ + + extern const MemoryID memoryID; + + extern const MemoryID descriptionSegmentID; + extern const MemoryID proprioceptionSegmentID; + extern const MemoryID localizationSegmentID; + +} // namespace armarx::armem::objects diff --git a/source/RobotAPI/libraries/armem_robot_state/server/description/Segment.cpp b/source/RobotAPI/libraries/armem_robot_state/server/description/Segment.cpp index f6cba1d8c22086497f7eb537c6a3e16fa2e2faf4..ec68b26342c527923fc997d94d53796e968e1083 100644 --- a/source/RobotAPI/libraries/armem_robot_state/server/description/Segment.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/server/description/Segment.cpp @@ -20,13 +20,14 @@ #include <RobotAPI/libraries/armem_robot/aron_conversions.h> #include <RobotAPI/libraries/armem_robot/robot_conversions.h> #include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h> +#include <RobotAPI/libraries/armem_robot_state/memory_ids.h> namespace armarx::armem::server::robot_state::description { Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) : - Base(memoryToIceAdapter, "Description", arondto::RobotDescription::ToAronType()) + Base(memoryToIceAdapter, armem::robot_state::descriptionSegmentID.coreSegmentName, arondto::RobotDescription::ToAronType()) { } diff --git a/source/RobotAPI/libraries/armem_robot_state/server/localization/Segment.cpp b/source/RobotAPI/libraries/armem_robot_state/server/localization/Segment.cpp index c41908c9ac35ca17519e4c7400eb04903791699b..3cadfeccb0a86bd6672dd1af8fc072086dca4fa4 100644 --- a/source/RobotAPI/libraries/armem_robot_state/server/localization/Segment.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/server/localization/Segment.cpp @@ -27,13 +27,14 @@ #include <RobotAPI/libraries/armem_robot_state/common/localization/TransformHelper.h> #include <RobotAPI/libraries/armem_robot_state/common/localization/types.h> #include <RobotAPI/libraries/armem_robot_state/client/common/constants.h> +#include <RobotAPI/libraries/armem_robot_state/memory_ids.h> namespace armarx::armem::server::robot_state::localization { Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) : - Base(memoryToIceAdapter, "Localization", arondto::Transform::ToAronType(), 1024) + Base(memoryToIceAdapter, armem::robot_state::localizationSegmentID.coreSegmentName, arondto::Transform::ToAronType(), 1024) { } diff --git a/source/RobotAPI/libraries/armem_robot_state/server/proprioception/Segment.cpp b/source/RobotAPI/libraries/armem_robot_state/server/proprioception/Segment.cpp index 3351772f3344698e006c06a92b86dcaff0868801..99c330e7661d35c5b161c26e1d18b45af2d91ce9 100644 --- a/source/RobotAPI/libraries/armem_robot_state/server/proprioception/Segment.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/server/proprioception/Segment.cpp @@ -13,6 +13,7 @@ #include <RobotAPI/libraries/armem/core/MemoryID.h> #include <RobotAPI/libraries/armem/util/prediction_helpers.h> #include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h> +#include <RobotAPI/libraries/armem_robot_state/memory_ids.h> namespace armarx::armem::server::robot_state::proprioception @@ -20,7 +21,7 @@ namespace armarx::armem::server::robot_state::proprioception Segment::Segment(armem::server::MemoryToIceAdapter& memoryToIceAdapter) : Base(memoryToIceAdapter, - "Proprioception", + armem::robot_state::proprioceptionSegmentID.coreSegmentName, arondto::Proprioception::ToAronType(), 1024) {