Decision: continue or adapt, and the
milestone its attention is on.
This is how Megan does
finding ways around obstacles —
when the frontier is blocked, it routes you to adapt (act here) instead of
letting a frozen plan push into the wall.
There are two ways to drive a session:
Opening a session
session() returns a MeganSession. It’s a context manager — prefer with
so the session is always closed on the server:
The milestone path — step
Each cycle, tell the token which milestone indices are now satisfied and which new
obstacles block a milestone. It returns the decision.
(id, milestone_index) tuple — both
normalise to the same request:
Acting on the decision
The whole point is theadapt branch — that’s megan-tk telling you the current
plan won’t carry the frontier and your change-doer should intervene here:
The perception path — perceive
For grounded navigation you can let the token reason about distance instead of
discrete “reached” flags. Open the session with one shrinking ring radius per
milestone, then report raw position/goal/obstacles.
(id, position) tuple:
ring_radii must have exactly one radius per milestone and must shrink as
milestones advance (each ring tighter than the last). Calling perceive on a
session opened without ring_radii is a 422 — use step there instead.Inspecting and closing
with form does this for you;
if you manage a session by hand, call close() in a finally.
A full milestone loop
Next
Disturbance anticipators
Learn a periodic disturbance and protect ahead of it.
SDK reference
Every method, argument, and return type.