RobotToArViz.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::RobotToArViz
17  * @author Rainer Kartmann ( rainer dot kartmann 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 
27 
28 #include <ArmarXCore/interface/observers/ObserverInterface.h>
32 
33 
34 namespace armarx
35 {
36  /**
37  * @class RobotToArVizPropertyDefinitions
38  * @brief Property definitions of `RobotToArViz`.
39  */
42  {
43  public:
45  };
46 
47 
48 
49  /**
50  * @defgroup Component-RobotToArViz RobotToArViz
51  * @ingroup RobotAPI-Components
52  *
53  * Visualizes a robot via ArViz.
54  *
55  * @class RobotToArViz
56  * @ingroup Component-RobotToArViz
57  * @brief Brief description of class RobotToArViz.
58  *
59  * Detailed description of class RobotToArViz.
60  */
61  class RobotToArViz :
62  virtual public armarx::Component,
63  virtual public armarx::ArVizComponentPluginUser,
66  {
68 
69  public:
70 
71  /// @see armarx::ManagedIceObject::getDefaultName()
72  std::string getDefaultName() const override;
73 
74 
75  protected:
76 
77  /// @see armarx::ManagedIceObject::onInitComponent()
78  void onInitComponent() override;
79 
80  /// @see armarx::ManagedIceObject::onConnectComponent()
81  void onConnectComponent() override;
82 
83  /// @see armarx::ManagedIceObject::onDisconnectComponent()
84  void onDisconnectComponent() override;
85 
86  /// @see armarx::ManagedIceObject::onExitComponent()
87  void onExitComponent() override;
88 
89  /// @see PropertyUser::createPropertyDefinitions()
91 
92 
93  void createRemoteGuiTab();
94  void RemoteGui_update() override;
95 
96 
97  private:
98 
99  void updateRobotRun();
100  void updateRobotOnce();
101  static bool trySetFilePathFromDataDir(viz::Robot& robotViz, const std::string& absolutePath);
102 
103 
104  private:
105 
106  float updateFrequencyHz = 100;
108 
109  std::string robotName = "robot";
110 
112 
113  viz::Robot robotViz { "" };
114 
115 
116  // Remote Gui
117 
118  struct Tab : RemoteGui::Client::Tab
119  {
120  RemoteGui::Client::CheckBox showRobotNodeFrames;
121  RemoteGui::Client::CheckBox useCollisionModel;
122  // Todo: add spin box for scale
123  };
124  Tab tab;
125 
126  struct Gui
127  {
128  bool showRobotNodeFrames = false;
129  bool useCollisionModel = false;
130  };
131  std::mutex guiMutex;
132  Gui gui;
133 
134  };
135 }
ArVizComponentPlugin.h
armarx::RobotToArViz
Brief description of class RobotToArViz.
Definition: RobotToArViz.h:61
RobotStateComponentPlugin.h
armarx::RobotToArViz::onDisconnectComponent
void onDisconnectComponent() override
Definition: RobotToArViz.cpp:94
armarx::RobotToArVizPropertyDefinitions
Property definitions of RobotToArViz.
Definition: RobotToArViz.h:40
armarx::RobotToArViz::getDefaultName
std::string getDefaultName() const override
Definition: RobotToArViz.cpp:52
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
LightweightRemoteGuiComponentPlugin.h
armarx::RobotToArViz::onExitComponent
void onExitComponent() override
Definition: RobotToArViz.cpp:101
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
armarx::RobotToArViz::createRemoteGuiTab
void createRemoteGuiTab()
Definition: RobotToArViz.cpp:105
armarx::RobotToArViz::onConnectComponent
void onConnectComponent() override
Definition: RobotToArViz.cpp:64
armarx::RobotStateComponentPluginUser::RobotStateComponentPluginUser
RobotStateComponentPluginUser()
Definition: RobotStateComponentPlugin.cpp:303
armarx::viz::Robot
Definition: Robot.h:9
TaskUtil.h
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGui::Client::CheckBox
Definition: Widgets.h:129
armarx::RobotToArViz::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RobotToArViz.cpp:37
armarx::RobotStateComponentPluginUser
Definition: RobotStateComponentPlugin.h:167
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::RobotToArViz::RemoteGui_update
void RemoteGui_update() override
Definition: RobotToArViz.cpp:123
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::RobotToArVizPropertyDefinitions::RobotToArVizPropertyDefinitions
RobotToArVizPropertyDefinitions(std::string prefix)
Definition: RobotToArViz.cpp:32
armarx::RobotToArViz::onInitComponent
void onInitComponent() override
Definition: RobotToArViz.cpp:58