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 
28 #include <RobotComponents/interface/components/GraspingManager/GraspGeneratorInterface.h>
29 #include <MemoryX/interface/memorytypes/MemorySegments.h>
30 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
32 
34 
35 #include <Eigen/Geometry>
36 
37 namespace armarx
38 {
39  /**
40  * @class SimpleGraspGeneratorPropertyDefinitions
41  * @brief
42  */
45  {
46  public:
49  {
50  defineOptionalProperty<std::string>("GraspNameInfix", "Grasp", "All grasp candidates without this infix are filtered out. Case-insensitive.");
51  defineOptionalProperty<float>("VisualizationSlowdownFactor", 1.0f, "1.0 is a good value for clear visualization, 0 the visualization should not slow down the process", PropertyDefinitionBase::eModifiable);
52  defineOptionalProperty<bool>("EnableVisualization", true, "If false no visualization is done.", PropertyDefinitionBase::eModifiable);
53  defineOptionalProperty<float>("PreposeOffset", 70.0f, "Offset of proposed grasp along negative z axis", PropertyDefinitionBase::eModifiable);
54  defineOptionalProperty<float>("UpwardsOffset", 50.0f, "Offset of proposed grasp in upwards direction", PropertyDefinitionBase::eModifiable);
55  defineRequiredProperty<std::string>("TCPtoGCPMapping", "Format: TCP L:GCP L;TCP R:GCP R", PropertyDefinitionBase::eModifiable);
56  defineOptionalProperty<std::string>("RobotType", "Armar3", "Type of robot for which the grasps should be generated");
57 
58  }
59  };
60 
61  /**
62  * @defgroup Component-SimpleGraspGenerator SimpleGraspGenerator
63  * @ingroup RobotComponents-Components
64  * @brief The SimpleGraspGenerator component controls the head of the robot with inverse kinematics based on the uncertainty
65  * of the current requested object locations.
66  * The uncertainty of objects grow based on their motion model and the timed passed since the last localization.
67  * It can be activated or deactivated with the Ice interface and given manual target positions to look at.
68  */
69 
70  /**
71  * @ingroup Component-SimpleGraspGenerator
72  * @brief The SimpleGraspGenerator class
73  */
75  virtual public Component,
76  virtual public GraspGeneratorInterface
77  {
78  public:
79  /**
80  * @see armarx::ManagedIceObject::getDefaultName()
81  */
82  std::string getDefaultName() const override
83  {
84  return "SimpleGraspGenerator";
85  }
86 
87  /**
88  * @brief Calculates the framedTCPPose and framedTCPPrepose
89  *
90  * Creates a SimoxWrapper for the instance of the object and looks through all GraspSets for the objectClass.
91  * For all grasps in the graspSet that use the same EEF, the framedTcpPose and framedTcpPrepose is calculated
92  * and added to the GeneratedGraspList.
93  *
94  * @return List of generatedGrasps
95  */
96  GeneratedGraspList generateGrasps(const std::string& objectInstanceEntityId, const Ice::Current& c = Ice::emptyCurrent) override;
97  GeneratedGraspList generateGraspsByObjectName(const std::string& objectName, const Ice::Current& c = Ice::emptyCurrent) override;
98 
99  protected:
100  /**
101  * @see armarx::ManagedIceObject::onInitComponent()
102  */
103  void onInitComponent() override;
104 
105  /**
106  * @see armarx::ManagedIceObject::onConnectComponent()
107  */
108  void onConnectComponent() override;
109 
110  /**
111  * @see armarx::ManagedIceObject::onDisconnectComponent()
112  */
113  void onDisconnectComponent() override;
114 
115  /**
116  * @see armarx::ManagedIceObject::onExitComponent()
117  */
118  void onExitComponent() override;
119 
120  /**
121  * @see PropertyUser::createPropertyDefinitions()
122  */
124  {
126  }
127 
128  private:
129 
130  /**
131  * @brief Wrapper for the getter of the property TCPtoGCPMapping
132  *
133  * Gets the property and iterates through the mapping, creating a dictionary of the mapping.
134  *
135  * @return StringStringDictionary of the mapping.
136  */
137  StringStringDictionary getTcpGcpMapping();
138 
140  memoryx::WorkingMemoryInterfacePrx wm;
141  memoryx::WorkingMemoryEntitySegmentBasePrx objectInstances;
142  memoryx::PriorKnowledgeInterfacePrx prior;
143  memoryx::PersistentObjectClassSegmentBasePrx objectClasses;
145 
146  memoryx::GridFileManagerPtr fileManager;
147 
148  armarx::DebugDrawerInterfacePrx debugDrawerPrx;
149  };
150 }
151 
DebugDrawerComponent.h
armarx::SimpleGraspGeneratorPropertyDefinitions::SimpleGraspGeneratorPropertyDefinitions
SimpleGraspGeneratorPropertyDefinitions(std::string prefix)
Definition: SimpleGraspGenerator.h:47
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
GridFileManager.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::SimpleGraspGenerator::getDefaultName
std::string getDefaultName() const override
Definition: SimpleGraspGenerator.h:82
armarx::SimpleGraspGenerator::generateGrasps
GeneratedGraspList generateGrasps(const std::string &objectInstanceEntityId, const Ice::Current &c=Ice::emptyCurrent) override
Calculates the framedTCPPose and framedTCPPrepose.
Definition: SimpleGraspGenerator.cpp:84
armarx::SimpleGraspGenerator
The SimpleGraspGenerator class.
Definition: SimpleGraspGenerator.h:74
armarx::SimpleGraspGenerator::onConnectComponent
void onConnectComponent() override
Definition: SimpleGraspGenerator.cpp:48
armarx::SimpleGraspGenerator::onExitComponent
void onExitComponent() override
Definition: SimpleGraspGenerator.cpp:67
armarx::SimpleGraspGenerator::onInitComponent
void onInitComponent() override
Definition: SimpleGraspGenerator.cpp:39
armarx::SimpleGraspGenerator::onDisconnectComponent
void onDisconnectComponent() override
Definition: SimpleGraspGenerator.cpp:63
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:32
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::SimpleGraspGenerator::generateGraspsByObjectName
GeneratedGraspList generateGraspsByObjectName(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
Definition: SimpleGraspGenerator.cpp:183
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::SimpleGraspGeneratorPropertyDefinitions
Definition: SimpleGraspGenerator.h:43
armarx::PropertyDefinitionBase::eModifiable
@ eModifiable
Definition: PropertyDefinitionInterface.h:57
armarx::SimpleGraspGenerator::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SimpleGraspGenerator.h:123
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18