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#include <ArmarXCore/interface/observers/ObserverInterface.h>
28
30
33
34namespace armarx
35{
36 /**
37 * @class RobotToArVizPropertyDefinitions
38 * @brief Property definitions of `RobotToArViz`.
39 */
45
46 /**
47 * @defgroup Component-RobotToArViz RobotToArViz
48 * @ingroup RobotAPI-Components
49 *
50 * Visualizes a robot via ArViz.
51 *
52 * @class RobotToArViz
53 * @ingroup Component-RobotToArViz
54 * @brief Brief description of class RobotToArViz.
55 *
56 * Detailed description of class RobotToArViz.
57 */
59 virtual public armarx::Component,
63 {
64 using RobotState = RobotStateComponentPluginUser;
65
66 public:
67 /// @see armarx::ManagedIceObject::getDefaultName()
68 std::string getDefaultName() const override;
69
70
71 protected:
72 /// @see armarx::ManagedIceObject::onInitComponent()
73 void onInitComponent() override;
74
75 /// @see armarx::ManagedIceObject::onConnectComponent()
76 void onConnectComponent() override;
77
78 /// @see armarx::ManagedIceObject::onDisconnectComponent()
79 void onDisconnectComponent() override;
80
81 /// @see armarx::ManagedIceObject::onExitComponent()
82 void onExitComponent() override;
83
84 /// @see PropertyUser::createPropertyDefinitions()
86
87
88 void createRemoteGuiTab();
89 void RemoteGui_update() override;
90
91
92 private:
93 void updateRobotRun();
94 void updateRobotOnce();
95 static bool trySetFilePathFromDataDir(viz::Robot& robotViz,
96 const std::string& absolutePath);
97
98
99 private:
100 float updateFrequencyHz = 100;
102
103 std::string robotName = "robot";
104
106
107 viz::Robot robotViz{""};
108
109 // Remote Gui
110
111 struct Tab : RemoteGui::Client::Tab
112 {
113 RemoteGui::Client::CheckBox showRobotNodeFrames;
114 RemoteGui::Client::CheckBox useCollisionModel;
115 // Todo: add spin box for scale
116 };
117
118 Tab tab;
119
120 struct Gui
121 {
122 bool showRobotNodeFrames = false;
123 bool useCollisionModel = false;
124 };
125
126 std::mutex guiMutex;
127 Gui gui;
128 };
129} // namespace armarx
Provides a ready-to-use ArViz client arviz as member variable.
Default component property definition container.
Definition Component.h:70
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
RobotToArVizPropertyDefinitions(std::string prefix)
Brief description of class RobotToArViz.
void onInitComponent() override
void onDisconnectComponent() override
void RemoteGui_update() override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
void onExitComponent() override
std::string getDefaultName() const override
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.