MultiViewPointCloudProcessor.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::MultiViewPointCloudProcessor
17  * @author Raphael Grimm ( raphael dot grimm 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 <any>
26 
30 
32 
34 
36 #include <VisionX/interface/components/MultiViewPointCloudProcessor.h>
37 
38 
40  armarx::cfg::MVPCLProc,
41  Config,
42  (float,
43  gridSize,
44  AX_DEFAULT(50),
45  AX_MIN(0),
46  AX_MAX(10'000),
47  AX_DESCRIPTION("Grid size for approximate voxel grid (0 = disabled)")),
48  (float, frameRate, AX_DEFAULT(30), AX_MIN(0), AX_MAX(300)),
49  (int, maxNumberOfFramesPerViewPoint, AX_DEFAULT(100), AX_MIN(1), AX_MAX(1000)));
50 
51 namespace armarx
52 {
53  /**
54  * @defgroup Component-MultiViewPointCloudProcessor MultiViewPointCloudProcessor
55  * @ingroup VisionX-Components
56  * A description of the component MultiViewPointCloudProcessor.
57  *
58  * @class MultiViewPointCloudProcessor
59  * @ingroup Component-MultiViewPointCloudProcessor
60  * @brief Brief description of class MultiViewPointCloudProcessor.
61  *
62  * Detailed description of class MultiViewPointCloudProcessor.
63  */
64  class MultiViewPointCloudProcessor :
65  virtual public visionx::MultiViewPointCloudProcessorInterface,
66  virtual public visionx::PointCloudProcessor,
67  virtual public armarx::RobotStateComponentPluginUser,
68  virtual public DebugObserverComponentPluginUser,
69  virtual public RemoteGuiComponentPluginUser
70  {
71  public:
72  /// @see armarx::ManagedIceObject::getDefaultName()
73  std::string getDefaultName() const override;
74 
75  //ice interface
76  void startRecordingNextViewPoint(const Ice::Current& = Ice::emptyCurrent) override;
77  void stopRecordingViewPoint(const Ice::Current& = Ice::emptyCurrent) override;
78  void clearViewPoints(const Ice::Current& = Ice::emptyCurrent) override;
79  void setMaxNumberOfFramesPerViewPoint(Ice::Int n,
80  const Ice::Current& = Ice::emptyCurrent) override;
81  void setDownsamplingGridSize(Ice::Float s,
82  const Ice::Current& = Ice::emptyCurrent) override;
83  void setFrameRate(Ice::Float r, const Ice::Current& = Ice::emptyCurrent) override;
84 
85  protected:
86  RemoteGui::WidgetPtr buildGui();
87  void processGui(RemoteGui::TabProxy& prx);
88 
89  void process() override;
90  template <class PointType>
91  void process();
92  template <class PointType>
93  void doProvide();
94 
95  void onInitPointCloudProcessor() override;
96  void onConnectPointCloudProcessor() override;
97 
98  void
99  onDisconnectPointCloudProcessor() override
100  {
101  }
102 
103  void onExitPointCloudProcessor() override;
104 
105  /// @see PropertyUser::createPropertyDefinitions()
106  armarx::PropertyDefinitionsPtr createPropertyDefinitions() override;
107 
108  private:
109  //provider data
110  std::string _pointCloudProviderName;
111  visionx::PointCloudProviderInfo _pointCloudProviderInfo;
112  visionx::PointCloudProviderInterfacePrx _pointCloudProvider;
113  std::string _pointCloudProviderRefFrame;
114 
115  mutable std::recursive_mutex _cfgBufWriteMutex;
116  mutable std::recursive_mutex _cfgBufReadMutex;
117  WriteBufferedTripleBuffer<cfg::MVPCLProc::Config> _cfgBuf;
118 
119 
120  VirtualRobot::RobotPtr _robot;
121 
122  struct ViewPoint
123  {
124  std::deque<std::any> clouds;
125  };
126 
127  mutable std::recursive_mutex _viewPointsMutex;
128  std::deque<ViewPoint> _viewPoints;
129  std::atomic_int _currentViewpoint = -1;
130  std::atomic_bool _doRecord = false;
131  std::atomic_bool _doClear = false;
132 
133  std::thread _providerThread;
134  std::atomic_bool _stopProviding = false;
135  };
136 } // namespace armarx
RobotStateComponentPlugin.h
DebugObserverComponentPlugin.h
ARMARX_CONFIG_STRUCT_DEFINE_ADAPT_CONFIGURE
ARMARX_CONFIG_STRUCT_DEFINE_ADAPT_CONFIGURE(armarx::cfg::MVPCLProc, Config,(float, gridSize, AX_DEFAULT(50), AX_MIN(0), AX_MAX(10 '000), AX_DESCRIPTION("Grid size for approximate voxel grid (0 = disabled)")),(float, frameRate, AX_DEFAULT(30), AX_MIN(0), AX_MAX(300)),(int, maxNumberOfFramesPerViewPoint, AX_DEFAULT(100), AX_MIN(1), AX_MAX(1000)))
PointCloudProcessor.h
PluginAll.h
Component.h
RemoteGuiComponentPlugin.h