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
28#include <pcl/common/transforms.h>
29#include <pcl/filters/approximate_voxel_grid.h>
30#include <pcl/io/pcd_io.h>
31#include <pcl/registration/icp.h>
32#include <pcl/visualization/cloud_viewer.h>
33
34#include <VirtualRobot/MathTools.h>
35
39
40namespace armarx
41{
42 /**
43 * @class PointCloudUtilityPropertyDefinitions
44 * @brief
45 */
47 {
48 public:
51 {
52 defineRequiredProperty<std::string>("PointCloud1", "FileName1");
53 defineOptionalProperty<std::string>("PointCloud2", "", "FileName2");
55 "Merge", true, "If set the program merges PointCloud1 and PointCloud2");
57 "Transform",
58 true,
59 "If set the program transforms the merged Pointcloud or Pointcloud1");
61 "Show",
62 true,
63 "If set the program shows the merged/transformed Pointcloud or Pointcloud1");
65 "ResultFileName", "result.pcd", "The filename of the output file");
69 defineOptionalProperty<float>("Roll", 0.0, "");
70 defineOptionalProperty<float>("Pitch", 0.0, "");
71 defineOptionalProperty<float>("Yaw", 0.0, "");
72 }
73 };
74
75 /**
76 * @defgroup Component-PointCloudUtility PointCloudUtility
77 * @ingroup VisionX-Components
78 * A description of the component PointCloudUtility.
79 *
80 * @class PointCloudUtility
81 * @ingroup Component-PointCloudUtility
82 * @brief Brief description of class PointCloudUtility.
83 *
84 * Detailed description of class PointCloudUtility.
85 */
86 class PointCloudUtility : virtual public armarx::Component
87 {
88 public:
89 /**
90 * @see armarx::ManagedIceObject::getDefaultName()
91 */
92 std::string
93 getDefaultName() const override
94 {
95 return "PointCloudUtility";
96 }
97
98 private:
99 void fusePointclouds(std::string file1, std::string file2, std::string out);
100 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr loadPointCloud(std::string filename);
101 void moveOrigin(std::string file, std::string out, Eigen::Vector3f translation);
102 void rotatePointCloud(std::string file, std::string out, Eigen::Matrix3f rotation);
103 void transformPointcloud(std::string file, std::string out, Eigen::Matrix4f pose);
104 void showResult(std::string file);
106 void process();
107
108 protected:
109 /**
110 * @see armarx::ManagedIceObject::onInitComponent()
111 */
112 void onInitComponent() override;
113
114 /**
115 * @see armarx::ManagedIceObject::onConnectComponent()
116 */
117 void onConnectComponent() override;
118
119 /**
120 * @see armarx::ManagedIceObject::onDisconnectComponent()
121 */
122 void onDisconnectComponent() override;
123
124 /**
125 * @see armarx::ManagedIceObject::onExitComponent()
126 */
127 void onExitComponent() override;
128
129 /**
130 * @see PropertyUser::createPropertyDefinitions()
131 */
133 };
134} // namespace armarx
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Brief description of class PointCloudUtility.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getDefaultName() const override
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.