by ft.zimmermann » Sun Feb 03, 2008 12:08 pm
Hi dark,
to answer your question first:
Do not install anything (neither eclipse nor the workspace) in a path, that contains blanks, exclamation marks, colons and other weird stuff. Also rnning eclipse from a memory stick did not work. Please let me know if this was your Problem. And: The plugin runs on Windows XP or Vista.
thank you for your interest. Again sorry, that there is only a german instruction. You are right, when you say, that you need a more detailed information about the semantics of the statemachines. I gave a course on Mindstorms programming yesterday, and there are quite a few things to tell. Despite from some bluetooth in the beginning stress everything worked as it should. The task was to build a line follower, which stops, when it sees an obstacle and waits until it is removed. I was hoping to get a couple of robots to drive on an eight without running into each other, but we did not get that far. But avoiding running into eack other worked well on all machines. (Honestly I think the students would have liked to play sumobot instead.)
The models are UML alike, but not UML conform, which is not a problem, since a DSL is required to meet the domains needs and not UML conformity.
States have three actions: entry, do and exit action.
Their execution order use is pretty much self explaining, but you need to know, that a do action can be interrupted. The standard java thread.interrupt() mechanism is used for this. As a consequence of this, entry and exit should only contain short computations and no movements. the do action can contain long lasting computations and motor movements, but should regularly check Thread.isInterrupted() to see if the action needs to terminate. This termination is done by throwing a Interrupted exception. If your students are familiar with Java Thread Communication this should sound more or less natural to them. The Wrapperclass ZPilot delegates to Pilot, but checks isInterrupted() permanently during movements. So if you use the ZPilot in do actions everythings works fine. As you can see on the videos the state changes work pretty fast using this mechanism.
The most common problem for my students was, that the statemachine stops if no follow up state can be determined. This happens if the do/entry/exit actions contain code, that terminates quickly. Sometimes you need states which just wait for some things to happen, like removement of an obstacle, pressing of a button etc. In this case it is easiest to programm a Thread.sleep(60000) in the do action. The robot waits for 60 s and if nothing happens it stops.
The start state marks the intialisation of the machine. There may be one ore more state executing threads started. Therefore you can start more than one separate Statemachine. The programmer has to take care of race conditions when he starts more than one state. I used it in the CatChaser and Dog Example to read the UltrasonicSensor (Sound) every 200 ms. See the german manual for this.
Transitions my be explicit or implicit.
Explicit transitions are checked in an own thread, with and will depend on the sensor measurements in general.
If you want you can program time or loop conditions etc. . If a condition of a explicit transition is meet (ie a measurement will meet a required value range or a timeout occurred), the transition check thread interrupts the state execution thread. A statetransfer will occur. See the BumperCar or LineFollower example for a use of explicit transiotions.
Implicit transitions will occur when a do action ends normally. They can be by a guard condition, to determine the next state. To avoid race conditions a delay may be given with the transition. (To make sure, that the ultrasonic sensor delivers the next measurement correctly. See the SetUpSonic state in the catChaser example. I also used a delay in the catChaser example to build some dramaturgical tension. See the CatChaser example delay of 1500 ms between HeadToCat and JumpAttack)
If the transition thread cannot find a next state, the engine stops. See example Exit transition in BumperCar or LineFollower for this.
There are some possibilities in the Preferences Menu you should have a look at.
Hope you can use this information. For more info please pm me. For some material I culd mail the Tex sources.