SegmentRansacShapeExtractor.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::SegmentRansacShapeExtractor
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <pcl/point_types.h>
26 
29 #include <ArmarXCore/interface/observers/ObserverInterface.h>
30 
32 
34 #include <VisionX/interface/components/SegmentRansacShapeExtractor.h>
35 #include <VisionX/interface/libraries/SemanticObjectRelations/ShapesTopic.h>
36 
37 #include <SemanticObjectRelations/ShapeExtraction/ShapeExtraction.h>
38 
39 namespace visionx
40 {
41 
42  /**
43  * @class SegmentRansacShapeExtractorPropertyDefinitions
44  * @brief Property definitions of `SegmentRansacShapeExtractor`.
45  */
48  {
49  public:
51  };
52 
53  /**
54  * @defgroup Component-SegmentRansacShapeExtractor SegmentRansacShapeExtractor
55  * @ingroup VisionX-Components
56  * A description of the component SegmentRansacShapeExtractor.
57  *
58  * @class SegmentRansacShapeExtractor
59  * @ingroup Component-SegmentRansacShapeExtractor
60  * @brief Brief description of class SegmentRansacShapeExtractor.
61  *
62  * Detailed description of class SegmentRansacShapeExtractor.
63  */
65  virtual public visionx::PointCloudProcessor,
66  virtual public visionx::SegmentRansacShapeExtractorInterface
67  {
68  /// The used point type.
69  using PointT = pcl::PointXYZRGBL;
70 
71  public:
72  /// @see armarx::ManagedIceObject::getDefaultName()
73  std::string getDefaultName() const override;
74 
75 
76  // SegmentRansacShapeExtractorInterface interface
77  armarx::semantic::data::ShapeList
78  extractShapes(const Ice::Current& = Ice::emptyCurrent) override;
79  armarx::semantic::data::ShapeList
80  getExtractedShapes(const Ice::Current& = Ice::emptyCurrent) override;
81 
82 
83  protected:
84  /// @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
85  void onInitPointCloudProcessor() override;
86 
87  /// @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
88  void onConnectPointCloudProcessor() override;
89 
90  /// @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
91  void onDisconnectPointCloudProcessor() override;
92 
93  /// @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
94  void onExitPointCloudProcessor() override;
95 
96 
97  /// @see visionx::PointCloudProcessor::process()
98  void process() override;
99 
100 
101  /// @see PropertyUser::createPropertyDefinitions()
103 
104 
105  private:
106  // INPUT
107 
108  std::mutex inputPointCloudMutex;
109 
110  /// The latest received point cloud.
111  pcl::PointCloud<pcl::PointXYZRGBL>::Ptr inputPointCloud;
112 
113 
114  // PROCESSING
115 
116  /// Locked while process is running.
117  std::mutex extractionMutex;
118 
119  /// The shape extraction.
120  semrel::ShapeExtraction shapeExtraction;
121 
122  armarx::SimpleRunningTask<>::pointer_type shapeExtractionTask;
123 
124  // RESULT
125 
126  struct ExtractedShapes
127  {
128 
129  /// Protects `extractedShapes` and `extractedShapesIce`.
130  std::mutex mutex;
131 
132  /// The result of the latest processed point cloud.
133  semrel::ShapeList shapes;
134 
135  /// Serialized version of `shapes`. Is kept up to date.
136  armarx::semantic::data::ShapeList shapesIce;
137  };
138 
139  ExtractedShapes extractedShapes;
140 
141 
142  // ICE
143 
144  armarx::DebugObserverInterfacePrx debugObserver;
145  armarx::DebugDrawerTopic debugDrawer;
146 
147  std::string shapesName;
148  armarx::semantic::ShapesTopicPrx shapesTopic;
149  };
150 } // namespace visionx
visionx::SegmentRansacShapeExtractor::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: SegmentRansacShapeExtractor.cpp:167
armarx::DebugDrawerTopic
The DebugDrawerTopic wraps a DebugDrawerInterfacePrx and provides a more useful interface than the Ic...
Definition: DebugDrawerTopic.h:151
visionx::SegmentRansacShapeExtractor::getExtractedShapes
armarx::semantic::data::ShapeList getExtractedShapes(const Ice::Current &=Ice::emptyCurrent) override
Definition: SegmentRansacShapeExtractor.cpp:290
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::SegmentRansacShapeExtractor::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SegmentRansacShapeExtractor.cpp:303
visionx::SegmentRansacShapeExtractor::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Definition: SegmentRansacShapeExtractor.cpp:126
visionx::SegmentRansacShapeExtractor::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Definition: SegmentRansacShapeExtractor.cpp:179
visionx::SegmentRansacShapeExtractorPropertyDefinitions
Property definitions of SegmentRansacShapeExtractor.
Definition: SegmentRansacShapeExtractor.h:46
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
visionx::SegmentRansacShapeExtractor
Brief description of class SegmentRansacShapeExtractor.
Definition: SegmentRansacShapeExtractor.h:64
visionx::SegmentRansacShapeExtractor::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: SegmentRansacShapeExtractor.cpp:184
visionx::SegmentRansacShapeExtractor::extractShapes
armarx::semantic::data::ShapeList extractShapes(const Ice::Current &=Ice::emptyCurrent) override
Definition: SegmentRansacShapeExtractor.cpp:251
DebugDrawerTopic.h
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:177
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:166
PointCloudProcessor.h
TaskUtil.h
Component.h
visionx::SegmentRansacShapeExtractor::process
void process() override
Definition: SegmentRansacShapeExtractor.cpp:189
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
visionx::SegmentRansacShapeExtractor::getDefaultName
std::string getDefaultName() const override
Definition: SegmentRansacShapeExtractor.cpp:297
visionx::SegmentRansacShapeExtractorPropertyDefinitions::SegmentRansacShapeExtractorPropertyDefinitions
SegmentRansacShapeExtractorPropertyDefinitions(std::string prefix)
Definition: SegmentRansacShapeExtractor.cpp:38
shapes
MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > shapes
Definition: ReadMe.txt:92