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
72 // ObjectPoseProvider interface
73 armarx::objpose::ProviderInfo
74 getProviderInfo(const Ice::Current& = Ice::emptyCurrent) override;
75
76 // ObjectToRobotNodeAttachmentInterface interface
77 void attachObjectToRobotNode(const AttachObjectToRobotNodeInput& attachment,
78 const Ice::Current&) override;
79 void detachObjectFromRobotNode(const DetachObjectFromRobotNodeInput& detachment,
80 const Ice::Current&) override;
81
82
83 protected:
84 /// @see armarx::ManagedIceObject::onInitComponent()
85 void onInitComponent() override;
86
87 /// @see armarx::ManagedIceObject::onConnectComponent()
88 void onConnectComponent() override;
89
90 /// @see armarx::ManagedIceObject::onDisconnectComponent()
91 void onDisconnectComponent() override;
92
93 /// @see armarx::ManagedIceObject::onExitComponent()
94 void onExitComponent() override;
95
96 /// @see PropertyUser::createPropertyDefinitions()
98
99
100 private:
101 void provideObjectInstancesPoses();
102 void provideObjectInstancesPoses(const std::vector<ObjectInstancePtr>& objectInstances);
103
104 armarx::objpose::ProvidedObjectPose toProvidedObjectPose(const ObjectInstancePtr& instance);
105
106
107 private:
108 memoryx::PriorKnowledgeInterfacePrx priorKnowledge;
109 memoryx::WorkingMemoryInterfacePrx workingMemory;
110 armarx::RobotStateComponentInterfacePrx robotStateComponent;
111
112 ObjectClassSegmentWrapper objectClassSegment;
113
114
115 float updateFrequency = 50;
117
118 Config config;
119 std::string loadObjectDatasetsStr = "";
120 std::string configFile = "MemoryX/WorkingMemoryObjectPoseProvider/config.json";
121
122 std::mutex mutex;
124 };
125} // 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