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 #include <MemoryX/interface/memorytypes/MemorySegments.h>
27 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
30 
31 namespace memoryx
32 {
35  {
36  public:
39  {
40  defineOptionalProperty<float>("DistanceThreshold", 1000.f, "Threshold below which the agent is considered to be close to a node");
41  defineOptionalProperty<float>("HumanDistanceThreshold", 2000.f, "Threshold for the human below which the agent is considered to be close to a node");
42  defineOptionalProperty<std::string>("PlatformGraphSceneName", "XperienceDemoKitchenRM", "Name of the scene in the graph segment");
43  }
44  };
45 
47  {
48  public:
50 
51  // ManagedIceObject interface
52  protected:
53  void onInitWorldStateUpdater() override;
54  void onConnectWorldStateUpdater() override;
55  std::string getDefaultName() const override;
56 
58  {
62  }
63 
64  // WorldStateUpdaterInterface interface
65  public:
66  PredicateInfoList getPredicateInfos(const Ice::Current& c = Ice::emptyCurrent) override;
67  PredicateInstanceList calcPredicates(const Ice::Current&) override;
68 
69  private:
70  struct CachedNodeInfo
71  {
72  std::string nodeId;
73  std::vector<memoryx::EntityRefBasePtr> agentAtNodeRefs;
74  };
75 
76  std::map<std::string, CachedNodeInfo> nodeInfoCache;
77  std::map<std::string, std::vector<std::string>> nodeParentsCache;
78 
79  CachedNodeInfo getCacheEntry(const std::string& nodeId);
80 
81  float distanceThreshold, humanDistanceThreshold;
82  std::string sceneName;
83 
84  WorkingMemoryInterfacePrx wm;
85  PriorKnowledgeInterfacePrx prior;
86  GraphNodePoseResolverInterfacePrx psr;
87 
88  AgentInstancesSegmentBasePrx agentInstances;
89  GraphMemorySegmentBasePrx graphSegment;
90  std::vector<GraphNodeBasePtr> graphNodes;
91 
92  PredicateInfo agentAt;
93  };
94 
95 } // namespace memoryx
96 
memoryx::AgentAtPredicateProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: AgentAtPredicateProvider.h:57
memoryx::AgentAtPredicateProvider::getPredicateInfos
PredicateInfoList getPredicateInfos(const Ice::Current &c=Ice::emptyCurrent) override
Definition: AgentAtPredicateProvider.cpp:68
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::AgentAtPredicateProviderPropertyDefinitions
Definition: AgentAtPredicateProvider.h:33
memoryx::WorldStateUpdaterBase
Definition: WorldStateUpdaterBase.h:44
memoryx::AgentAtPredicateProviderPropertyDefinitions::AgentAtPredicateProviderPropertyDefinitions
AgentAtPredicateProviderPropertyDefinitions(std::string prefix)
Definition: AgentAtPredicateProvider.h:37
memoryx::AgentAtPredicateProvider::calcPredicates
PredicateInstanceList calcPredicates(const Ice::Current &) override
Definition: AgentAtPredicateProvider.cpp:73
WorldStateUpdaterBase.h
memoryx::AgentAtPredicateProvider::onInitWorldStateUpdater
void onInitWorldStateUpdater() override
Definition: AgentAtPredicateProvider.cpp:41
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:74
memoryx::AgentAtPredicateProvider
Definition: AgentAtPredicateProvider.h:46
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:34
memoryx::AgentAtPredicateProvider::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: AgentAtPredicateProvider.cpp:63