diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/CMakeLists.txt b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CMakeLists.txt index 1292e78fa38178ff7f555aae561465bbb4e27ac6..0be4a3ac9118c131fd48407307c7e371edb2d8e2 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/CMakeLists.txt +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CMakeLists.txt @@ -13,11 +13,25 @@ set(LIB_FILES RobotStateComponentPlugin.cpp DebugDrawerHelperComponentPlugin.cpp ArVizComponentPlugin.cpp + GraspCandidateObserverComponentPlugin.cpp + PlatformUnitComponentPlugin.cpp + RobotUnitComponentPlugin.cpp + RobotUnitObserverComponentPlugin.cpp + KinematicUnitComponentPlugin.cpp + TrajectoryPlayerComponentPlugin.cpp + CartesianPositionControlComponentPlugin.cpp ) set(LIB_HEADERS RobotStateComponentPlugin.h DebugDrawerHelperComponentPlugin.h ArVizComponentPlugin.h + GraspCandidateObserverComponentPlugin.h + PlatformUnitComponentPlugin.h + RobotUnitComponentPlugin.h + RobotUnitObserverComponentPlugin.h + KinematicUnitComponentPlugin.h + TrajectoryPlayerComponentPlugin.h + CartesianPositionControlComponentPlugin.h ) armarx_add_library("${LIB_NAME}" "${LIB_FILES}" "${LIB_HEADERS}" "${LIBS}") diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b403e45ccfea923d1ead7b8e73fa5e7dbcf0de2 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.cpp @@ -0,0 +1,53 @@ +#include "CartesianPositionControlComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void CartesianPositionControlComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void CartesianPositionControlComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_cartesianPositionControl, PROPERTY_NAME); + } + + void CartesianPositionControlComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineRequiredProperty<std::string>( + PROPERTY_NAME, + "Name of the CartesianPositionControl"); + } + } + + CartesianPositionControlInterfacePrx CartesianPositionControlComponentPlugin::getCartesianPositionControl() + { + return _cartesianPositionControl; + } + + + } +} + +namespace armarx +{ + + CartesianPositionControlComponentPluginUser::CartesianPositionControlComponentPluginUser() + { + addPlugin(plugin); + } + + CartesianPositionControlInterfacePrx CartesianPositionControlComponentPluginUser::getCartesianPositionControl() + { + return plugin->getCartesianPositionControl(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..0d53885cc44d3d0d42f4357c6c7b7cf0cfa7db5f --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/CartesianPositionControlComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/components/CartesianPositionControlInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class CartesianPositionControlComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + CartesianPositionControlInterfacePrx getCartesianPositionControl(); + + private: + static constexpr const char* PROPERTY_NAME = "CartesianPositionControlName"; + CartesianPositionControlInterfacePrx _cartesianPositionControl; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use CartesianPositionControl. + */ + class CartesianPositionControlComponentPluginUser : virtual public ManagedIceObject + { + public: + CartesianPositionControlComponentPluginUser(); + CartesianPositionControlInterfacePrx getCartesianPositionControl(); + + private: + armarx::plugins::CartesianPositionControlComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using CartesianPositionControlComponentPluginUser = armarx::CartesianPositionControlComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3e99ccfb4eb2994373380b03415f0e96b39b0e14 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.cpp @@ -0,0 +1,54 @@ +#include "GraspCandidateObserverComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void GraspCandidateObserverComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void GraspCandidateObserverComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_graspCandidateObserver, PROPERTY_NAME); + } + + void GraspCandidateObserverComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineOptionalProperty<std::string>( + PROPERTY_NAME, + "GraspCandidateObserver", + "Name of the GraspCandidateObserver"); + } + } + + grasping::GraspCandidateObserverInterfacePrx GraspCandidateObserverComponentPlugin::getGraspCandidateObserver() + { + return _graspCandidateObserver; + } + + + } +} + +namespace armarx +{ + + GraspCandidateObserverComponentPluginUser::GraspCandidateObserverComponentPluginUser() + { + addPlugin(plugin); + } + + grasping::GraspCandidateObserverInterfacePrx GraspCandidateObserverComponentPluginUser::getGraspCandidateObserver() + { + return plugin->getGraspCandidateObserver(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..e15688a68568b1591ff5aeedfbb6d20337b002a2 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/GraspCandidateObserverComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/observers/GraspCandidateObserverInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class GraspCandidateObserverComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + grasping::GraspCandidateObserverInterfacePrx getGraspCandidateObserver(); + + private: + static constexpr const char* PROPERTY_NAME = "GraspCandidateObserverName"; + grasping::GraspCandidateObserverInterfacePrx _graspCandidateObserver; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use GraspCandidateObserver. + */ + class GraspCandidateObserverComponentPluginUser : virtual public ManagedIceObject + { + public: + GraspCandidateObserverComponentPluginUser(); + grasping::GraspCandidateObserverInterfacePrx getGraspCandidateObserver(); + + private: + armarx::plugins::GraspCandidateObserverComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using GraspCandidateObserverComponentPluginUser = armarx::GraspCandidateObserverComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba8ba16d24d40bbb2312690ef87b4dd9f5619cd5 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.cpp @@ -0,0 +1,56 @@ +#include "KinematicUnitComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void KinematicUnitComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void KinematicUnitComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_kinematicUnit, PROPERTY_NAME); + } + + void KinematicUnitComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineRequiredProperty<std::string>( + PROPERTY_NAME, + "Name of the KinematicUnit"); + } + } + + KinematicUnitInterfacePrx KinematicUnitComponentPlugin::getKinematicUnit() + { + return _kinematicUnit; + } + + + } + +} + +namespace armarx +{ + + KinematicUnitComponentPluginUser::KinematicUnitComponentPluginUser() + { + addPlugin(plugin); + } + + KinematicUnitInterfacePrx KinematicUnitComponentPluginUser::getKinematicUnit() + { + return plugin->getKinematicUnit(); + } + + + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..e3b4062b59500f26314a6ccdb6e5480dd7d34a2b --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/KinematicUnitComponentPlugin.h @@ -0,0 +1,59 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/units/KinematicUnitInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class KinematicUnitComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + KinematicUnitInterfacePrx getKinematicUnit(); + + private: + static constexpr const char* PROPERTY_NAME = "KinematicUnitName"; + KinematicUnitInterfacePrx _kinematicUnit; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use KinematicUnit. + */ + class KinematicUnitComponentPluginUser : virtual public ManagedIceObject + { + public: + KinematicUnitComponentPluginUser(); + KinematicUnitInterfacePrx getKinematicUnit(); + + private: + armarx::plugins::KinematicUnitComponentPlugin* plugin = nullptr; + }; + + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using KinematicUnitComponentPluginUser = armarx::KinematicUnitComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f40b6cd34a5f5a8f028b714cc7a1517d590f2b3c --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.cpp @@ -0,0 +1,53 @@ +#include "PlatformUnitComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void PlatformUnitComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void PlatformUnitComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_platformUnit, PROPERTY_NAME); + } + + void PlatformUnitComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineRequiredProperty<std::string>( + PROPERTY_NAME, + "Name of the PlatformUnit"); + } + } + + PlatformUnitInterfacePrx PlatformUnitComponentPlugin::getPlatformUnit() + { + return _platformUnit; + } + + + } +} + +namespace armarx +{ + + PlatformUnitComponentPluginUser::PlatformUnitComponentPluginUser() + { + addPlugin(plugin); + } + + PlatformUnitInterfacePrx PlatformUnitComponentPluginUser::getPlatformUnit() + { + return plugin->getPlatformUnit(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..d2cec0f45b698f813d12a10920a122efbb63d00b --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/PlatformUnitComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/units/PlatformUnitInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class PlatformUnitComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + PlatformUnitInterfacePrx getPlatformUnit(); + + private: + static constexpr const char* PROPERTY_NAME = "PlatformUnitName"; + PlatformUnitInterfacePrx _platformUnit; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use PlatformUnit. + */ + class PlatformUnitComponentPluginUser : virtual public ManagedIceObject + { + public: + PlatformUnitComponentPluginUser(); + PlatformUnitInterfacePrx getPlatformUnit(); + + private: + armarx::plugins::PlatformUnitComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using PlatformUnitComponentPluginUser = armarx::PlatformUnitComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.cpp index 500ac2a183f124dd6f89dd7dde6e09f88d8881b2..687092e1372a6dee5ce0f7425777f9cd6388591b 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.cpp +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.cpp @@ -130,6 +130,11 @@ namespace armarx::plugins } } + RobotStateComponentInterfacePrx RobotStateComponentPlugin::getRobotStateComponent() + { + return _robotStateComponent; + } + bool RobotStateComponentPlugin::synchronizeLocalClone(const VirtualRobot::RobotPtr& robot) const { return RemoteRobot::synchronizeLocalClone(robot, _robotStateComponent); @@ -295,6 +300,11 @@ namespace armarx getRobotStateComponentPlugin().setRobotRNSAndNode(id, rnsName, nodeName); } + RobotStateComponentInterfacePrx RobotStateComponentPluginUser::getRobotStateComponent() + { + return getRobotStateComponentPlugin().getRobotStateComponent(); + } + bool RobotStateComponentPluginUser::synchronizeLocalClone(const VirtualRobot::RobotPtr& robot) const { return getRobotStateComponentPlugin().synchronizeLocalClone(robot); diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.h index 846de6628fd2b1015f23b017a13e6fbcf9616aae..0f2bb620c9504c00446d268da323d672cb15b500 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.h +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotStateComponentPlugin.h @@ -82,6 +82,8 @@ namespace armarx::plugins VirtualRobot::RobotPtr getRobot(const std::string& id) const; RobotData getRobotData(const std::string& id) const; void setRobotRNSAndNode(const std::string& id, const std::string& rnsName, const std::string& nodeName); + + RobotStateComponentInterfacePrx getRobotStateComponent(); //sync public: bool synchronizeLocalClone(const VirtualRobot::RobotPtr& robot) const; @@ -184,6 +186,9 @@ namespace armarx VirtualRobot::RobotPtr getRobot(const std::string& id) const; RobotStateComponentPlugin::RobotData getRobotData(const std::string& id) const; void setRobotRNSAndNode(const std::string& id, const std::string& rnsName, const std::string& nodeName); + + RobotStateComponentInterfacePrx getRobotStateComponent(); + //sync public: bool synchronizeLocalClone(const VirtualRobot::RobotPtr& robot) const; diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..383de616a6001cd7358a2fd5604c44f7e669ecc6 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.cpp @@ -0,0 +1,53 @@ +#include "RobotUnitComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void RobotUnitComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void RobotUnitComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_robotUnit, PROPERTY_NAME); + } + + void RobotUnitComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineRequiredProperty<std::string>( + PROPERTY_NAME, + "Name of the RobotUnit"); + } + } + + RobotUnitInterfacePrx RobotUnitComponentPlugin::getRobotUnit() + { + return _robotUnit; + } + + + } +} + +namespace armarx +{ + + RobotUnitComponentPluginUser::RobotUnitComponentPluginUser() + { + addPlugin(plugin); + } + + RobotUnitInterfacePrx RobotUnitComponentPluginUser::getRobotUnit() + { + return plugin->getRobotUnit(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..4dc53dcb9fff70332663f1dd4a0211f3fdfd916d --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class RobotUnitComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + RobotUnitInterfacePrx getRobotUnit(); + + private: + static constexpr const char* PROPERTY_NAME = "RobotUnitName"; + RobotUnitInterfacePrx _robotUnit; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use RobotUnit. + */ + class RobotUnitComponentPluginUser : virtual public ManagedIceObject + { + public: + RobotUnitComponentPluginUser(); + RobotUnitInterfacePrx getRobotUnit(); + + private: + armarx::plugins::RobotUnitComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using RobotUnitComponentPluginUser = armarx::RobotUnitComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..284533cf16e62834d85ff33e73d36b158943acef --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.cpp @@ -0,0 +1,54 @@ +#include "RobotUnitObserverComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void RobotUnitObserverComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void RobotUnitObserverComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_robotUnitObserver, PROPERTY_NAME); + } + + void RobotUnitObserverComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineOptionalProperty<std::string>( + PROPERTY_NAME, + "RobotUnitObserver", + "Name of the RobotUnitObserver"); + } + } + + ObserverInterfacePrx RobotUnitObserverComponentPlugin::getRobotUnitObserver() + { + return _robotUnitObserver; + } + + + } +} + +namespace armarx +{ + + RobotUnitObserverComponentPluginUser::RobotUnitObserverComponentPluginUser() + { + addPlugin(plugin); + } + + ObserverInterfacePrx RobotUnitObserverComponentPluginUser::getRobotUnitObserver() + { + return plugin->getRobotUnitObserver(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..0ebeff910700102871aa6229259e05f2efec866d --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/RobotUnitObserverComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/interface/observers/ObserverInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class RobotUnitObserverComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + ObserverInterfacePrx getRobotUnitObserver(); + + private: + static constexpr const char* PROPERTY_NAME = "RobotUnitObserverName"; + ObserverInterfacePrx _robotUnitObserver; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use RobotUnitObserver. + */ + class RobotUnitObserverComponentPluginUser : virtual public ManagedIceObject + { + public: + RobotUnitObserverComponentPluginUser(); + ObserverInterfacePrx getRobotUnitObserver(); + + private: + armarx::plugins::RobotUnitObserverComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using RobotUnitObserverComponentPluginUser = armarx::RobotUnitObserverComponentPluginUser; + } +} diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1de30ae07c9f8218666121c28350f32c1ca1f5dc --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.cpp @@ -0,0 +1,54 @@ +#include "TrajectoryPlayerComponentPlugin.h" + +namespace armarx +{ + namespace plugins + { + + void TrajectoryPlayerComponentPlugin::preOnInitComponent() + { + parent<Component>().usingProxyFromProperty(PROPERTY_NAME); + } + + void TrajectoryPlayerComponentPlugin::preOnConnectComponent() + { + parent<Component>().getProxyFromProperty(_trajectoryPlayer, PROPERTY_NAME); + } + + void TrajectoryPlayerComponentPlugin::postCreatePropertyDefinitions(armarx::PropertyDefinitionsPtr& properties) + { + if (!properties->hasDefinition(PROPERTY_NAME)) + { + properties->defineOptionalProperty<std::string>( + PROPERTY_NAME, + "TrajectoryPlayer", + "Name of the TrajectoryPlayer"); + } + } + + TrajectoryPlayerInterfacePrx TrajectoryPlayerComponentPlugin::getTrajectoryPlayer() + { + return _trajectoryPlayer; + } + + + } +} + +namespace armarx +{ + + TrajectoryPlayerComponentPluginUser::TrajectoryPlayerComponentPluginUser() + { + addPlugin(plugin); + } + + TrajectoryPlayerInterfacePrx TrajectoryPlayerComponentPluginUser::getTrajectoryPlayer() + { + return plugin->getTrajectoryPlayer(); + } + + +} + + diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..3fc52df857f7a7225eacb25103dbd7fa16de4af5 --- /dev/null +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/TrajectoryPlayerComponentPlugin.h @@ -0,0 +1,58 @@ +#pragma once + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/components/TrajectoryPlayerInterface.h> + + +namespace armarx +{ + namespace plugins + { + + class TrajectoryPlayerComponentPlugin : public ComponentPlugin + { + public: + using ComponentPlugin::ComponentPlugin; + + void preOnInitComponent() override; + + void preOnConnectComponent() override; + + void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; + + TrajectoryPlayerInterfacePrx getTrajectoryPlayer(); + + private: + static constexpr const char* PROPERTY_NAME = "TrajectoryPlayerName"; + TrajectoryPlayerInterfacePrx _trajectoryPlayer; + }; + + } +} + +namespace armarx +{ + /** + * @brief Provides a ready-to-use TrajectoryPlayer. + */ + class TrajectoryPlayerComponentPluginUser : virtual public ManagedIceObject + { + public: + TrajectoryPlayerComponentPluginUser(); + TrajectoryPlayerInterfacePrx getTrajectoryPlayer(); + + private: + armarx::plugins::TrajectoryPlayerComponentPlugin* plugin = nullptr; + }; + +} + + +namespace armarx +{ + namespace plugins + { + // Legacy typedef. + using TrajectoryPlayerComponentPluginUser = armarx::TrajectoryPlayerComponentPluginUser; + } +}