LaserScannerPointCloudProvider.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::LaserScannerPointCloudProvider
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
27
28#include <RobotAPI/interface/units/LaserScannerUnit.h>
30
32#include <VisionX/interface/components/LaserScannerPointCloudProvider.h>
33
34#pragma GCC diagnostic push
35#include <pcl/common/transforms.h>
36#include <pcl/filters/statistical_outlier_removal.h>
37#pragma GCC diagnostic ignored "-Wpedantic"
38#pragma GCC diagnostic pop
39
40#include <mutex>
41
42#include <Eigen/Core>
43
44#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
45
46namespace armarx
47{
48
49 /**
50 * @class LaserScannerPointCloudProviderPropertyDefinitions
51 * @brief
52 */
55 {
56 public:
59 {
60 defineOptionalProperty<std::string>("LaserScannerUnitName",
61 "LaserScannerSimulation",
62 "The name of the laser scanner provider");
64 "RobotStateComponentName",
65 "RobotStateComponent",
66 "Name of the robot state component that should be used");
67 }
68 };
69
70 /**
71 * @defgroup Component-LaserScannerPointCloudProvider LaserScannerPointCloudProvider
72 * @ingroup VisionX-Components
73 * A description of the component LaserScannerPointCloudProvider.
74 *
75 * @class LaserScannerPointCloudProvider
76 * @ingroup Component-LaserScannerPointCloudProvider
77 * @brief Brief description of class LaserScannerPointCloudProvider.
78 *
79 * Detailed description of class LaserScannerPointCloudProvider.
80 */
82 virtual public visionx::PointCloudProvider,
83 virtual public armarx::LaserScannerPointCloudProviderInterface
84 {
85 public:
86 /**
87 * @see armarx::ManagedIceObject::getDefaultName()
88 */
89 std::string
90 getDefaultName() const override
91 {
92 return "LaserScannerPointCloudProvider";
93 }
94
95 void reportSensorValues(const std::string&,
96 const std::string&,
97 const LaserScan&,
98 const TimestampBasePtr&,
99 const Ice::Current& c = Ice::emptyCurrent) override;
100
101 std::string
102 getReferenceFrame(const Ice::Current& c = Ice::emptyCurrent) override
103 {
104 return localRobot->getRootNode()->getName();
105 }
106
107
108 protected:
109 void onInitPointCloudProvider() override;
110 void onConnectPointCloudProvider() override;
111 void onExitPointCloudProvider() override;
112
113
114 /**
115 * @see PropertyUser::createPropertyDefinitions()
116 */
118
119 visionx::MetaPointCloudFormatPtr getDefaultPointCloudFormat() override;
120
121 private:
122 std::map<std::string, std::string> deviceToFrame;
123 std::mutex mutex;
124
125 RobotStateComponentInterfacePrx robotStateComponent;
126 VirtualRobot::RobotPtr localRobot;
127 // LaserScannerUnitInterfacePrx laserScanner;
128
129 std::map<std::string, pcl::PointCloud<pcl::PointXYZ>> clouds;
130 pcl::PointCloud<pcl::PointXYZ>::Ptr resultCloud;
131
132 pcl::StatisticalOutlierRemoval<pcl::PointXYZ> filter;
133 };
134} // namespace armarx
constexpr T c
Brief description of class LaserScannerPointCloudProvider.
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
void reportSensorValues(const std::string &, const std::string &, const LaserScan &, const TimestampBasePtr &, const Ice::Current &c=Ice::emptyCurrent) override
visionx::MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
void onConnectPointCloudProvider() override
This is called when the Component::onConnectComponent() setup is called.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
void onExitPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
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)
PointCloudProvider abstract class defines a component which provide point clouds via ice or shared me...
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
ArmarX headers.