SimpleGraspGenerator.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2015-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package RobotComponents::SimpleGraspGenerator
19  * @author Valerij Wittenbeck (valerij dot wittenbeck at student dot kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <Eigen/Geometry>
28 
30 
32 
33 #include <RobotComponents/interface/components/GraspingManager/GraspGeneratorInterface.h>
34 
36 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
37 #include <MemoryX/interface/memorytypes/MemorySegments.h>
38 
39 namespace armarx
40 {
41  /**
42  * @class SimpleGraspGeneratorPropertyDefinitions
43  * @brief
44  */
46  {
47  public:
50  {
51  defineOptionalProperty<std::string>(
52  "GraspNameInfix",
53  "Grasp",
54  "All grasp candidates without this infix are filtered out. Case-insensitive.");
55  defineOptionalProperty<float>("VisualizationSlowdownFactor",
56  1.0f,
57  "1.0 is a good value for clear visualization, 0 the "
58  "visualization should not slow down the process",
60  defineOptionalProperty<bool>("EnableVisualization",
61  true,
62  "If false no visualization is done.",
64  defineOptionalProperty<float>("PreposeOffset",
65  70.0f,
66  "Offset of proposed grasp along negative z axis",
68  defineOptionalProperty<float>("UpwardsOffset",
69  50.0f,
70  "Offset of proposed grasp in upwards direction",
72  defineRequiredProperty<std::string>("TCPtoGCPMapping",
73  "Format: TCP L:GCP L;TCP R:GCP R",
75  defineOptionalProperty<std::string>(
76  "RobotType", "Armar3", "Type of robot for which the grasps should be generated");
77  }
78  };
79 
80  /**
81  * @defgroup Component-SimpleGraspGenerator SimpleGraspGenerator
82  * @ingroup RobotComponents-Components
83  * @brief The SimpleGraspGenerator component controls the head of the robot with inverse kinematics based on the uncertainty
84  * of the current requested object locations.
85  * The uncertainty of objects grow based on their motion model and the timed passed since the last localization.
86  * It can be activated or deactivated with the Ice interface and given manual target positions to look at.
87  */
88 
89  /**
90  * @ingroup Component-SimpleGraspGenerator
91  * @brief The SimpleGraspGenerator class
92  */
93  class SimpleGraspGenerator : virtual public Component, virtual public GraspGeneratorInterface
94  {
95  public:
96  /**
97  * @see armarx::ManagedIceObject::getDefaultName()
98  */
99  std::string
100  getDefaultName() const override
101  {
102  return "SimpleGraspGenerator";
103  }
104 
105  /**
106  * @brief Calculates the framedTCPPose and framedTCPPrepose
107  *
108  * Creates a SimoxWrapper for the instance of the object and looks through all GraspSets for the objectClass.
109  * For all grasps in the graspSet that use the same EEF, the framedTcpPose and framedTcpPrepose is calculated
110  * and added to the GeneratedGraspList.
111  *
112  * @return List of generatedGrasps
113  */
114  GeneratedGraspList generateGrasps(const std::string& objectInstanceEntityId,
115  const Ice::Current& c = Ice::emptyCurrent) override;
116  GeneratedGraspList
117  generateGraspsByObjectName(const std::string& objectName,
118  const Ice::Current& c = Ice::emptyCurrent) override;
119 
120  protected:
121  /**
122  * @see armarx::ManagedIceObject::onInitComponent()
123  */
124  void onInitComponent() override;
125 
126  /**
127  * @see armarx::ManagedIceObject::onConnectComponent()
128  */
129  void onConnectComponent() override;
130 
131  /**
132  * @see armarx::ManagedIceObject::onDisconnectComponent()
133  */
134  void onDisconnectComponent() override;
135 
136  /**
137  * @see armarx::ManagedIceObject::onExitComponent()
138  */
139  void onExitComponent() override;
140 
141  /**
142  * @see PropertyUser::createPropertyDefinitions()
143  */
146  {
147  return PropertyDefinitionsPtr(
149  }
150 
151  private:
152  /**
153  * @brief Wrapper for the getter of the property TCPtoGCPMapping
154  *
155  * Gets the property and iterates through the mapping, creating a dictionary of the mapping.
156  *
157  * @return StringStringDictionary of the mapping.
158  */
159  StringStringDictionary getTcpGcpMapping();
160 
162  memoryx::WorkingMemoryInterfacePrx wm;
163  memoryx::WorkingMemoryEntitySegmentBasePrx objectInstances;
164  memoryx::PriorKnowledgeInterfacePrx prior;
165  memoryx::PersistentObjectClassSegmentBasePrx objectClasses;
167 
168  memoryx::GridFileManagerPtr fileManager;
169 
170  armarx::DebugDrawerInterfacePrx debugDrawerPrx;
171  };
172 } // namespace armarx
DebugDrawerComponent.h
armarx::SimpleGraspGeneratorPropertyDefinitions::SimpleGraspGeneratorPropertyDefinitions
SimpleGraspGeneratorPropertyDefinitions(std::string prefix)
Definition: SimpleGraspGenerator.h:48
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
GridFileManager.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::SimpleGraspGenerator::getDefaultName
std::string getDefaultName() const override
Definition: SimpleGraspGenerator.h:100
armarx::SimpleGraspGenerator::generateGrasps
GeneratedGraspList generateGrasps(const std::string &objectInstanceEntityId, const Ice::Current &c=Ice::emptyCurrent) override
Calculates the framedTCPPose and framedTCPPrepose.
Definition: SimpleGraspGenerator.cpp:95
armarx::SimpleGraspGenerator
The SimpleGraspGenerator class.
Definition: SimpleGraspGenerator.h:93
armarx::SimpleGraspGenerator::onConnectComponent
void onConnectComponent() override
Definition: SimpleGraspGenerator.cpp:55
armarx::SimpleGraspGenerator::onExitComponent
void onExitComponent() override
Definition: SimpleGraspGenerator.cpp:76
armarx::SimpleGraspGenerator::onInitComponent
void onInitComponent() override
Definition: SimpleGraspGenerator.cpp:45
armarx::SimpleGraspGenerator::onDisconnectComponent
void onDisconnectComponent() override
Definition: SimpleGraspGenerator.cpp:71
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:33
IceUtil::Handle
Definition: forward_declarations.h:30
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::SimpleGraspGenerator::generateGraspsByObjectName
GeneratedGraspList generateGraspsByObjectName(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
Definition: SimpleGraspGenerator.cpp:214
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
armarx::SimpleGraspGeneratorPropertyDefinitions
Definition: SimpleGraspGenerator.h:45
armarx::PropertyDefinitionBase::eModifiable
@ eModifiable
Definition: PropertyDefinitionInterface.h:57
armarx::SimpleGraspGenerator::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SimpleGraspGenerator.h:145
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19