diff --git a/source/RobotAPI/components/units/PlatformUnit.cpp b/source/RobotAPI/components/units/PlatformUnit.cpp index 5f026957d977c4894264f06634d1b8ce036a1bde..7b01dda6b56843a43aed692a840711f91e8b5ff1 100644 --- a/source/RobotAPI/components/units/PlatformUnit.cpp +++ b/source/RobotAPI/components/units/PlatformUnit.cpp @@ -34,26 +34,30 @@ namespace armarx { PropertyDefinitionsPtr PlatformUnit::createPropertyDefinitions() { - armarx::PropertyDefinitionsPtr def = new ComponentPropertyDefinitions(getConfigIdentifier()); + armarx::PropertyDefinitionsPtr def = new PlatformUnitPropertyDefinitions(getConfigIdentifier()); + def->topic(odometryPrx); def->topic(globalPosePrx); - // legacy - // defineOptionalProperty<std::string>("PlatformName", "Platform", "Name of the platform (will publish values on PlatformName + 'State')"); - def->topic(listenerPrx, "PlatformState"); - return def; } void PlatformUnit::onInitComponent() { + std::string platformName = getProperty<std::string>("PlatformName").getValue(); + + listenerChannelName = platformName + "State"; + offeringTopic(listenerChannelName); + this->onInitPlatformUnit(); } void PlatformUnit::onConnectComponent() { + listenerPrx = getTopic<PlatformUnitListenerPrx>(listenerChannelName); + this->onStartPlatformUnit(); } diff --git a/source/RobotAPI/components/units/PlatformUnit.h b/source/RobotAPI/components/units/PlatformUnit.h index 23f5f14fc2b0b842ffc08ba622b2717414528ae3..f8b2335cf86044c8b611921632c028519fac41a6 100644 --- a/source/RobotAPI/components/units/PlatformUnit.h +++ b/source/RobotAPI/components/units/PlatformUnit.h @@ -36,6 +36,21 @@ namespace armarx { + /** + * \class PlatformUnitPropertyDefinitions + * \brief Defines all necessary properties for armarx::PlatformUnit + */ + class PlatformUnitPropertyDefinitions: + public ComponentPropertyDefinitions + { + public: + PlatformUnitPropertyDefinitions(std::string prefix): + ComponentPropertyDefinitions(prefix) + { + defineOptionalProperty<std::string>("PlatformName", "Platform", "Name of the platform (will publish values on PlatformName + 'State')"); + } + }; + /** * \defgroup Component-PlatformUnit PlatformUnit @@ -100,6 +115,8 @@ namespace armarx PropertyDefinitionsPtr createPropertyDefinitions() override; protected: + + std::string listenerChannelName; /** * PlatformUnitListener proxy for publishing state updates */