ArVizExample.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 RobotAPI::ArmarXObjects::ArVizExample
17 * @author Fabian Paus ( fabian dot paus at kit dot edu )
18 * @date 2019
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
27
29
30namespace armarx
31{
32
33 /**
34 * @defgroup Component-ArVizExample ArVizExample
35 * @ingroup RobotAPI-Components
36 *
37 * An example for how to visualize 3D elements via the 3D visualization
38 * framework ArViz.
39 *
40 * The example creates several layers, fills them with visualization
41 * elements, and commits them to ArViz.
42 *
43 * To see the result:
44 * \li Start the component `ArVizStorage`
45 * \li Open the gui plugin `ArViz`
46 * \li Start the component `ArVizExample`
47 *
48 * The scenario `ArVizExample` starts the necessary components,
49 * including the example component.
50 *
51 *
52 * A component which wants to visualize data via ArViz should:
53 * \li `#include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>`
54 * \li Inherit from the `armarx::ArVizComponentPluginUser`. This adds the
55 * necessary properties (e.g. the topic name) and provides a
56 * ready-to-use ArViz client called `arviz`.
57 * \li Use the inherited ArViz client variable `arviz` of type `viz::Client`
58 * to create layers, add visualization elements to the layers,
59 * and commit the layers to the ArViz topic.
60 *
61 * \see ArVizExample
62 *
63 *
64 * @class ArVizExample
65 * @ingroup Component-ArVizExample
66 *
67 * @brief An example for how to use ArViz.
68 *
69 * @see @ref Component-ArVizExample
70 */
72 virtual public armarx::Component,
73 // Deriving from armarx::ArVizComponentPluginUser adds necessary properties
74 // and provides a ready-to-use ArViz client called `arviz`.
76 {
77 public:
78 std::string getDefaultName() const override;
80
81 void onInitComponent() override;
82 void onConnectComponent() override;
83
84 void onDisconnectComponent() override;
85 void onExitComponent() override;
86
87
88 private:
89 void run();
90
91
92 private:
94
95 struct Properties
96 {
97 bool manyLayers = false;
98 };
99
100 Properties properties;
101 };
102} // namespace armarx
Provides a ready-to-use ArViz client arviz as member variable.
An example for how to use ArViz.
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Creates the property definition container.
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Retrieve default name of component.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.