PointCloudToArViz.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::PointCloudToArViz
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <map>
26 #include <mutex>
27 #include <optional>
28 #include <VirtualRobot/VirtualRobot.h>
29 
31 
33 
38 
39 // The has_member macro from
40 // > simox/SimoxUtility/meta/has_member_macros/has_member.hpp
41 // breaks compilation here if boost thread is not already included
42 #ifdef has_member
43 #undef has_member
44 #endif
45 
46 #include <VisionX/interface/components/PointCloudToArViz.h>
48 
49 namespace visionx
50 {
51 
58  {
59  public:
61  };
62 
63 
77  virtual public visionx::PointCloudToArVizInterface
78  , virtual public visionx::PointCloudProcessor
79  , virtual public armarx::ArVizComponentPluginUser
81  {
82  public:
84 
86  std::string getDefaultName() const override;
87 
88  virtual void setPointSizeInPixels(float pointSizeInPixels, const Ice::Current& = Ice::emptyCurrent) override;
89  virtual void setCustomTransform(const armarx::PoseBasePtr& transform, const Ice::Current& = Ice::emptyCurrent) override;
90 
91 
92  protected:
93 
95  void onInitPointCloudProcessor() override;
96 
98  void onConnectPointCloudProcessor() override;
99 
101  void onDisconnectPointCloudProcessor() override;
102 
104  void onExitPointCloudProcessor() override;
105 
106 
108  void process() override;
109 
110 
113 
114 
115  // LightweightRemoteGuiComponentPluginUser interface
116  public:
117 
118  void createRemoteGuiTab();
119  void RemoteGui_update() override;
120 
121 
122  private:
123 
124  struct Parameters
125  {
127  IceUtil::Time providerWaitTime = IceUtil::Time::milliSeconds(100);
128 
130  bool checkFinite = false;
131 
133  float pointSizeInPixels = 1;
134 
136  bool labeled = false;
137 
139  // std::optional<Eigen::Matrix4f> customTransform;
140 
141 
142  std::string robotName = "Armar6";
143 
144  // If the point cloud header does not provide a frame id, this info is used.
145  std::string pointCloudNodeName;
146 
147  };
148  std::mutex paramMutex;
149  Parameters params;
150 
151  template <class PointT>
152  void applyCustomTransform(pcl::PointCloud<PointT>& pointCloud);
153 
154 
156  std::map<std::string, armarx::viz::PointCloud> cache;
157 
158 
159  struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
160  {
162  armarx::RemoteGui::Client::FloatSpinBox pointSizeInPixels;
164  };
165  RemoteGuiTab tab;
166 
167 
169  armarx::armem::robot_state::VirtualRobotReader>* virtualRobotReaderPlugin = nullptr;
170 
171  VirtualRobot::RobotPtr robot;
172 
173  };
174 }
ArVizComponentPlugin.h
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:41
visionx::PointCloudToArViz::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudToArViz.cpp:47
visionx::PointCloudToArViz::setPointSizeInPixels
virtual void setPointSizeInPixels(float pointSizeInPixels, const Ice::Current &=Ice::emptyCurrent) override
Definition: PointCloudToArViz.cpp:153
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::PointCloudToArViz::process
void process() override
Definition: PointCloudToArViz.cpp:103
visionx::PointCloudToArVizPropertyDefinitions
Property definitions of PointCloudToArViz.
Definition: PointCloudToArViz.h:56
armarx::armem::client::plugins::ReaderWriterPlugin
A component plugin offering client-side access to a reader or writer and manages the lifecycle,...
Definition: ReaderWriterPlugin.h:45
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
ReaderWriterPlugin.h
visionx::PointCloudToArVizPropertyDefinitions::PointCloudToArVizPropertyDefinitions
PointCloudToArVizPropertyDefinitions(std::string prefix)
Definition: PointCloudToArViz.cpp:40
LightweightRemoteGuiComponentPlugin.h
visionx::PointCloudToArViz::PointCloudToArViz
PointCloudToArViz()
Definition: PointCloudToArViz.cpp:64
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:186
visionx::PointCloudToArViz::RemoteGui_update
void RemoteGui_update() override
Definition: PointCloudToArViz.cpp:249
VirtualRobotReader.h
visionx::PointCloudToArViz::getDefaultName
std::string getDefaultName() const override
Definition: PointCloudToArViz.cpp:70
visionx::PointCloudToArViz::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Definition: PointCloudToArViz.cpp:94
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:173
PointCloudProcessor.h
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
plugins.h
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
Component.h
visionx::PointCloudToArViz::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Definition: PointCloudToArViz.cpp:76
visionx::PointCloudToArViz
Brief description of class PointCloudToArViz.
Definition: PointCloudToArViz.h:76
visionx::PointCloudToArViz::createRemoteGuiTab
void createRemoteGuiTab()
Definition: PointCloudToArViz.cpp:219
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::transform
auto transform(const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
Convenience function (with less typing) to transform a container of type InputT into the same contain...
Definition: algorithm.h:315
armarx::RemoteGui::Client::CheckBox
Definition: Widgets.h:129
visionx::PointCloudToArViz::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: PointCloudToArViz.cpp:82
visionx::PointCloudToArViz::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: PointCloudToArViz.cpp:98
armarx::RemoteGui::Client::FloatSpinBox
Definition: Widgets.h:93
visionx::PointCloudToArViz::setCustomTransform
virtual void setCustomTransform(const armarx::PoseBasePtr &transform, const Ice::Current &=Ice::emptyCurrent) override
Definition: PointCloudToArViz.cpp:159