22 #include <easyiceconfig/EasyIce.h> 27 std::cout <<
" runcode for state0" << std::endl;
31 std::cout <<
" runcode for state1" << std::endl;
35 std::cout <<
" runcode for state2" << std::endl;
39 std::cout <<
" tran1 init" << std::endl;
43 std::cout <<
" tran1 checkcondition" << std::endl;
48 std::cout <<
" tran1 runcode" << std::endl;
52 ice = EasyIce::initialize(argc, argv);
54 Ice::ObjectPrx tempmyMotors = ice->propertyToProxy(
"automata.myMotors.Proxy");
55 if (tempmyMotors == 0) {
56 throw "cannot create proxy from automata.myMotors.Proxy";
58 myMotors = jderobot::MotorsPrx::checkedCast(tempmyMotors);
60 throw "invalid proxy automata.myMotors.Proxy";
62 std::cout <<
"myMotors connected" << std::endl;
77 std::string splitedArg;
79 for(i = 0; i < *argc; i++){
80 splitedArg = strtok(argv[i],
"=");
81 if (splitedArg.compare(
"--displaygui") == 0){
82 splitedArg = strtok(NULL,
"=");
83 if (splitedArg.compare(
"true") == 0 || splitedArg.compare(
"True") == 0){
85 std::cout <<
"displayGui ENABLED" << std::endl;
88 std::cout <<
"displayGui DISABLED" << std::endl;
101 int main (
int argc,
char* argv[]) {
105 }
catch (
const Ice::Exception& ex) {
106 std::cerr << ex << std::endl;
109 }
catch (
const char* msg) {
110 std::cerr << msg << std::endl;
117 std::cout <<
"displaygui:" <<
displayGui << std::endl;
121 while (runTimeGui == NULL) {
125 runTimeGui->addState(0,
"root",
true, 0.0, 0.0, -1);
126 runTimeGui->addState(1,
"state1",
true, 0.0, 0.0, 0);
127 runTimeGui->addState(2,
"state2",
false, 0.0, 0.0, 0);
134 State* state0 =
new State0(0,
true, (Interfaces*)&interfaces, 100, NULL, runTimeGui);
136 State* state1 =
new State1(1,
true, (Interfaces*)&interfaces, 100, state0, runTimeGui);
137 State* state2 =
new State2(2,
false, (Interfaces*)&interfaces, 100, state0, runTimeGui);
143 std::cout <<
"just before state thread" << std::endl;
146 std::cout <<
"thread started" << std::endl;
148 std::cout <<
"thread joined" << std::endl;
virtual void connectProxies(int argc, char *argv[])
virtual void destroyProxies()
virtual bool checkCondition()
void emitActiveStateById(int id)
void readArgs(int *argc, char *argv[])
void addTransition(Transition *transition)
int main(int argc, char *argv[])
State0(int id, bool initial, Interfaces *interfaces, int cycleDuration, State *parent, RunTimeGui *gui)