WorkingMemoryObjectPoseProvider.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 MemoryX::ArmarXObjects::WorkingMemoryObjectPoseProvider
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 <SimoxUtility/json/json.hpp>
26
29
30#include <RobotAPI/interface/core/RobotState.h>
33
34#include <MemoryX/interface/components/WorkingMemoryInterface.h>
35#include <MemoryX/interface/components/WorkingMemoryObjectPoseProviderInterface.h>
38
39namespace memoryx
40{
41
42
43 struct Config
44 {
45 std::map<std::string, std::string> objectNames;
46 };
47
48 void to_json(nlohmann::json& j, const Config& config);
49 void from_json(const nlohmann::json& j, Config& config);
50
51 /**
52 * @defgroup Component-WorkingMemoryObjectPoseProvider WorkingMemoryObjectPoseProvider
53 * @ingroup MemoryX-Components
54 * A description of the component WorkingMemoryObjectPoseProvider.
55 *
56 * @class WorkingMemoryObjectPoseProvider
57 * @ingroup Component-WorkingMemoryObjectPoseProvider
58 * @brief Brief description of class WorkingMemoryObjectPoseProvider.
59 *
60 * Detailed description of class WorkingMemoryObjectPoseProvider.
61 */
63 virtual public armarx::Component,
64 virtual public memoryx::WorkingMemoryObjectPoseProviderInterface,
66 {
67 public:
68 /// @see armarx::ManagedIceObject::getDefaultName()
69 std::string getDefaultName() const override;
70
71 static std::string GetDefaultName();
72
73
74 // ObjectPoseProvider interface
75 armarx::objpose::ProviderInfo
76 getProviderInfo(const Ice::Current& = Ice::emptyCurrent) override;
77
78 // ObjectToRobotNodeAttachmentInterface interface
79 void attachObjectToRobotNode(const AttachObjectToRobotNodeInput& attachment,
80 const Ice::Current&) override;
81 void detachObjectFromRobotNode(const DetachObjectFromRobotNodeInput& detachment,
82 const Ice::Current&) override;
83
84
85 protected:
86 /// @see armarx::ManagedIceObject::onInitComponent()
87 void onInitComponent() override;
88
89 /// @see armarx::ManagedIceObject::onConnectComponent()
90 void onConnectComponent() override;
91
92 /// @see armarx::ManagedIceObject::onDisconnectComponent()
93 void onDisconnectComponent() override;
94
95 /// @see armarx::ManagedIceObject::onExitComponent()
96 void onExitComponent() override;
97
98 /// @see PropertyUser::createPropertyDefinitions()
100
101
102 private:
103 void provideObjectInstancesPoses();
104 void provideObjectInstancesPoses(const std::vector<ObjectInstancePtr>& objectInstances);
105
106 armarx::objpose::ProvidedObjectPose toProvidedObjectPose(const ObjectInstancePtr& instance);
107
108
109 private:
110 memoryx::PriorKnowledgeInterfacePrx priorKnowledge;
111 memoryx::WorkingMemoryInterfacePrx workingMemory;
112 armarx::RobotStateComponentInterfacePrx robotStateComponent;
113
114 ObjectClassSegmentWrapper objectClassSegment;
115
116
117 float updateFrequency = 50;
119
120 Config config;
121 std::string loadObjectDatasetsStr = "";
122 std::string configFile = "MemoryX/WorkingMemoryObjectPoseProvider/config.json";
123
124 std::mutex mutex;
126 };
127} // namespace memoryx
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Provides an objpose::ObjectPoseTopicPrx objectPoseTopic as member variable.
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
An object pose provided by an ObjectPoseProvider.
This class can be used to visualize object instances from working memory to ArViz.
Brief description of class WorkingMemoryObjectPoseProvider.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void attachObjectToRobotNode(const AttachObjectToRobotNodeInput &attachment, const Ice::Current &) override
void detachObjectFromRobotNode(const DetachObjectFromRobotNodeInput &detachment, const Ice::Current &) override
armarx::objpose::ProviderInfo getProviderInfo(const Ice::Current &=Ice::emptyCurrent) override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
VirtualRobot headers.
void from_json(const nlohmann::json &j, Config &config)
IceInternal::Handle< ObjectInstance > ObjectInstancePtr
void to_json(nlohmann::json &j, const Config &config)
std::map< std::string, std::string > objectNames