PointCloudFilter.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::PointCloudFilter
19 * @author Markus Grotz ( markus dot grotz at kit dot edu )
20 * @date 2016
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <mutex>
28
29#include <Eigen/Core>
30
31#include <pcl/common/transforms.h>
32#include <pcl/filters/approximate_voxel_grid.h>
33#include <pcl/filters/crop_hull.h>
34#include <pcl/filters/filter.h>
35#include <pcl/filters/passthrough.h>
36#include <pcl/point_types.h>
37
40
41#include <ArmarXGui/interface/RemoteGuiInterface.h>
43
44#include <RobotAPI/interface/core/PoseBase.h>
45#include <RobotAPI/interface/core/RobotState.h>
48
50#include <VisionX/interface/components/PointCloudFilter.h>
51
52namespace visionx
53{
54 class CoordinateFrame;
55 template <class PointT>
56 class FramedPointCloud;
57
58 /// @class PointCloudFilterPropertyDefinitions
65
66 /**
67 * @defgroup Component-PointCloudFilter PointCloudFilter
68 * @ingroup VisionX-Components
69 * A description of the component PointCloudFilter.
70 *
71 * @class PointCloudFilter
72 * @ingroup Component-PointCloudFilter
73 * @brief Brief description of class PointCloudFilter.
74 *
75 * Detailed description of class PointCloudFilter.
76 */
78 virtual public armarx::PointCloudFilterInterface,
79 virtual public visionx::PointCloudProcessor
80 {
81 public:
82 /// @see armarx::ManagedIceObject::getDefaultName()
83 static std::string GetDefaultName();
84 std::string getDefaultName() const override;
85
86 virtual std::string getReferenceFrame(const Ice::Current& = Ice::emptyCurrent) override;
87
88 virtual void setCroppingParameters(const armarx::Vector3BasePtr& min,
89 const armarx::Vector3BasePtr& max,
90 const std::string& frame,
91 const Ice::Current& = Ice::emptyCurrent) override;
92
93 protected:
94 /// @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
95 virtual void onInitPointCloudProcessor() override;
96
97 /// @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
98 virtual void onConnectPointCloudProcessor() override;
99
100 /// @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
101 virtual void onDisconnectPointCloudProcessor() override;
102
103 /// @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
104 virtual void onExitPointCloudProcessor() override;
105
106 /// @see visionx::PointCloudProcessor::process()
107 virtual void process() override;
108
109 template <typename PointType>
110 void processPointCloud();
111
112 /// @see PropertyUser::createPropertyDefinitions()
114
115
116 private:
117 /// Draw the given frame with given role.
118 void drawFrame(const armarx::FramedPose& frame, const std::string& role);
119
120 /// Change the point cloud to given frame.
121 /// Also logs transformation and draws target frame.
122 template <typename PointT>
123 void changePointCloudFrame(FramedPointCloud<PointT>& pointCloud,
124 const std::string& role,
125 const std::string& frame);
126
127 /// Create the remote gui. May only be called if `remoteGui` is not nullptr.
128 void remoteGuiCreate();
129 /// Create the remote gui. May only be called if `remoteGui` is not nullptr.
130 void remoteGuiRun();
131
132 void remoteGuiUpdate(armarx::RemoteGui::TabProxy& tab);
133
134
135 private:
136 // Robot
137 armarx::RobotStateComponentInterfacePrx robotStateComponent;
138 VirtualRobot::RobotPtr localRobot;
139
140 std::string pointCloudFormat;
141 std::string providerSourceFrameName; ///< Point cloud frame specified by provider.
142
143 struct Parameters
144 {
145 // Frames
146 std::string sourceFrameName;
147 std::string targetFrameName;
148
149 // Cropping
150 bool croppingEnabled;
151 Eigen::Vector3f croppingMinPoint;
152 Eigen::Vector3f croppingMaxPoint;
153 Eigen::Vector3f croppingRPY;
154 std::string croppingFrameName;
155
156 //SOR
158 {
159 bool enabled = false;
161 int meanK = 50;
162 };
163
164 StatisticalOutlierRemoval statisticalOutlierRemoval;
165
166 // Downsampling
167 bool downsamplingEnabled;
168 float gridLeafSize;
169
170 // Collision model filter
171 bool applyCollisionModelFilter;
172
173 bool reportCloudOutsideOfCroppingArea = false;
174
175 Eigen::Matrix4f providerFrameTransformation = Eigen::Matrix4f::Identity();
176 };
177
178 std::mutex parametersMutex;
179 Parameters parameters;
180
181
182 // Remote GUI
183 /// The remote GUI proxy. Only fetched when property `RemoteGuiEnabled` is true.
184 armarx::RemoteGuiInterfacePrx remoteGui;
185 /// The remote GUI tab.
186 armarx::RemoteGui::TabProxy remoteGuiTab;
187 /// The remote GUI main thread.
189
190
191 // Debug Drawer
193 };
194} // namespace visionx
The DebugDrawerTopic wraps a DebugDrawerInterfacePrx and provides a more useful interface than the Ic...
The FramedPose class.
Definition FramedPose.h:281
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
A point cloud which keeps track of its reference coordinate frame and allows changing frames using ar...
Brief description of class PointCloudFilter.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
virtual void process() override
virtual void onExitPointCloudProcessor() override
virtual std::string getReferenceFrame(const Ice::Current &=Ice::emptyCurrent) override
virtual void onConnectPointCloudProcessor() override
virtual void onDisconnectPointCloudProcessor() override
static std::string GetDefaultName()
virtual void setCroppingParameters(const armarx::Vector3BasePtr &min, const armarx::Vector3BasePtr &max, const std::string &frame, const Ice::Current &=Ice::emptyCurrent) override
virtual void onInitPointCloudProcessor() override
std::string getDefaultName() const override
Retrieve default name of component.
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
T min(T t1, T t2)
Definition gdiam.h:44
T max(T t1, T t2)
Definition gdiam.h:51
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
ArmarX headers.