RobotHandLocalizationWithFingertips.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-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 David Schiebener (schiebener at kit dot edu)
20 * @date 2011
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28#include <map>
29#include <set>
30#include <string>
31
32// VisionX
34#include <VisionX/interface/components/HandLocalization.h>
35
36// Core
38
39// IVT
40#include <Image/ByteImage.h>
41
42class CStereoCalibration;
43
44namespace visionx
45{
46 // forward declarations
49
52 {
53 public:
56 {
57 defineOptionalProperty<std::string>("ImageProviderAdapterName",
58 "ImageProvider",
59 "Ice Adapter name of the image provider");
61 "RobotStateProxyName", "RobotState", "Ice Adapter name of the robot state proxy");
63 "HandFrameName",
64 "TCP R",
65 "Name of the robot state frame of the hand that will be localized");
67 "CameraFrameName",
68 "Eye_Left",
69 "Name of the robot state frame of the primary camera");
70 }
71 };
72
73 /**
74 * RobotHandLocalizationWithFingertips localizes the robot hand using the marker ball and the finger tips.
75 *
76 * \componentproperties
77 * \prop VisionX.RobotHandLocalizationWithFingertips.ImageProviderAdapterName: Name of the
78 * image provider that delivers the camera images.
79 * \prop VisionX.RobotHandLocalizationWithFingertips.RobotStateProxyName: Name of the robot state
80 * proxy used to obtain the current robot state.
81 * \prop VisionX.RobotHandLocalizationWithFingertips.HandFrameName: Name of the frame in the robot
82 * model that corresponds to the localized hand.
83 * \prop VisionX.RobotHandLocalizationWithFingertips.CameraFrameName: Name of the robot state frame of the primary camera
84 */
86 virtual public visionx::ImageProcessor,
87 virtual public visionx::HandLocalizationWithFingertipsInterface
88 {
89 public:
90 /**
91 * @see Component::getDefaultName()
92 */
93 static std::string
95 {
96 return "RobotHandLocalizationWithFingertips";
97 }
98
99 std::string
100 getDefaultName() const override
101 {
102 return GetDefaultName();
103 }
104
105 protected:
106 // inherited from VisionComponent
107 void onInitImageProcessor() override;
108 void onConnectImageProcessor() override;
109 void onExitImageProcessor() override;
110
111 void process() override;
112
113 /**
114 * Returns the hand pose.
115 */
116 armarx::FramedPoseBasePtr getHandPose(const Ice::Current& c = Ice::emptyCurrent) override;
117
118 /**
119 * Returns the positions of the fingertips in this order: thumb, index, middle, ring, pinky.
120 */
121 visionx::FramedPositionBaseList
122 getFingertipPositions(const Ice::Current& c = Ice::emptyCurrent) override;
123
124 /**
125 * @see PropertyUser::createPropertyDefinitions()
126 */
133
134 private:
135 std::string providerName;
136 ImageProviderInterfacePrx imageProviderPrx;
137 ImageFormatInfo imageFormat;
138 std::string robotStateProxyName;
140 std::string handFrameName, cameraFrameName;
141
142 CStereoCalibration* stereoCalibration;
143 CByteImage** cameraImages;
144 CByteImage** resultImages;
145 static const int numResultImages = 4;
146
147 CHandLocalisation* handLocalization;
148 CHandModelVisualizer* handModelVisualizer;
149 static const bool drawComplexHandModelInResultImage = true;
150 };
151
152} // namespace visionx
constexpr T c
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)
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
RobotHandLocalizationWithFingertips localizes the robot hand using the marker ball and the finger tip...
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onExitImageProcessor() override
Exit the ImapeProcessor component.
armarx::FramedPoseBasePtr getHandPose(const Ice::Current &c=Ice::emptyCurrent) override
Returns the hand pose.
visionx::FramedPositionBaseList getFingertipPositions(const Ice::Current &c=Ice::emptyCurrent) override
Returns the positions of the fingertips in this order: thumb, index, middle, ring,...
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitImageProcessor() override
Setup the vision component.
std::string getDefaultName() const override
Retrieve default name of component.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
ArmarX headers.