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 
46 namespace 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");
63  defineOptionalProperty<std::string>(
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
RemoteRobot.h
armarx::LaserScannerPointCloudProviderPropertyDefinitions
Definition: LaserScannerPointCloudProvider.h:53
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:345
PointCloudProvider.h
armarx::LaserScannerPointCloudProviderPropertyDefinitions::LaserScannerPointCloudProviderPropertyDefinitions
LaserScannerPointCloudProviderPropertyDefinitions(std::string prefix)
Definition: LaserScannerPointCloudProvider.h:57
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::LaserScannerPointCloudProvider::getReferenceFrame
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LaserScannerPointCloudProvider.h:102
armarx::LaserScannerPointCloudProvider::getDefaultPointCloudFormat
visionx::MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
Definition: LaserScannerPointCloudProvider.cpp:147
armarx::LaserScannerPointCloudProvider::onConnectPointCloudProvider
void onConnectPointCloudProvider() override
This is called when the Component::onConnectComponent() setup is called.
Definition: LaserScannerPointCloudProvider.cpp:44
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:90
Component.h
armarx::LaserScannerPointCloudProvider::onInitPointCloudProvider
void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
Definition: LaserScannerPointCloudProvider.cpp:33
armarx::LaserScannerPointCloudProvider
Brief description of class LaserScannerPointCloudProvider.
Definition: LaserScannerPointCloudProvider.h:81
armarx::LaserScannerPointCloudProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: LaserScannerPointCloudProvider.cpp:135
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:65
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::LaserScannerPointCloudProvider::onExitPointCloudProvider
void onExitPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
Definition: LaserScannerPointCloudProvider.cpp:60
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:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19