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 
27 
29 
30 #include <ArmarXCore/interface/observers/ObserverInterface.h>
31 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
32 
34 
35 #include <pcl/point_types.h>
36 
37 #include <pcl/io/pcd_io.h>
38 
39 
41 
42 
43 
44 namespace armarx
45 {
46 
47  using PointT = pcl::PointXYZRGBL;
48 
49  /**
50  * @class PointCloudRecorderPropertyDefinitions
51  * @brief
52  */
55  {
56  public:
59  {
60  defineOptionalProperty<std::string>("Folder", "/tmp", "Path where to store the point clouds.");
61  defineOptionalProperty<std::string>("DebugObserverName", "DebugObserver", "Name of the topic the DebugObserver listens on");
62  defineOptionalProperty<std::string>("DebugDrawerTopicName", "DebugDrawerUpdates", "Name of the DebugDrawerTopic");
63  defineOptionalProperty<float>("UpdateRate", 2.0f, "Frequency how often the voxel grid is updated");
64  defineOptionalProperty<int>("NumPointClouds", 0, "Number of point clouds before exiting");
65  defineOptionalProperty<bool>("WriteBinary", true, "If enabled, the point clouds will be stored in binary format. Otherwise, in ASCII format.");
66  defineOptionalProperty<bool>("RemoveNaNs", true, "If enabled, invalid points will be removed from the point cloud.");
67  }
68  };
69 
70  /**
71  * @defgroup Component-PointCloudRecorder PointCloudRecorder
72  * @ingroup VisionX-Components
73  * A description of the component PointCloudRecorder.
74  *
75  * @class PointCloudRecorder
76  * @ingroup Component-PointCloudRecorder
77  * @brief Brief description of class PointCloudRecorder.
78  *
79  * Detailed description of class PointCloudRecorder.
80  */
81 
83  virtual public visionx::PointCloudProcessor
84  {
85  public:
86  /**
87  * @see armarx::ManagedIceObject::getDefaultName()
88  */
89  std::string getDefaultName() const override
90  {
91  return "PointCloudRecorder";
92  }
93 
94  protected:
95  /**
96  * @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
97  */
98  void onInitPointCloudProcessor() override;
99 
100  /**
101  * @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
102  */
103  void onConnectPointCloudProcessor() override;
104 
105  /**
106  * @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
107  */
108  void onDisconnectPointCloudProcessor() override;
109 
110  /**
111  * @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
112  */
113  void onExitPointCloudProcessor() override;
114 
115  /**
116  * @see visionx::PointCloudProcessor::process()
117  */
118  void process() override;
119 
120  /**
121  * @see PropertyUser::createPropertyDefinitions()
122  */
124 
125 
126  private:
127 
128  DebugDrawerInterfacePrx debugDrawer;
129  DebugObserverInterfacePrx debugObserver;
130 
131 
132  std::unique_ptr<armarx::CycleUtil> cycleKeeper;
133 
134  int numClouds;
135  int currentCloud;
136 
137  bool writeBinary;
138  bool removeNaNs;
139  };
140 }
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:333
armarx::PointCloudRecorderPropertyDefinitions
Definition: PointCloudRecorder.h:53
visionx::PointCloudProcessorPropertyDefinitions::PointCloudProcessorPropertyDefinitions
PointCloudProcessorPropertyDefinitions(std::string prefix)
Definition: PointCloudProcessor.cpp:111
armarx::PointCloudRecorder::process
void process() override
Definition: PointCloudRecorder.cpp:78
armarx::PointCloudRecorderPropertyDefinitions::PointCloudRecorderPropertyDefinitions
PointCloudRecorderPropertyDefinitions(std::string prefix)
Definition: PointCloudRecorder.h:57
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:186
armarx::PointT
pcl::PointXYZRGBL PointT
Definition: Common.h:28
armarx::PointCloudRecorder::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudRecorder.cpp:36
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:173
PointCloudProcessor.h
Component.h
CycleUtil.h
armarx::PointCloudRecorder::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:59
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:70
armarx::PointCloudRecorder
Brief description of class PointCloudRecorder.
Definition: PointCloudRecorder.h:82
armarx::PointCloudRecorder::getDefaultName
std::string getDefaultName() const override
Definition: PointCloudRecorder.h:89
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PointCloudRecorder::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: PointCloudRecorder.cpp:74