PointCloudUtility.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::PointCloudUtility
19  * @author Tim Niklas Freudenstein ( uidnv at student dot 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 
29 #include <pcl/io/pcd_io.h>
30 #include <pcl/registration/icp.h>
31 #include <pcl/visualization/cloud_viewer.h>
33 #include <pcl/common/transforms.h>
34 #include <VirtualRobot/MathTools.h>
36 #include <pcl/filters/approximate_voxel_grid.h>
37 namespace armarx
38 {
39  /**
40  * @class PointCloudUtilityPropertyDefinitions
41  * @brief
42  */
45  {
46  public:
49  {
50  defineRequiredProperty<std::string>("PointCloud1", "FileName1");
51  defineOptionalProperty<std::string>("PointCloud2", "", "FileName2");
52  defineOptionalProperty<bool>("Merge", true, "If set the program merges PointCloud1 and PointCloud2");
53  defineOptionalProperty<bool>("Transform", true, "If set the program transforms the merged Pointcloud or Pointcloud1");
54  defineOptionalProperty<bool>("Show", true, "If set the program shows the merged/transformed Pointcloud or Pointcloud1");
55  defineOptionalProperty<std::string>("ResultFileName", "result.pcd", "The filename of the output file");
56  defineOptionalProperty<float>("X", 0.0, "");
57  defineOptionalProperty<float>("Y", 0.0, "");
58  defineOptionalProperty<float>("Z", 0.0, "");
59  defineOptionalProperty<float>("Roll", 0.0, "");
60  defineOptionalProperty<float>("Pitch", 0.0, "");
61  defineOptionalProperty<float>("Yaw", 0.0, "");
62 
63  }
64  };
65 
66  /**
67  * @defgroup Component-PointCloudUtility PointCloudUtility
68  * @ingroup VisionX-Components
69  * A description of the component PointCloudUtility.
70  *
71  * @class PointCloudUtility
72  * @ingroup Component-PointCloudUtility
73  * @brief Brief description of class PointCloudUtility.
74  *
75  * Detailed description of class PointCloudUtility.
76  */
78  virtual public armarx::Component
79  {
80  public:
81  /**
82  * @see armarx::ManagedIceObject::getDefaultName()
83  */
84  std::string getDefaultName() const override
85  {
86  return "PointCloudUtility";
87  }
88  private:
89  void fusePointclouds(std::string file1, std::string file2, std::string out);
90  pcl::PointCloud<pcl::PointXYZRGBA>::Ptr loadPointCloud(std::string filename);
91  void moveOrigin(std::string file, std::string out, Eigen::Vector3f translation);
92  void rotatePointCloud(std::string file, std::string out, Eigen::Matrix3f rotation);
93  void transformPointcloud(std::string file, std::string out, Eigen::Matrix4f pose);
94  void showResult(std::string file);
96  void process();
97  protected:
98  /**
99  * @see armarx::ManagedIceObject::onInitComponent()
100  */
101  void onInitComponent() override;
102 
103  /**
104  * @see armarx::ManagedIceObject::onConnectComponent()
105  */
106  void onConnectComponent() override;
107 
108  /**
109  * @see armarx::ManagedIceObject::onDisconnectComponent()
110  */
111  void onDisconnectComponent() override;
112 
113  /**
114  * @see armarx::ManagedIceObject::onExitComponent()
115  */
116  void onExitComponent() override;
117 
118  /**
119  * @see PropertyUser::createPropertyDefinitions()
120  */
122 
123 
124  };
125 }
armarx::PointCloudUtility::onConnectComponent
void onConnectComponent() override
Definition: PointCloudUtility.cpp:179
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::PointCloudUtility::onExitComponent
void onExitComponent() override
Definition: PointCloudUtility.cpp:192
RunningTask.h
armarx::PointCloudUtility
Brief description of class PointCloudUtility.
Definition: PointCloudUtility.h:77
armarx::PointCloudUtility::onInitComponent
void onInitComponent() override
Definition: PointCloudUtility.cpp:146
armarx::PointCloudUtility::getDefaultName
std::string getDefaultName() const override
Definition: PointCloudUtility.h:84
filename
std::string filename
Definition: VisualizationRobot.cpp:83
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::PointCloudUtilityPropertyDefinitions::PointCloudUtilityPropertyDefinitions
PointCloudUtilityPropertyDefinitions(std::string prefix)
Definition: PointCloudUtility.h:47
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::PointCloudUtilityPropertyDefinitions
Definition: PointCloudUtility.h:43
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::PointCloudUtility::onDisconnectComponent
void onDisconnectComponent() override
Definition: PointCloudUtility.cpp:185
IceUtil::Handle
Definition: forward_declarations.h:29
ArmarXDataPath.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PointCloudUtility::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudUtility.cpp:197