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
39namespace armarx
40{
41 /**
42 * @class SimpleGraspGeneratorPropertyDefinitions
43 * @brief
44 */
46 {
47 public:
50 {
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",
73 "Format: TCP L:GCP L;TCP R:GCP R",
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 */
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
constexpr T c
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
Definition Component.cpp:66
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The SimpleGraspGenerator class.
GeneratedGraspList generateGraspsByObjectName(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
PropertyDefinitionsPtr createPropertyDefinitions() override
GeneratedGraspList generateGrasps(const std::string &objectInstanceEntityId, const Ice::Current &c=Ice::emptyCurrent) override
Calculates the framedTCPPose and framedTCPPrepose.
std::string getDefaultName() const override
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
std::shared_ptr< GridFileManager > GridFileManagerPtr