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 <string>
30 #include <set>
31 
32 // VisionX
34 #include <VisionX/interface/components/HandLocalization.h>
35 
36 // Core
38 
39 // IVT
40 #include <Image/ByteImage.h>
41 
42 class CStereoCalibration;
43 
44 namespace visionx
45 {
46  // forward declarations
47  class CHandLocalisation;
48  class CHandModelVisualizer;
49 
50 
53  {
54  public:
57  {
58  defineOptionalProperty<std::string>("ImageProviderAdapterName", "ImageProvider", "Ice Adapter name of the image provider");
59  defineOptionalProperty<std::string>("RobotStateProxyName", "RobotState", "Ice Adapter name of the robot state proxy");
60  defineOptionalProperty<std::string>("HandFrameName", "TCP R", "Name of the robot state frame of the hand that will be localized");
61  defineOptionalProperty<std::string>("CameraFrameName", "Eye_Left", "Name of the robot state frame of the primary camera");
62  }
63  };
64 
65  /**
66  * RobotHandLocalizationWithFingertips localizes the robot hand using the marker ball and the finger tips.
67  *
68  * \componentproperties
69  * \prop VisionX.RobotHandLocalizationWithFingertips.ImageProviderAdapterName: Name of the
70  * image provider that delivers the camera images.
71  * \prop VisionX.RobotHandLocalizationWithFingertips.RobotStateProxyName: Name of the robot state
72  * proxy used to obtain the current robot state.
73  * \prop VisionX.RobotHandLocalizationWithFingertips.HandFrameName: Name of the frame in the robot
74  * model that corresponds to the localized hand.
75  * \prop VisionX.RobotHandLocalizationWithFingertips.CameraFrameName: Name of the robot state frame of the primary camera
76  */
78  virtual public visionx::ImageProcessor,
79  virtual public visionx::HandLocalizationWithFingertipsInterface
80  {
81  public:
82  /**
83  * @see Component::getDefaultName()
84  */
85  std::string getDefaultName() const override
86  {
87  return "RobotHandLocalizationWithFingertips";
88  }
89 
90  protected:
91  // inherited from VisionComponent
92  void onInitImageProcessor() override;
93  void onConnectImageProcessor() override;
94  void onExitImageProcessor() override;
95 
96  void process() override;
97 
98  /**
99  * Returns the hand pose.
100  */
101  armarx::FramedPoseBasePtr getHandPose(const Ice::Current& c = Ice::emptyCurrent) override;
102 
103  /**
104  * Returns the positions of the fingertips in this order: thumb, index, middle, ring, pinky.
105  */
106  visionx::FramedPositionBaseList getFingertipPositions(const Ice::Current& c = Ice::emptyCurrent) override;
107 
108 
109  /**
110  * @see PropertyUser::createPropertyDefinitions()
111  */
113  {
117  }
118 
119  private:
120  std::string providerName;
121  ImageProviderInterfacePrx imageProviderPrx;
122  ImageFormatInfo imageFormat;
123  std::string robotStateProxyName;
125  std::string handFrameName, cameraFrameName;
126 
127  CStereoCalibration* stereoCalibration;
128  CByteImage** cameraImages;
129  CByteImage** resultImages;
130  static const int numResultImages = 4;
131 
132  CHandLocalisation* handLocalization;
133  CHandModelVisualizer* handModelVisualizer;
134  static const bool drawComplexHandModelInResultImage = true;
135  };
136 
137 }
138 
LinkedPose.h
visionx::RobotHandLocalizationWithFingertips::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: RobotHandLocalizationWithFingertips.cpp:49
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::RobotHandLocalizationWithFingertips::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: RobotHandLocalizationWithFingertips.cpp:164
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:87
visionx::RobotHandLocalizationWithFingertips::getFingertipPositions
visionx::FramedPositionBaseList getFingertipPositions(const Ice::Current &c=Ice::emptyCurrent) override
Returns the positions of the fingertips in this order: thumb, index, middle, ring,...
Definition: RobotHandLocalizationWithFingertips.cpp:180
visionx::RobotHandLocalizationWithFingertipsPropertyDefinitions::RobotHandLocalizationWithFingertipsPropertyDefinitions
RobotHandLocalizationWithFingertipsPropertyDefinitions(std::string prefix)
Definition: RobotHandLocalizationWithFingertips.h:55
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
visionx::RobotHandLocalizationWithFingertips::getDefaultName
std::string getDefaultName() const override
Definition: RobotHandLocalizationWithFingertips.h:85
visionx::RobotHandLocalizationWithFingertips::onConnectImageProcessor
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
Definition: RobotHandLocalizationWithFingertips.cpp:62
visionx::RobotHandLocalizationWithFingertips::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RobotHandLocalizationWithFingertips.h:112
ImageProcessor.h
visionx::CHandModelVisualizer
Definition: HandModelVisualizer.h:43
visionx::CHandLocalisation
Definition: HandLocalisation.h:72
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::ImageProcessorPropertyDefinitions
Definition: ImageProcessor.h:61
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
visionx::RobotHandLocalizationWithFingertips
RobotHandLocalizationWithFingertips localizes the robot hand using the marker ball and the finger tip...
Definition: RobotHandLocalizationWithFingertips.h:77
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
visionx::RobotHandLocalizationWithFingertipsPropertyDefinitions
Definition: RobotHandLocalizationWithFingertips.h:51
visionx::RobotHandLocalizationWithFingertips::process
void process() override
Process the vision component.
Definition: RobotHandLocalizationWithFingertips.cpp:104
visionx::RobotHandLocalizationWithFingertips::getHandPose
armarx::FramedPoseBasePtr getHandPose(const Ice::Current &c=Ice::emptyCurrent) override
Returns the hand pose.
Definition: RobotHandLocalizationWithFingertips.cpp:171