GraspablePredicateProvider.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 2015
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
26 
27 #include "Box.hpp"
30 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
31 #include <MemoryX/interface/memorytypes/MemorySegments.h>
34 
35 namespace memoryx
36 {
39  {
40  public:
43  {
44  defineOptionalProperty<std::string>(
45  "DebugDrawerTopicName",
46  "DebugDrawerUpdates",
47  "Where to draw the provided bounding boxes (if empty -> don't draw)");
48  //countertop;sideboard?;fridge;table?
49  defineOptionalProperty<std::string>(
50  "BoundingBoxesR",
51  "2960.0 9885.0 1000.0 1970.0 990.0 500.0;4490.0 7100.0 1000.0 1000.0 1180.0 "
52  "500.0;4465.0 10255.0 1750 490.0 500.0 2000;2680 6051 1100 800 800 500",
53  "Format: 'xCenter yCenter zCenter xSize ySize zSize' for one 6-tuple, separate "
54  "multiple tuples with ';'");
55  defineOptionalProperty<std::string>(
56  "BoundingBoxesL",
57  "3350.0 9960.0 1000.0 1820.0 840.0 500.0;4490.0 7100.0 1000.0 1000.0 1180.0 "
58  "500.0;4465.0 10255.0 1750 490.0 500.0 2000;2680 6051 1100 800 800 500",
59  "Format: 'xCenter yCenter zCenter xSize ySize zSize' for one 6-tuple, separate "
60  "multiple tuples with ';'");
61  }
62  };
63 
65  {
66  public:
68 
69  // ManagedIceObject interface
70  protected:
71  void onInitWorldStateUpdater() override;
72  void onConnectWorldStateUpdater() override;
73  std::string getDefaultName() const override;
74 
77  {
80  }
81 
82  // WorldStateUpdaterInterface interface
83  public:
84  PredicateInfoList getPredicateInfos(const Ice::Current& = Ice::emptyCurrent) override;
85  PredicateInstanceList calcPredicates(const Ice::Current& = Ice::emptyCurrent) override;
86 
87  private:
88  struct GraspabilityDescriptor
89  {
90  std::string className;
91  bool hasGraspableSuperclass;
92  bool hasLeftGrasp;
93  bool hasRightGrasp;
94  };
95 
96  std::vector<Box> stringToBoxes(const std::string& boxesString);
97  void addPredicateIfInside(PredicateInstanceList& result,
98  const std::string& predicateName,
99  const ObjectInstancePtr& obj,
100  const std::vector<Box>& boxes);
101  std::string debugDrawerTopicName;
102  std::vector<Box> boxesL;
103  std::vector<Box> boxesR;
104  WorkingMemoryInterfacePrx wm;
105  WorkingMemoryEntitySegmentBasePrx objectInstances;
106  PriorKnowledgeInterfacePrx prior;
107  PersistentObjectClassSegmentBasePrx objectClasses;
108 
109  armarx::DrawColor leftColor;
110  armarx::DrawColor rightColor;
111  PredicateInfo leftGraspable;
112  PredicateInfo rightGraspable;
113 
114  memoryx::GridFileManagerPtr fileManager;
115  std::vector<GraspabilityDescriptor> graspabilityDescriptors;
116  };
117 
118 } // namespace memoryx
memoryx::GraspablePredicateProvider::getPredicateInfos
PredicateInfoList getPredicateInfos(const Ice::Current &=Ice::emptyCurrent) override
Definition: GraspablePredicateProvider.cpp:127
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
Box.hpp
memoryx::GraspablePredicateProvider::GraspablePredicateProvider
GraspablePredicateProvider()
Definition: GraspablePredicateProvider.cpp:40
memoryx::GraspablePredicateProviderPropertyDefinitions::GraspablePredicateProviderPropertyDefinitions
GraspablePredicateProviderPropertyDefinitions(std::string prefix)
Definition: GraspablePredicateProvider.h:41
memoryx::GraspablePredicateProvider::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: GraspablePredicateProvider.cpp:121
memoryx::WorldStateUpdaterBase
Definition: WorldStateUpdaterBase.h:45
memoryx::GraspablePredicateProvider::calcPredicates
PredicateInstanceList calcPredicates(const Ice::Current &=Ice::emptyCurrent) override
Definition: GraspablePredicateProvider.cpp:164
memoryx::ObjectInstancePtr
IceInternal::Handle< ObjectInstance > ObjectInstancePtr
Definition: ObjectInstance.h:43
memoryx::GraspablePredicateProvider::onConnectWorldStateUpdater
void onConnectWorldStateUpdater() override
Definition: GraspablePredicateProvider.cpp:88
WorldStateUpdaterBase.h
memoryx::GraspablePredicateProvider::onInitWorldStateUpdater
void onInitWorldStateUpdater() override
Definition: GraspablePredicateProvider.cpp:71
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
SimoxObjectWrapper.h
ObjectInstance.h
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:33
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::GraspablePredicateProvider
Definition: GraspablePredicateProvider.h:64
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
memoryx::GraspablePredicateProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: GraspablePredicateProvider.h:76
memoryx::GraspablePredicateProviderPropertyDefinitions
Definition: GraspablePredicateProvider.h:37