iocchi / PetriNetPlans

Petri Net Plans library and applications
31 stars 15 forks source link

Question about usage #27

Closed haydendonald closed 3 years ago

haydendonald commented 4 years ago

Hi Iocchi, I was just wondering if there is any documentation on how to use this PNP interface or if i've missed it. Just wondering what the general format in the PNP is. For example <function>_<param1>_<param2>.start means to start function with params. I'm a little confused on how some of the functions in the example actually work and what they call.

Also as a side question is there a way to interrupt a function? So for example i have a function that is moving a robot to another constantly until interrupted later on in the PNP where it's asked to goto another position. Below is the interrupt in your example but it doesn't seem to work and i'm not sure what the [obstacle] does exactly is that a true/false condition that if true will run the transition? image

Sorry a little bit of a paragraph there..

Thanks!

iocchi commented 4 years ago

Thanks for your question.

Some information are available in the README files of this repository and in the wiki https://github.com/iocchi/PetriNetPlans/wiki A new tutorial is in preparation.

To properly use the library, you should just implement a PNPActionServer for your application to map strings in the plan (i.e., actions and conditions) with actual functions in the code that implements such actions and conditions.

An example is provided in https://github.com/iocchi/PetriNetPlans/tree/master/PNPros/examples/rp_example

As for interrupting acgtions, whenever a condition (e.g., obstacle) becomes true during the execution of an action, the running action is interrupted and the flow of the PN continues after the interrupt transition. obstacle is a condition (i.e, a boolean property) set by the running components (in this demo, it is computed from laser scan readings). To test it in the Stage simulator, just drag one of the boxes in the environment in front of the robot while running such a plan.

haydendonald commented 4 years ago

This explains a lot thankyou!

haydendonald commented 4 years ago

Hi Iocchi, Another question sorry. How exactly do you expect PNPs to be setup for multirobot interactions?

According to the examples each robot seems to have its own PNP server and plan, but how is this supposed to work with robots waiting for each others status? I found that robot 1 would just simply skip robot 2's part of the plan, and I don't really see how they are meant to sync together.

I've developed a solution where each robot has it's own local PNP server/actions with a global PNP server with it's own actions. Is this correct? I've found in the code that there are references to robotname but i don't see how that functionally works apart from debug statements.

Thanks heaps!