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