PointCloudVisualization.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::PointCloudVisualization
17 * @author Peter Kaiser ( peter dot kaiser 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#include <memory>
26#include <mutex>
27
30
31#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
32
34#include <VisionX/interface/components/PointCloudVisualization.h>
35#include <VisionX/interface/core/DataTypes.h>
36#include <VisionX/interface/core/PointCloudProviderInterface.h>
37
38namespace visionx
39{
41
42 // Wrapper object used to monitor one provider and call a parameterized callback in the main component
58
59 using PointCloudVisualizationHandlerPtr = std::shared_ptr<PointCloudVisualizationHandler>;
60
61 /**
62 * @class PointCloudVisualizationPropertyDefinitions
63 * @brief
64 */
66 {
67 public:
70 {
72 "PointCloudProviders", "", "Comma-separated list of point cloud provider names");
73 defineOptionalProperty<std::string>("InitiallyDisabledVisualizations",
74 "",
75 "Comma-separated list of point cloud provider "
76 "names, which should not be visualized by default");
78 "DebugDrawerTopicName", "DebugDrawerUpdates", "Name of the debug drawer topic");
80 "DefaultVisualizationType", "Plain", "Default point cloud visualization type.");
81 }
82 };
83
84 using DebugDrawerPointCloudPtr = std::shared_ptr<armarx::DebugDrawer24BitColoredPointCloud>;
86 std::map<visionx::PointContentType, DebugDrawerPointCloudPtr>;
87
88 /**
89 * @defgroup Component-PointCloudVisualization PointCloudVisualization
90 * @ingroup VisionX-Components
91 * A description of the component PointCloudVisualization.
92 *
93 * @class PointCloudVisualization
94 * @ingroup Component-PointCloudVisualization
95 * @brief Brief description of class PointCloudVisualization.
96 *
97 * Detailed description of class PointCloudVisualization.
98 */
100 virtual public PointCloudVisualizationInterface,
101 virtual public PointCloudProcessor
102 {
103 public:
104 /**
105 * @see armarx::ManagedIceObject::getDefaultName()
106 */
107 std::string
108 getDefaultName() const override
109 {
110 return "PointCloudVisualization";
111 }
112
113 void processPointCloudProvider(const std::string& providerName);
114
115 template <typename PointT>
116 void processPointCloud(const std::string& providerName);
117
118 bool waitForNewPointCloud(const std::string& providerName);
119
120 PointCloudProviderVisualizationInfoList
121 getAvailableProviders(const Ice::Current& c = Ice::emptyCurrent) override;
122 void enablePointCloudVisualization(const std::string& providerName,
123 visionx::PointContentType type,
124 bool enable,
125 const Ice::Current& c = Ice::emptyCurrent) override;
126 PointCloudVisualizationInfo
127 getCurrentPointCloudVisualizationInfo(const std::string& providerName,
128 const Ice::Current& c = Ice::emptyCurrent) override;
129
130 protected:
131 /**
132 * @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
133 */
134 void onInitPointCloudProcessor() override;
135
136 /**
137 * @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
138 */
139 void onConnectPointCloudProcessor() override;
140
141 /**
142 * @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
143 */
144 void onDisconnectPointCloudProcessor() override;
145
146 /**
147 * @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
148 */
149 void onExitPointCloudProcessor() override;
150
151 /**
152 * @see visionx::PointCloudProcessor::process()
153 */
154 void process() override;
155
156 /**
157 * @see PropertyUser::createPropertyDefinitions()
158 */
160
161 protected:
162 void updateVisualization(const std::string& providerName);
163 void clearAllLayers();
164 std::string pointCloudTypeToText(visionx::PointContentType type);
165 visionx::PointContentType pointCloudTextToType(std::string text);
166
167 protected:
169
170 std::vector<std::string> providerNames;
171 std::map<std::string, visionx::MetaPointCloudFormatPtr> pointCloudFormats;
172 std::map<std::string, PointCloudVisualizationHandlerPtr> providerHandlers;
173 std::map<std::string, visionx::PointContentType> visualizationTypes;
174 std::map<std::string, bool> enabledFlags;
175
176 std::map<std::string, PointCloudVisualizationCollection> visualizations;
177
178 std::map<std::string, int> debugDrawerVisualizationIteration;
179
180 std::mutex pointCloudMutex;
181 };
182} // namespace visionx
constexpr T c
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
armarx::RunningTask< PointCloudVisualizationHandler >::pointer_type task
PointCloudVisualizationHandler(PointCloudVisualization *component, const std::string &providerName)
Brief description of class PointCloudVisualization.
std::map< std::string, visionx::MetaPointCloudFormatPtr > pointCloudFormats
bool waitForNewPointCloud(const std::string &providerName)
std::map< std::string, PointCloudVisualizationCollection > visualizations
std::string pointCloudTypeToText(visionx::PointContentType type)
std::map< std::string, PointCloudVisualizationHandlerPtr > providerHandlers
PointCloudProviderVisualizationInfoList getAvailableProviders(const Ice::Current &c=Ice::emptyCurrent) override
std::vector< std::string > providerNames
std::map< std::string, int > debugDrawerVisualizationIteration
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void enablePointCloudVisualization(const std::string &providerName, visionx::PointContentType type, bool enable, const Ice::Current &c=Ice::emptyCurrent) override
std::map< std::string, bool > enabledFlags
void updateVisualization(const std::string &providerName)
armarx::DebugDrawerInterfacePrx debugDrawerTopicPrx
visionx::PointContentType pointCloudTextToType(std::string text)
std::map< std::string, visionx::PointContentType > visualizationTypes
void processPointCloudProvider(const std::string &providerName)
void processPointCloud(const std::string &providerName)
std::string getDefaultName() const override
PointCloudVisualizationInfo getCurrentPointCloudVisualizationInfo(const std::string &providerName, const Ice::Current &c=Ice::emptyCurrent) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
ArmarX headers.
std::map< visionx::PointContentType, DebugDrawerPointCloudPtr > PointCloudVisualizationCollection
std::shared_ptr< armarx::DebugDrawer24BitColoredPointCloud > DebugDrawerPointCloudPtr
std::shared_ptr< PointCloudVisualizationHandler > PointCloudVisualizationHandlerPtr