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 
42 class CStereoCalibration;
43 
44 namespace visionx
45 {
46  // forward declarations
47  class CHandLocalisation;
48  class CHandModelVisualizer;
49 
52  {
53  public:
56  {
57  defineOptionalProperty<std::string>("ImageProviderAdapterName",
58  "ImageProvider",
59  "Ice Adapter name of the image provider");
60  defineOptionalProperty<std::string>(
61  "RobotStateProxyName", "RobotState", "Ice Adapter name of the robot state proxy");
62  defineOptionalProperty<std::string>(
63  "HandFrameName",
64  "TCP R",
65  "Name of the robot state frame of the hand that will be localized");
66  defineOptionalProperty<std::string>(
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  */
123  {
126  }
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
LinkedPose.h
visionx::RobotHandLocalizationWithFingertips::onInitImageProcessor
void onInitImageProcessor() override
Setup the vision component.
Definition: RobotHandLocalizationWithFingertips.cpp:50
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::RobotHandLocalizationWithFingertips::onExitImageProcessor
void onExitImageProcessor() override
Exit the ImapeProcessor component.
Definition: RobotHandLocalizationWithFingertips.cpp:187
visionx::ImageProcessor
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
Definition: ImageProcessor.h:98
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:202
visionx::RobotHandLocalizationWithFingertipsPropertyDefinitions::RobotHandLocalizationWithFingertipsPropertyDefinitions
RobotHandLocalizationWithFingertipsPropertyDefinitions(std::string prefix)
Definition: RobotHandLocalizationWithFingertips.h:54
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
visionx::RobotHandLocalizationWithFingertips::getDefaultName
std::string getDefaultName() const override
Definition: RobotHandLocalizationWithFingertips.h:94
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:64
visionx::RobotHandLocalizationWithFingertips::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RobotHandLocalizationWithFingertips.h:122
ImageProcessor.h
visionx::CHandModelVisualizer
Definition: HandModelVisualizer.h:42
visionx::CHandLocalisation
Definition: HandLocalisation.h:71
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
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:85
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
visionx::RobotHandLocalizationWithFingertipsPropertyDefinitions
Definition: RobotHandLocalizationWithFingertips.h:50
visionx::RobotHandLocalizationWithFingertips::process
void process() override
Process the vision component.
Definition: RobotHandLocalizationWithFingertips.cpp:110
visionx::RobotHandLocalizationWithFingertips::getHandPose
armarx::FramedPoseBasePtr getHandPose(const Ice::Current &c=Ice::emptyCurrent) override
Returns the hand pose.
Definition: RobotHandLocalizationWithFingertips.cpp:193