PrimitiveVisualization.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::PrimitiveVisualization
17 * @author Markus Grotz ( markus dot grotz at kit dot edu )
18 * @date 2016
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25
26#include <mutex>
27
29
30#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
33
34#include <VisionX/interface/components/PointCloudSegmenter.h>
35
37#include <MemoryX/interface/components/WorkingMemoryInterface.h>
39
40namespace armarx
41{
42
50
51 /**
52 * @class PrimitiveVisualizationPropertyDefinitions
53 * @brief
54 */
56 {
57 public:
60 {
62 "WorkingMemoryName", "WorkingMemory", "Name of WorkingMemory component");
64 "PlaneVisualizationMethod",
65 Hull,
66 "Visualize planes as boxes, as rectangles or as convex hulls")
67 .map("Inlier", Inlier)
68 .map("Hull", Hull)
69 .map("OBB", Obb)
70 .map("Box", Obb)
71 .map("ConvexHull", Hull)
72 .map("Rectangle", Rectangle);
73 }
74 };
75
76 /**
77 * @defgroup Component-PrimitiveVisualization PrimitiveVisualization
78 * @ingroup VisionX-Components
79 * A description of the component PrimitiveVisualization.
80 *
81 * @class PrimitiveVisualization
82 * @ingroup Component-PrimitiveVisualization
83 * @brief Brief description of class PrimitiveVisualization.
84 *
85 * Detailed description of class PrimitiveVisualization.
86 */
88 virtual public armarx::Component,
89 virtual public visionx::PointCloudSegmentationListener,
91 {
92 public:
93 /**
94 * @see armarx::ManagedIceObject::getDefaultName()
95 */
96 std::string
97 getDefaultName() const override
98 {
99 return "PrimitiveVisualization";
100 }
101
102 void reportNewPointCloudSegmentation(const Ice::Current& c = Ice::emptyCurrent) override;
103
104 protected:
105 /**
106 * @see armarx::ManagedIceObject::onInitComponent()
107 */
108 void onInitComponent() override;
109
110 /**
111 * @see armarx::ManagedIceObject::onConnectComponent()
112 */
113 void onConnectComponent() override;
114
115 /**
116 * @see armarx::ManagedIceObject::onDisconnectComponent()
117 */
118 void onDisconnectComponent() override;
119
120 /**
121 * @see armarx::ManagedIceObject::onExitComponent()
122 */
123 void onExitComponent() override;
124
125 /**
126 * @see PropertyUser::createPropertyDefinitions()
127 */
129
130
131 protected:
133
134 memoryx::WorkingMemoryInterfacePrx workingMemory;
135 memoryx::EnvironmentalPrimitiveSegmentBasePrx environmentalPrimitiveSegment;
136
137
138 private:
139 void clearDebugLayer();
140
141 std::mutex mutex;
142
143 viz::Color getPrimitiveColor(const memoryx::EnvironmentalPrimitiveBasePtr& primitive);
144
145 void visualizePrimitive(const memoryx::EnvironmentalPrimitiveBasePtr& primitive,
146 viz::Color color);
147 void visualizePlane(const memoryx::PlanePrimitiveBasePtr& plane, viz::Color color);
148 void visualizeSphere(const memoryx::SpherePrimitiveBasePtr& sphere, viz::Color color);
149 void visualizeCylinder(const memoryx::CylinderPrimitiveBasePtr& cylinder, viz::Color color);
150
151 viz::Color primitiveColorFrame;
152
153 viz::Layer layer = {};
154 };
155} // namespace armarx
constexpr T c
Provides a ready-to-use ArViz client arviz as member variable.
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Brief description of class PrimitiveVisualization.
void reportNewPointCloudSegmentation(const Ice::Current &c=Ice::emptyCurrent) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
memoryx::WorkingMemoryInterfacePrx workingMemory
memoryx::EnvironmentalPrimitiveSegmentBasePrx environmentalPrimitiveSegment
std::string getDefaultName() const override
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)
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