open-rmf / fleet_adapter_mir

RMF/RoMi-H fleet adapter for the MiR API
Apache License 2.0
15 stars 15 forks source link

Replace state machine with a callback dictionary #8

Open mxgrey opened 3 years ago

mxgrey commented 3 years ago

There are some issues with the state machine, mostly caused by the asynchronous behavior of the MiR API. It doesn't report itself as executing until a brief delay after a mission has been posted. This messes with some of the state machine's logic and causes the state machine to jump forward too quickly.

I think a more manageable strategy will be to create a dictionary that maps from mission names to update callbacks. When we see the current mission that MiR is on, then we simply pull the relevant callback out of the dictionary and trigger it.

cnboonhan commented 3 years ago

Thanks for making an issue on this! Im happy to hop on it once i clear up some other things on my end.