RobotHandLocalizationDynamicSimulation.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2013-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 VisionX::Component
19 * @author Kai Welke (welke at kit dot edu)
20 * @date 2013
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
28
29// MemoryX
33#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
34#include <MemoryX/interface/workingmemory/WorkingMemoryUpdaterBase.h>
35
36// Simulator
38
39#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
40
41namespace armarx
42{
45 {
46 public:
49 {
51 "TCPNameLeft", "TCP L", "Name of the TCP of the left robot hand.");
53 "TCPNameRight", "TCP R", "Name of the TCP of the right robot hand.");
55 "SimulatorName",
56 "Simulator",
57 "Name of the simulator component that should be used");
59 "ReferenceFrameName",
60 "EyeLeftCamera",
61 "Sets the reference frame name of the pose provided by this recognizer. Must be a "
62 "frame name known in Pose from the robot model.");
64 "RobotStateComponentName",
65 "RobotStateComponent",
66 "Name of the RobotStateComponent that should be used");
67 }
68 };
69
70 /**
71 * RobotHandLocalizationDynamicSimulation queries the armarx simulator for the current poses of the hand/TCP coordinate systems of the robot.
72 * The hand localization is invoked automatically by the working memory if the object has been requested there.
73 */
75 virtual public ::armarx::Component,
76 virtual public ::memoryx::ObjectLocalizerInterface
77 {
78 public:
80
81 /**
82 * @see PropertyUser::createPropertyDefinitions()
83 */
91
92 void onInitComponent() override;
93 void onConnectComponent() override;
94 void onDisconnectComponent() override;
95
96 void
97 onExitComponent() override
98 {
99 }
100
101 /**
102 * @see Component::getDefaultName()
103 *
104 * Use "HandMarkerLocalization" here in order to mimic the execution on the real robot.
105 */
106 std::string
107 getDefaultName() const override
108 {
109 return "HandMarkerLocalization";
110 }
111
112 protected:
113 /**
114 * Add a memory entity representing the hand marker in order to set its properties
115 *
116 * @param objectClassEntity entity containing all information available for the object class
117 * @param fileManager GridFileManager required to read files associated to prior knowledge from the database.
118 *
119 * @return success of adding this entity
120 */
121 virtual bool addObjectClass(const memoryx::EntityPtr& objectClassEntity,
122 const memoryx::GridFileManagerPtr& fileManager);
123
124 /**
125 * localize one or both hand markers
126 *
127 * @param objectClassNames
128 *
129 * @return list of object instances
130 */
131 memoryx::ObjectLocalizationResultList
132 localizeObjectClasses(const ::memoryx::ObjectClassNameList&,
133 const ::Ice::Current& = Ice::emptyCurrent) override;
134
135
136 private:
138 computePositionNoise(const Eigen::Vector3f& pos);
139
140
141 // remote robot for pose calculation
142 std::shared_ptr<RemoteRobot> remoteRobot;
143 std::string tcpNameLeft, tcpNameRight;
144
145 SimulatorInterfacePrx simulatorProxy;
146
147 // reference frame name (e.g. a camera frame)
148 std::string referenceFrame;
149 };
150} // namespace armarx
::memoryx::MultivariateNormalDistributionPtr computePositionNoise(const Eigen::Vector3f &pos)
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
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)
void onInitComponent() override
Pure virtual hook for the subclass.
virtual bool addObjectClass(const memoryx::EntityPtr &objectClassEntity, const memoryx::GridFileManagerPtr &fileManager)
Add a memory entity representing the hand marker in order to set its properties.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
memoryx::ObjectLocalizationResultList localizeObjectClasses(const ::memoryx::ObjectClassNameList &, const ::Ice::Current &=Ice::emptyCurrent) override
localize one or both hand markers
void onConnectComponent() override
Pure virtual hook for the subclass.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
IceInternal::Handle< MultivariateNormalDistribution > MultivariateNormalDistributionPtr
IceInternal::Handle< Entity > EntityPtr
Typedef of EntityPtr as IceInternal::Handle<Entity> for convenience.
Definition Entity.h:45
std::shared_ptr< GridFileManager > GridFileManagerPtr