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 std::string
94 getDefaultName() const override
95 {
96 return "RobotHandLocalizationWithFingertips";
97 }
98
99 protected:
100 // inherited from VisionComponent
101 void onInitImageProcessor() override;
102 void onConnectImageProcessor() override;
103 void onExitImageProcessor() override;
104
105 void process() override;
106
107 /**
108 * Returns the hand pose.
109 */
110 armarx::FramedPoseBasePtr getHandPose(const Ice::Current& c = Ice::emptyCurrent) override;
111
112 /**
113 * Returns the positions of the fingertips in this order: thumb, index, middle, ring, pinky.
114 */
115 visionx::FramedPositionBaseList
116 getFingertipPositions(const Ice::Current& c = Ice::emptyCurrent) override;
117
118 /**
119 * @see PropertyUser::createPropertyDefinitions()
120 */
127
128 private:
129 std::string providerName;
130 ImageProviderInterfacePrx imageProviderPrx;
131 ImageFormatInfo imageFormat;
132 std::string robotStateProxyName;
134 std::string handFrameName, cameraFrameName;
135
136 CStereoCalibration* stereoCalibration;
137 CByteImage** cameraImages;
138 CByteImage** resultImages;
139 static const int numResultImages = 4;
140
141 CHandLocalisation* handLocalization;
142 CHandModelVisualizer* handModelVisualizer;
143 static const bool drawComplexHandModelInResultImage = true;
144 };
145
146} // 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.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
ArmarX headers.