37 #include <ArmarXCore/interface/statechart/RemoteStateOffererIce.h>
58 return "StatechartExecutorExample";
71 getProxy(_statechartExecutor,
"SimpleStatechartExecutor");
73 getProxy(_remoteGuiPrx,
"RemoteGuiProvider");
74 _tabName =
"StatechartExecutorExample";
75 setupRemoteGuiWidget();
79 _remoteGuiTask->start();
101 using namespace RemoteGui;
102 void StatechartExecutorExample::setupRemoteGuiWidget()
107 grid.addChild(test0Button);
109 grid.addChild(test1Button);
111 grid.addChild(test2Button);
114 hlayout.addChild(grid);
117 hlayout.addChild(stopButton);
121 manualLayout.addChild(label1);
123 manualLayout.addChild(lineedit1);
125 manualLayout.addChild(label2);
127 manualLayout.addChild(lineedit2);
129 manualLayout.addChild(runManual);
132 vlayout.addChildren({hlayout, manualLayout});
134 _remoteGuiPrx->createTab(_tabName, vlayout);
137 void StatechartExecutorExample::runRemoteGui()
139 int cycleDurationMs = 20;
140 CycleUtil
c(cycleDurationMs);
141 while (!_remoteGuiTask->isStopped())
143 _remoteGuiTab.receiveUpdates();
145 if (_remoteGuiTab.getButton(
"Stop").clicked())
147 _statechartExecutor->stopImmediatly();
149 auto output = _statechartExecutor->getSetOutputParameters();
150 for (
const auto& p : output)
153 ARMARX_INFO << p.first <<
": " << var->get()->getOutputValueOnly();
157 if (_remoteGuiTab.getButton(
"Test_normal").clicked())
159 std::string proxyName =
"StatechartExecutionGroupRemoteStateOfferer";
160 std::string stateName =
"TestStateForStatechartExecution";
171 param2->value =
new SingleVariant(1);
173 inputMap[
"intTest"] = param2;
175 std::vector<PosePtr>
v;
180 inputMap[
"intListTest"] = param3;
182 std::map<std::string, PosePtr> m;
186 param4->value = StringValueMap::FromStdMap<PosePtr>(m);
188 inputMap[
"poseMapTest"] = param4;
190 _statechartExecutor->ensureVariantLibrariesAreLoaded(inputMap);
191 _statechartExecutor->startStatechart(proxyName, stateName, inputMap);
205 if (_remoteGuiTab.getButton(
"Test_args").clicked())
210 if (_remoteGuiTab.getButton(
"Test_wrongProxy").clicked())
212 StringVariantContainerBaseMap output = _statechartExecutor->getSetOutputParameters();
215 int outInt = SingleVariantPtr::dynamicCast(output[
"OutputInt"])->get()->get<
int>();
221 if (_remoteGuiTab.getButtonClicked(
"Run"))
226 _remoteGuiTab.sendUpdates();
227 c.waitForCycleDuration();