AronComponentConfigExample.cpp
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 robdekon
17  * @author Christoph Pohl ( christoph dot pohl at kit dot edu )
18  * @date 06.09.22
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
27 
28 namespace armarx
29 {
30 
31  void
33  {
34 
35  }
36 
37  void
39  {
40  remote_gui_plugin_->createOrUpdateTab(aron_component_config_plugin_->buildRemoteGui("Config"),
41  [this](armarx::RemoteGui::TabProxy& prx)
42  {
43  prx.receiveUpdates();
44  std::lock_guard lock(write_mutex);
45  if (aron_component_config_plugin_->updateRemoteGui(prx))
46  {
47  remote_gui_plugin_->createOrUpdateTab("",
48  aron_component_config_plugin_
49  ->buildRemoteGui(
50  "Config"));
51  }
52  prx.sendUpdates();
53  });
54  periodicTask = new SimplePeriodicTask<>([&, this]
55  {
56  std::lock_guard lock(write_mutex);
58  auto& config =
59  aron_component_config_plugin_->config_.getWriteBuffer();
60 // ARMARX_INFO << VAROUT(config.orientation) << VAROUT(config.pose) << VAROUT(config.position);
61  config.intMember--;
62  aron_component_config_plugin_->config_.commitWrite();
63  }, 1000);
64  periodicTask->start();
65  }
66 
67  void
68  AronComponentConfigExample::onDisconnectComponent()
69  {
70  }
71 
72  void
73  AronComponentConfigExample::onExitComponent()
74  {
75  }
76 
78  AronComponentConfigExample::createPropertyDefinitions()
79  {
81  auto& config = aron_component_config_plugin_->config_.getWriteBuffer();
82  config.boolMember = true;
83  config.floatMember = 100.0f;
84  config.intMember = 1000;
85  config.stringMember = "initial";
86  config.longMember = 0;
87  config.subMember
88  .subsubMember
89  .intListMember
90  .insert(config.subMember.subsubMember.intListMember.end(), {1, 2, 3, 4, 5, 6});
91  config.subMember
92  .subsubMember
93  .stringListMember
94  .insert(config.subMember.subsubMember.stringListMember.end(), {"a", "b", "c", "d", "e"});
95  config.subMember.subsubMember.intDictMember.emplace("int1", 1);
96  config.subMember.subsubMember.intDictMember.emplace("int2", 2);
97  config.subMember.subsubMember.stringDictMember.emplace("string1", "blub");
98  config.subMember.subsubMember.stringDictMember.emplace("string2", "duh");
99  aron_component_config_plugin_->config_.commitWrite();
100  return defs;
101  }
102 
103  std::string
104  AronComponentConfigExample::getDefaultName() const
105  {
106  return "ComponentConfigTest";
107  }
108 
109  AronComponentConfigExample::AronComponentConfigExample()
110  {
111  addPlugin(remote_gui_plugin_, "");
112  addPlugin(aron_component_config_plugin_, "");
113  }
114 
115  AronComponentConfigExamplePropertyDefinitions::AronComponentConfigExamplePropertyDefinitions(std::string prefix) :
116  armarx::ComponentPropertyDefinitions(std::move(prefix))
117  {
118  }
119 }
armarx::AronComponentConfigExample::onInitComponent
void onInitComponent() override
Definition: AronComponentConfigExample.cpp:32
armarx::AronComponentConfigExamplePropertyDefinitions
Definition: AronComponentConfigExample.h:32
PropertyDefinitionVisitors.h
armarx::AronComponentConfigExample::onConnectComponent
void onConnectComponent() override
Definition: AronComponentConfigExample.cpp:38
AronComponentConfigExample.h
armarx::RemoteGui::TabProxy
Definition: WidgetProxy.h:17
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
RemoteGui.h
Decoupled.h
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
std
Definition: Application.h:66
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGui::TabProxy::sendUpdates
void sendUpdates()
Definition: WidgetProxy.h:146
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SimplePeriodicTask
Usage:
Definition: ApplicationNetworkStats.h:32