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
30namespace armarx
31{
32
33 void
37
38 void
40 {
41 remote_gui_plugin_->createOrUpdateTab(
42 aron_component_config_plugin_->buildRemoteGui("Config"),
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
72
73 void
77
80 {
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
103 {
104 return "ComponentConfigTest";
105 }
106
108 {
109 addPlugin(remote_gui_plugin_, "");
110 addPlugin(aron_component_config_plugin_, "");
111 }
112
118} // namespace armarx
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getDefaultName() const override
Retrieve default name of component.
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
SimplePeriodicTask(Ts...) -> SimplePeriodicTask< std::function< void(void)> >
#define ARMARX_TRACE
Definition trace.h:77