AgentAtPredicateProvider.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 ArmarX::
17 * @author Valerij Wittenbeck ( valerij.wittenbeck at student dot kit dot edu)
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
26 
29 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
30 #include <MemoryX/interface/memorytypes/MemorySegments.h>
31 
32 namespace memoryx
33 {
35  {
36  public:
39  {
40  defineOptionalProperty<float>(
41  "DistanceThreshold",
42  1000.f,
43  "Threshold below which the agent is considered to be close to a node");
44  defineOptionalProperty<float>("HumanDistanceThreshold",
45  2000.f,
46  "Threshold for the human below which the agent is "
47  "considered to be close to a node");
48  defineOptionalProperty<std::string>("PlatformGraphSceneName",
49  "XperienceDemoKitchenRM",
50  "Name of the scene in the graph segment");
51  }
52  };
53 
55  {
56  public:
58 
59  // ManagedIceObject interface
60  protected:
61  void onInitWorldStateUpdater() override;
62  void onConnectWorldStateUpdater() override;
63  std::string getDefaultName() const override;
64 
67  {
70  }
71 
72  // WorldStateUpdaterInterface interface
73  public:
74  PredicateInfoList getPredicateInfos(const Ice::Current& c = Ice::emptyCurrent) override;
75  PredicateInstanceList calcPredicates(const Ice::Current&) override;
76 
77  private:
78  struct CachedNodeInfo
79  {
80  std::string nodeId;
81  std::vector<memoryx::EntityRefBasePtr> agentAtNodeRefs;
82  };
83 
84  std::map<std::string, CachedNodeInfo> nodeInfoCache;
85  std::map<std::string, std::vector<std::string>> nodeParentsCache;
86 
87  CachedNodeInfo getCacheEntry(const std::string& nodeId);
88 
89  float distanceThreshold, humanDistanceThreshold;
90  std::string sceneName;
91 
92  WorkingMemoryInterfacePrx wm;
93  PriorKnowledgeInterfacePrx prior;
94  GraphNodePoseResolverInterfacePrx psr;
95 
96  AgentInstancesSegmentBasePrx agentInstances;
97  GraphMemorySegmentBasePrx graphSegment;
98  std::vector<GraphNodeBasePtr> graphNodes;
99 
100  PredicateInfo agentAt;
101  };
102 
103 } // namespace memoryx
memoryx::AgentAtPredicateProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: AgentAtPredicateProvider.h:66
memoryx::AgentAtPredicateProvider::getPredicateInfos
PredicateInfoList getPredicateInfos(const Ice::Current &c=Ice::emptyCurrent) override
Definition: AgentAtPredicateProvider.cpp:70
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::AgentAtPredicateProviderPropertyDefinitions
Definition: AgentAtPredicateProvider.h:34
memoryx::WorldStateUpdaterBase
Definition: WorldStateUpdaterBase.h:45
memoryx::AgentAtPredicateProviderPropertyDefinitions::AgentAtPredicateProviderPropertyDefinitions
AgentAtPredicateProviderPropertyDefinitions(std::string prefix)
Definition: AgentAtPredicateProvider.h:37
memoryx::AgentAtPredicateProvider::calcPredicates
PredicateInstanceList calcPredicates(const Ice::Current &) override
Definition: AgentAtPredicateProvider.cpp:76
WorldStateUpdaterBase.h
memoryx::AgentAtPredicateProvider::onInitWorldStateUpdater
void onInitWorldStateUpdater() override
Definition: AgentAtPredicateProvider.cpp:40
Component.h
GraphNodePoseResolver.h
memoryx::WorldStateUpdaterPropertyDefinitions
Definition: WorldStateUpdaterBase.h:33
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
memoryx::AgentAtPredicateProvider
Definition: AgentAtPredicateProvider.h:54
memoryx::AgentAtPredicateProvider::AgentAtPredicateProvider
AgentAtPredicateProvider()
Definition: AgentAtPredicateProvider.cpp:35
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::AgentAtPredicateProvider::onConnectWorldStateUpdater
void onConnectWorldStateUpdater() override
Definition: AgentAtPredicateProvider.cpp:51
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
memoryx::AgentAtPredicateProvider::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: AgentAtPredicateProvider.cpp:64