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