MaskRCNNPointCloudObjectLocalizer.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::ArmarXObjects::MaskRCNNPointCloudObjectLocalizer
19  * @author Markus Grotz ( markus dot grotz at kit dot edu )
20  * @date 2015
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 
28 #include <Eigen/Core>
29 
32 #include <ArmarXCore/interface/observers/RequestableService.h>
33 
34 #include <RobotAPI/interface/core/PoseBase.h>
35 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
37 
40 #include <VisionX/interface/components/SimpleLocation.h>
41 
43 #include <MemoryX/interface/core/ProbabilityMeasures.h>
44 
45 #pragma GCC diagnostic push
46 #pragma GCC diagnostic ignored "-Wpedantic"
47 //#include <pcl/point_types.h>
48 
49 //#include <pcl/common/transforms.h>
50 
51 //#include <pcl/io/pcd_io.h>
52 
53 //#include <pcl/filters/filter.h>
54 //#include <pcl/filters/passthrough.h>
55 //#include <pcl/filters/approximate_voxel_grid.h>
56 
57 //#include <pcl/features/normal_3d.h>
58 //#include <pcl/features/normal_3d_omp.h>
59 //#include <pcl/features/fpfh_omp.h>
60 //#include <pcl/features/shot_omp.h>
61 //#include <pcl/search/kdtree.h>
62 //#include <pcl/kdtree/kdtree_flann.h>
63 
64 //#include <pcl/registration/icp.h>
65 //#include <pcl/registration/gicp6d.h>
66 
67 //#include <pcl/correspondence.h>
68 #include <pcl/recognition/cg/geometric_consistency.h>
69 #pragma GCC diagnostic pop
70 
71 #include <limits>
72 
73 namespace visionx
74 {
75 
76 
77  typedef pcl::PointXYZRGBA PointT;
78  typedef pcl::PointXYZRGBL PointL;
79  typedef pcl::FPFHSignature33 PointD;
80 
81  //typedef pcl::SHOT352 PointD;
82 
83  /**
84  * @class MaskRCNNPointCloudObjectLocalizerPropertyDefinitions
85  * @brief
86  */
89  {
90  public:
93  {
94  defineOptionalProperty<std::string>(
95  "agentName",
96  "Armar6",
97  "Name of the agent for which the sensor values are provided");
98  defineOptionalProperty<std::string>(
99  "sourceNodeName",
100  "DepthCamera",
101  "the robot node to use as source coordinate system for the captured point clouds");
102  defineOptionalProperty<std::string>(
103  "ObjectNameIdMap",
104  "spraybottle:1;screwdriver:2;torch:3;cloth:4;cutter:5;pliers:6;brush:7",
105  "map between object names and mask rcnn names",
107  defineOptionalProperty<uint32_t>("BackgroundLabelId",
108  0,
109  "Label in the pointcloud for the plane or background.",
111 
112  defineOptionalProperty<std::string>(
113  "DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic");
114  }
115  };
116 
117  /**
118 
119  http://pointclouds.org/documentation/tutorials/global_hypothesis_verification.php
120  * @class MaskRCNNPointCloudObjectLocalizer
121  *
122  * @ingroup VisionX-Components
123  * @brief A brief description
124  *
125  *
126  * Detailed Description
127  */
129  virtual public armarx::SimpleLocationInterface,
130  virtual public PointCloudProcessor
131  {
132  public:
133  /**
134  * @see armarx::ManagedIceObject::getDefaultName()
135  */
136  std::string
137  getDefaultName() const override
138  {
139  return "MaskRCNNPointCloudObjectLocalizer";
140  }
141 
142  void getLocation(armarx::FramedOrientationBasePtr& orientation,
143  armarx::FramedPositionBasePtr& position,
144  const Ice::Current& c = ::Ice::Current()) override;
145 
146  memoryx::ObjectLocalizationResultList
147  localizeObjectClasses(const memoryx::ObjectClassNameList& objectClassNames,
148  const Ice::Current& c = ::Ice::Current()) override;
149 
150  protected:
151  /**
152  * @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
153  */
154  void onInitPointCloudProcessor() override;
155 
156  /**
157  * @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
158  */
159  void onConnectPointCloudProcessor() override;
160 
161  /**
162  * @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
163  */
164  void onDisconnectPointCloudProcessor() override;
165 
166  /**
167  * @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
168  */
169  void onExitPointCloudProcessor() override;
170 
171  /**
172  * @see visionx::PointCloudProcessor::process()
173  */
174  void process() override;
175 
176  /**
177  * @see PropertyUser::createPropertyDefinitions()
178  */
180 
181 
182  private:
183  std::mutex pointCloudMutex;
184 
185 
186  std::string agentName;
187 
188  std::string providerName;
189  std::string sourceNodeName;
190 
191 
192  std::mutex localizeMutex;
193 
194 
195  armarx::DebugDrawerInterfacePrx debugDrawerPrx;
196  armarx::RequestableServiceListenerInterfacePrx serviceTopic;
197  };
198 } // namespace visionx
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::MaskRCNNPointCloudObjectLocalizer::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:64
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
visionx::PointD
pcl::FPFHSignature33 PointD
Definition: MaskRCNNPointCloudObjectLocalizer.h:79
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
visionx::MaskRCNNPointCloudObjectLocalizer::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:69
visionx::MaskRCNNPointCloudObjectLocalizer
http://pointclouds.org/documentation/tutorials/global_hypothesis_verification.php
Definition: MaskRCNNPointCloudObjectLocalizer.h:128
visionx::MaskRCNNPointCloudObjectLocalizer::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:56
visionx::MaskRCNNPointCloudObjectLocalizerPropertyDefinitions::MaskRCNNPointCloudObjectLocalizerPropertyDefinitions
MaskRCNNPointCloudObjectLocalizerPropertyDefinitions(std::string prefix)
Definition: MaskRCNNPointCloudObjectLocalizer.h:91
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:177
PCLUtilities.h
FramedPose.h
visionx::MaskRCNNPointCloudObjectLocalizerPropertyDefinitions
Definition: MaskRCNNPointCloudObjectLocalizer.h:87
MemoryXCoreObjectFactories.h
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:166
PointCloudProcessor.h
visionx::MaskRCNNPointCloudObjectLocalizer::getDefaultName
std::string getDefaultName() const override
Definition: MaskRCNNPointCloudObjectLocalizer.h:137
Component.h
visionx::PointL
pcl::PointXYZRGBL PointL
Definition: MaskRCNNPointCloudObjectLocalizer.h:78
visionx::MaskRCNNPointCloudObjectLocalizer::getLocation
void getLocation(armarx::FramedOrientationBasePtr &orientation, armarx::FramedPositionBasePtr &position, const Ice::Current &c=::Ice::Current()) override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:230
visionx::MaskRCNNPointCloudObjectLocalizer::localizeObjectClasses
memoryx::ObjectLocalizationResultList localizeObjectClasses(const memoryx::ObjectClassNameList &objectClassNames, const Ice::Current &c=::Ice::Current()) override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:80
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
visionx::MaskRCNNPointCloudObjectLocalizer::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:41
visionx::MaskRCNNPointCloudObjectLocalizer::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:238
ArmarXDataPath.h
armarx::PropertyDefinitionBase::eModifiable
@ eModifiable
Definition: PropertyDefinitionInterface.h:57
visionx::PointT
pcl::PointXYZRGBA PointT
Definition: MaskRCNNPointCloudObjectLocalizer.h:77
visionx::MaskRCNNPointCloudObjectLocalizer::process
void process() override
Definition: MaskRCNNPointCloudObjectLocalizer.cpp:74