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 
26 
28 
30 
31 
32 namespace armarx
33 {
34 
35  /**
36  * @defgroup Component-ArVizExample ArVizExample
37  * @ingroup RobotAPI-Components
38  *
39  * An example for how to visualize 3D elements via the 3D visualization
40  * framework ArViz.
41  *
42  * The example creates several layers, fills them with visualization
43  * elements, and commits them to ArViz.
44  *
45  * To see the result:
46  * \li Start the component `ArVizStorage`
47  * \li Open the gui plugin `ArViz`
48  * \li Start the component `ArVizExample`
49  *
50  * The scenario `ArVizExample` starts the necessary components,
51  * including the example component.
52  *
53  *
54  * A component which wants to visualize data via ArViz should:
55  * \li `#include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>`
56  * \li Inherit from the `armarx::ArVizComponentPluginUser`. This adds the
57  * necessary properties (e.g. the topic name) and provides a
58  * ready-to-use ArViz client called `arviz`.
59  * \li Use the inherited ArViz client variable `arviz` of type `viz::Client`
60  * to create layers, add visualization elements to the layers,
61  * and commit the layers to the ArViz topic.
62  *
63  * \see ArVizExample
64  *
65  *
66  * @class ArVizExample
67  * @ingroup Component-ArVizExample
68  *
69  * @brief An example for how to use ArViz.
70  *
71  * @see @ref Component-ArVizExample
72  */
73  class ArVizExample :
74  virtual public armarx::Component,
75  // Deriving from armarx::ArVizComponentPluginUser adds necessary properties
76  // and provides a ready-to-use ArViz client called `arviz`.
78  {
79  public:
80 
81  std::string getDefaultName() const override;
83 
84  void onInitComponent() override;
85  void onConnectComponent() override;
86 
87  void onDisconnectComponent() override;
88  void onExitComponent() override;
89 
90 
91  private:
92 
93  void run();
94 
95 
96  private:
97 
99 
100  struct Properties
101  {
102  bool manyLayers = false;
103  };
104  Properties properties;
105 
106  };
107 }
ArVizComponentPlugin.h
armarx::ArVizExample
An example for how to use ArViz.
Definition: ArVizExample.h:73
armarx::ArVizExample::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArVizExample.cpp:39
RunningTask.h
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
armarx::ArVizExample::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ArVizExample.cpp:57
armarx::ArVizExample::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: ArVizExample.cpp:63
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ArVizExample::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: ArVizExample.cpp:81
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ArVizExample::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: ArVizExample.cpp:74
armarx::ArVizExample::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: ArVizExample.cpp:89