Add optional standard semantics - sjdayday/xschema GitHub Wiki

home or [back](Expand single transition)

Depending on the details of a domain, we may need additional logic, much of which is available through the optional standard semantics. If we look at the details of the Close_hand x-schema, we note that its ongoing process starts by invoking an external transition, TestingCloseExternalTransition. Perhaps in turn this external transition sends a message to a robotic component or simulator to begin the movements to close the hand. (In the code example a message is simply sent back to the testing class.) The transition completes execution and the Closing place is marked. At some later time, the hand movement completes normally, and the robotic component or simulator updates an external input place, Close_sensed. All the inputs to the Finish transition are now marked, so Close_hand is Done.

images/close_hand.png

This flow handles normal processing, but to be realistic needs some ability to handle errors. Perhaps Close_hand sometimes misses the target object, an event that is detected by the robotic component or simulator. We add a Missed external input place, and use the standard Suspend semantics to interrupt the ongoing process. When the Missed place is marked, the Suspend transition will fire, and Close_hand will be Suspended. (To simplify the depiction of Grasp, the Prepare transition has been left unexpanded.)

images/grasp4.png

If Close_hand is Suspended, the overall Grasp schema needs to react. In this case, we model Grasp itself as also being Suspended, such that the caller has the opportunity to decide whether to stop the grasping action, or attempt a recovery. We add the standard Suspend semantics to Grasp:

images/grasp5.png

Next, we [link the two x-schemas](Link two x-schemas) through the Suspended state in Close_hand, which becomes a merge place, driving the Suspend transition in Grasp:

images/grasp6.png

The caller wants to know if Grasp has ended normally (Done), or is Suspended, so we make Suspended an external output place. This enables the caller to listen for any changes to the marking of Suspended.

images/grasp7.png

At execution time, the executable Petri net will look like this:

images/grasp8.png

Pass parameters