35 addState<Statechart_Robot>(
"RobotControl");
72 void RobotControl::createStaticInstance()
78 assert(stateList.size() > 0);
79 int robotFunctionalStateId = stateList.begin()->first;
83 const std::string proxyName = getProperty<std::string>(
"XMLStatechartProfile").getValue() + getProperty<std::string>(
"proxyName").getValue();
84 const std::string stateName = getProperty<std::string>(
"stateName").getValue();
87 if (!proxyName.empty() && !stateName.empty())
99 state->getObjectScheduler()->waitForObjectState(eManagedIceObjectStarted, 5000);
100 EventPtr evt = createEvent<EvLoadScenario>();
101 evt->eventReceiverName =
"toAll";
102 evt->properties[
"proxyName"] =
new SingleVariant(proxyName);
103 evt->properties[
"stateName"] =
new SingleVariant(stateName);
116 StateBasePtr stateFunctional = setInitState(addState<StateRobotControl>(
"Functional"));
121 addTransition<Failure>(stateFunctional, stateFailure);
122 addTransition<EvStopRobot>(stateFunctional, stateStopped);
123 addTransition<EvStartRobot>(stateStopped, stateFunctional);
124 addTransition<EvStartRobot>(stateFailure, stateFunctional);
134 StateBasePtr stateRobotPreInitialized = addState<RobotPreInitialized>(
"RobotPreInitialized");
135 StateBasePtr stateRobotInitialized = addState<State>(
"RobotInitialized");
136 StateBasePtr stateScenarioRunning = addDynamicRemoteState(
"DynamicScenarioState");
137 StateBasePtr stateFatalError = addState<FailureState>(
"FatalError");
139 setInitState(stateRobotInitialized);
141 addTransition<EvInit>(stateIdling, stateRobotPreInitialized);
142 addTransition<EvInitialized>(stateRobotPreInitialized, stateRobotInitialized);
143 addTransition<EvLoadScenario>(stateRobotInitialized, stateScenarioRunning,
145 addTransition<EvInit>(stateScenarioRunning, stateRobotPreInitialized);
146 addTransition<Success>(stateScenarioRunning, stateRobotInitialized);
149 addTransition<EvLoadingFailed>(stateScenarioRunning, stateFatalError);
150 addTransition<EvConnectionLost>(stateScenarioRunning, stateFatalError);
151 addTransition<EvInitFailed>(stateRobotPreInitialized, stateFatalError);
152 addTransitionFromAllStates<Failure>(stateFatalError);