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 
25 #include "Box.hpp"
26 
28 #include <MemoryX/interface/memorytypes/MemorySegments.h>
29 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
34 
35 namespace memoryx
36 {
39  {
40  public:
43  {
44  defineOptionalProperty<std::string>("DebugDrawerTopicName", "DebugDrawerUpdates", "Where to draw the provided bounding boxes (if empty -> don't draw)");
45  //countertop;sideboard?;fridge;table?
46  defineOptionalProperty<std::string>("BoundingBoxesR", "2960.0 9885.0 1000.0 1970.0 990.0 500.0;4490.0 7100.0 1000.0 1000.0 1180.0 500.0;4465.0 10255.0 1750 490.0 500.0 2000;2680 6051 1100 800 800 500", "Format: 'xCenter yCenter zCenter xSize ySize zSize' for one 6-tuple, separate multiple tuples with ';'");
47  defineOptionalProperty<std::string>("BoundingBoxesL", "3350.0 9960.0 1000.0 1820.0 840.0 500.0;4490.0 7100.0 1000.0 1000.0 1180.0 500.0;4465.0 10255.0 1750 490.0 500.0 2000;2680 6051 1100 800 800 500", "Format: 'xCenter yCenter zCenter xSize ySize zSize' for one 6-tuple, separate multiple tuples with ';'");
48  }
49  };
50 
52  {
53  public:
55 
56  // ManagedIceObject interface
57  protected:
58  void onInitWorldStateUpdater() override;
59  void onConnectWorldStateUpdater() override;
60  std::string getDefaultName() const override;
61 
63  {
67  }
68 
69  // WorldStateUpdaterInterface interface
70  public:
71  PredicateInfoList getPredicateInfos(const Ice::Current& = Ice::emptyCurrent) override;
72  PredicateInstanceList calcPredicates(const Ice::Current& = Ice::emptyCurrent) override;
73 
74  private:
75  struct GraspabilityDescriptor
76  {
77  std::string className;
78  bool hasGraspableSuperclass;
79  bool hasLeftGrasp;
80  bool hasRightGrasp;
81  };
82 
83  std::vector<Box> stringToBoxes(const std::string& boxesString);
84  void addPredicateIfInside(PredicateInstanceList& result, const std::string& predicateName, const ObjectInstancePtr& obj, const std::vector<Box>& boxes);
85  std::string debugDrawerTopicName;
86  std::vector<Box> boxesL;
87  std::vector<Box> boxesR;
88  WorkingMemoryInterfacePrx wm;
89  WorkingMemoryEntitySegmentBasePrx objectInstances;
90  PriorKnowledgeInterfacePrx prior;
91  PersistentObjectClassSegmentBasePrx objectClasses;
92 
93  armarx::DrawColor leftColor;
94  armarx::DrawColor rightColor;
95  PredicateInfo leftGraspable;
96  PredicateInfo rightGraspable;
97 
98  memoryx::GridFileManagerPtr fileManager;
99  std::vector<GraspabilityDescriptor> graspabilityDescriptors;
100  };
101 
102 } // namespace memoryx
103 
memoryx::GraspablePredicateProvider::getPredicateInfos
PredicateInfoList getPredicateInfos(const Ice::Current &=Ice::emptyCurrent) override
Definition: GraspablePredicateProvider.cpp:114
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
Box.hpp
memoryx::GraspablePredicateProvider::GraspablePredicateProvider
GraspablePredicateProvider()
Definition: GraspablePredicateProvider.cpp:37
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:109
memoryx::WorldStateUpdaterBase
Definition: WorldStateUpdaterBase.h:44
memoryx::GraspablePredicateProvider::calcPredicates
PredicateInstanceList calcPredicates(const Ice::Current &=Ice::emptyCurrent) override
Definition: GraspablePredicateProvider.cpp:143
memoryx::ObjectInstancePtr
IceInternal::Handle< ObjectInstance > ObjectInstancePtr
Definition: ObjectInstance.h:42
memoryx::GraspablePredicateProvider::onConnectWorldStateUpdater
void onConnectWorldStateUpdater() override
Definition: GraspablePredicateProvider.cpp:85
WorldStateUpdaterBase.h
memoryx::GraspablePredicateProvider::onInitWorldStateUpdater
void onInitWorldStateUpdater() override
Definition: GraspablePredicateProvider.cpp:69
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
SimoxObjectWrapper.h
ObjectInstance.h
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:32
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::GraspablePredicateProvider
Definition: GraspablePredicateProvider.h:51
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
memoryx::GraspablePredicateProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: GraspablePredicateProvider.h:62
memoryx::GraspablePredicateProviderPropertyDefinitions
Definition: GraspablePredicateProvider.h:37