PointCloudRecorder.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::PointCloudRecorder
17  * @author Markus Grotz ( markus dot grotz at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
26 #include <pcl/io/pcd_io.h>
27 #include <pcl/point_types.h>
28 
31 #include <ArmarXCore/interface/observers/ObserverInterface.h>
32 
33 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
34 
36 
37 namespace armarx
38 {
39 
40  using PointT = pcl::PointXYZRGBL;
41 
42  /**
43  * @class PointCloudRecorderPropertyDefinitions
44  * @brief
45  */
48  {
49  public:
52  {
53  defineOptionalProperty<std::string>(
54  "Folder", "/tmp", "Path where to store the point clouds.");
55  defineOptionalProperty<std::string>("DebugObserverName",
56  "DebugObserver",
57  "Name of the topic the DebugObserver listens on");
58  defineOptionalProperty<std::string>(
59  "DebugDrawerTopicName", "DebugDrawerUpdates", "Name of the DebugDrawerTopic");
60  defineOptionalProperty<float>(
61  "UpdateRate", 2.0f, "Frequency how often the voxel grid is updated");
62  defineOptionalProperty<int>(
63  "NumPointClouds", 0, "Number of point clouds before exiting");
64  defineOptionalProperty<bool>("WriteBinary",
65  true,
66  "If enabled, the point clouds will be stored in binary "
67  "format. Otherwise, in ASCII format.");
68  defineOptionalProperty<bool>(
69  "RemoveNaNs",
70  true,
71  "If enabled, invalid points will be removed from the point cloud.");
72  }
73  };
74 
75  /**
76  * @defgroup Component-PointCloudRecorder PointCloudRecorder
77  * @ingroup VisionX-Components
78  * A description of the component PointCloudRecorder.
79  *
80  * @class PointCloudRecorder
81  * @ingroup Component-PointCloudRecorder
82  * @brief Brief description of class PointCloudRecorder.
83  *
84  * Detailed description of class PointCloudRecorder.
85  */
86 
88  {
89  public:
90  /**
91  * @see armarx::ManagedIceObject::getDefaultName()
92  */
93  std::string
94  getDefaultName() const override
95  {
96  return "PointCloudRecorder";
97  }
98 
99  protected:
100  /**
101  * @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
102  */
103  void onInitPointCloudProcessor() override;
104 
105  /**
106  * @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
107  */
108  void onConnectPointCloudProcessor() override;
109 
110  /**
111  * @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
112  */
113  void onDisconnectPointCloudProcessor() override;
114 
115  /**
116  * @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
117  */
118  void onExitPointCloudProcessor() override;
119 
120  /**
121  * @see visionx::PointCloudProcessor::process()
122  */
123  void process() override;
124 
125  /**
126  * @see PropertyUser::createPropertyDefinitions()
127  */
129 
130 
131  private:
132  DebugDrawerInterfacePrx debugDrawer;
133  DebugObserverInterfacePrx debugObserver;
134 
135 
136  std::unique_ptr<armarx::CycleUtil> cycleKeeper;
137 
138  int numClouds;
139  int currentCloud;
140 
141  bool writeBinary;
142  bool removeNaNs;
143  };
144 } // namespace armarx
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::PointCloudRecorderPropertyDefinitions
Definition: PointCloudRecorder.h:46
visionx::PointCloudProcessorPropertyDefinitions::PointCloudProcessorPropertyDefinitions
PointCloudProcessorPropertyDefinitions(std::string prefix)
Definition: PointCloudProcessor.cpp:121
armarx::PointCloudRecorder::process
void process() override
Definition: PointCloudRecorder.cpp:83
armarx::PointCloudRecorderPropertyDefinitions::PointCloudRecorderPropertyDefinitions
PointCloudRecorderPropertyDefinitions(std::string prefix)
Definition: PointCloudRecorder.h:50
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:177
armarx::PointT
pcl::PointXYZRGBL PointT
Definition: Common.h:30
armarx::PointCloudRecorder::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudRecorder.cpp:36
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:166
PointCloudProcessor.h
Component.h
CycleUtil.h
armarx::PointCloudRecorder::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:60
armarx::PointCloudRecorder::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:44
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::PointCloudRecorder::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:73
armarx::PointCloudRecorder
Brief description of class PointCloudRecorder.
Definition: PointCloudRecorder.h:87
armarx::PointCloudRecorder::getDefaultName
std::string getDefaultName() const override
Definition: PointCloudRecorder.h:94
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::PointCloudRecorder::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:78