ObjectPoseProviderExample.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::ObjectPoseProviderExample
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <mutex>
26 
28 
29 #include <ArmarXCore/interface/observers/ObserverInterface.h>
31 // #include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>
32 
33 // Include the ProviderPlugin
36 
38 
39 
40 namespace armarx
41 {
42 
43  /**
44  * @defgroup Component-ObjectPoseProviderExample ObjectPoseProviderExample
45  * @ingroup RobotAPI-Components
46  * A description of the component ObjectPoseProviderExample.
47  *
48  * @class ObjectPoseProviderExample
49  * @ingroup Component-ObjectPoseProviderExample
50  * @brief Brief description of class ObjectPoseProviderExample.
51  *
52  * Detailed description of class ObjectPoseProviderExample.
53  */
55  virtual public armarx::Component
56  // Derive from the provider plugin.
58  {
59  public:
60 
61  /// @see armarx::ManagedIceObject::getDefaultName()
62  std::string getDefaultName() const override;
63 
64 
65  // Implement the ObjectPoseProvider interface
66  public:
67  objpose::ProviderInfo getProviderInfo(const Ice::Current& = Ice::emptyCurrent) override;
68  objpose::provider::RequestObjectsOutput requestObjects(const objpose::provider::RequestObjectsInput& input, const Ice::Current&) override;
69 
70 
71  protected:
72 
73  /// @see PropertyUser::createPropertyDefinitions()
75 
76  /// @see armarx::ManagedIceObject::onInitComponent()
77  void onInitComponent() override;
78 
79  /// @see armarx::ManagedIceObject::onConnectComponent()
80  void onConnectComponent() override;
81 
82  /// @see armarx::ManagedIceObject::onDisconnectComponent()
83  void onDisconnectComponent() override;
84 
85  /// @see armarx::ManagedIceObject::onExitComponent()
86  void onExitComponent() override;
87 
88 
89  private:
90 
91  void poseEstimationTaskRun();
92 
93 
94  private:
95 
96  // To be moved to plugin
97  std::mutex requestedObjectsMutex;
98  objpose::RequestedObjects requestedObjects;
99 
100 
101  objpose::ProviderInfo providerInfo;
102 
103  armarx::ObjectFinder objectFinder;
104  std::vector<std::string> initialObjectIDs = { "KIT/Amicelli", "KIT/YellowSaltCylinder" };
105  bool singleShot = false;
106 
107 
109 
110  /// Debug observer. Used to visualize e.g. time series.
111  armarx::DebugObserverInterfacePrx debugObserver;
112 
113  };
114 }
armarx::ObjectPoseProviderExample::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ObjectPoseProviderExample.cpp:39
ObjectPoseProviderPlugin.h
armarx::ObjectPoseProviderExample::requestObjects
objpose::provider::RequestObjectsOutput requestObjects(const objpose::provider::RequestObjectsInput &input, const Ice::Current &) override
Definition: ObjectPoseProviderExample.cpp:98
armarx::ObjectPoseProviderExample::onExitComponent
void onExitComponent() override
Definition: ObjectPoseProviderExample.cpp:89
armarx::ObjectPoseProviderExample
Brief description of class ObjectPoseProviderExample.
Definition: ObjectPoseProviderExample.h:54
armarx::ObjectPoseProviderPluginUser
Provides an objpose::ObjectPoseTopicPrx objectPoseTopic as member variable.
Definition: ObjectPoseProviderPlugin.h:43
armarx::ObjectFinder
Used to find objects in the ArmarX objects repository [1] (formerly [2]).
Definition: ObjectFinder.h:23
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::ObjectPoseProviderExample::onConnectComponent
void onConnectComponent() override
Definition: ObjectPoseProviderExample.cpp:76
TaskUtil.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ObjectPoseProviderExample::getDefaultName
std::string getDefaultName() const override
Definition: ObjectPoseProviderExample.cpp:53
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
RequestedObjects.h
armarx::ObjectPoseProviderExample::onDisconnectComponent
void onDisconnectComponent() override
Definition: ObjectPoseProviderExample.cpp:85
armarx::objpose::RequestedObjects
Handles requests for object pose estimation from the ObjectPoseProviderInterface.
Definition: RequestedObjects.h:18
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ObjectPoseProviderExample::getProviderInfo
objpose::ProviderInfo getProviderInfo(const Ice::Current &=Ice::emptyCurrent) override
Definition: ObjectPoseProviderExample.cpp:93
armarx::ObjectPoseProviderExample::onInitComponent
void onInitComponent() override
Definition: ObjectPoseProviderExample.cpp:58
ObjectFinder.h