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