dynos-sim-bridge
A worked example: run the DYNOS planner in the loop with an external vehicle
simulator. This package is scaffolding: it ships a stub SimHardware plus a
trivially simple StochasticSim that you replace with calls into your
simulator, and the wiring (runnable.py, mission.py) that lets dynos connect find it.
It demonstrates the two channels a simulator needs, both on the one
SimHardware class:
- Motion out (planner -> simulator):
SimHardwareimplements thegototransition by commanding your simulator, exactly like the real Sentry hardware class commands the vehicle. - State in (simulator -> planner): the vehicle's real position flows back
through a servant belief -- a
@Belief(fluent=at)callback the backend polls after each step, exactly the way it runs a local@Belief. Whatever waypoint the simulator reports becomesat(<waypoint>)in the planner's world. If the simulator ended up somewhere other than commanded, the belief reflects reality and the planner replans from there.
There is no separate position-sync step and no out-of-band set_belief: the
planner always builds on the observed position because the observation is the
channel.
Install
You will be modifying the source, so install editable:
pip install -e dynos-sim-bridge
This pulls in dynos-client and dynos-sentry-domain.
What's in this repository
bridge.py
Provides StochasticSim (the stand-in simulator) and SimHardware, which wires
it to the planner:
@Action(transition=goto) go_to: command the simulator to drive to the leg's endpoint.@Belief(fluent=at) observe_position: report the vehicle's real symbolic position back to the planner.
Everything above the Edit away down here line is plumbing you should leave
alone; replace StochasticSim with a bridge to your real simulator (same
goto/position shape).
mission.py
Provides build_sim_survey_mission(zone). Pass the Zone object (e.g.
Zone(name="site_alpha")), not its name string. Edit if you want a different
sequence.
runnable.py
Provides SimBridgeNode, the dynos connect-compatible entry point. You
probably don't need to edit this.
SimHardwareclaims thegototransition. Registering it replaces whatever was executinggoto(e.g. thesentry-mockhardware's owngoto) -- that is the point: your simulator becomes the motion executor. Run the bridge instead of a second motion provider, not alongside one.
Why a servant belief, not create_object + set_start
The tempting way to tell the planner where the vehicle is each tick is to create
a current_location coordinate and reset the initial state. Don't:
set_startre-derives the whole initial state; it is a planning-time input, not a per-tick observation channel.- Two points at the same lon/lat and altitude are the same physical point,
so a
current_locationthat lands on a known waypoint is collapsed onto that waypoint by the backend, and you then have to discover the canonical name.
A servant belief skips all of that: the backend asks your servant "where is the
vehicle at?" and your observe_position answers with the at fluent symbol
over a waypoint the planner already knows.
How the round-trip works
- You launch the bridge as a servant:
dynos connect dynos_sim_bridge.runnable:SimBridgeNode. RegisteringSimHardwareadvertises both thegotoaction and theatbelief, then it idles. - From a second process you set the goal and execute a mission. No position sync is needed first -- the planner learns the position from the belief.
- The planner expands
full_coverage_of(zone)intogotolegs and dispatches each to your servant. SimHardware.go_todrives the simulator toward the leg's endpointx. Then the backend pollsobserve_position:- Vehicle is at
x: the observation confirms thegotoeffectat(x); the planner continues to the next leg. - Vehicle ended up at
y(current, obstacle, missed move): the observation reportsat(y); the effectat(x)is not confirmed, so the step gates and the planner replans toward the same goal fromy. This is the planner operating on updated symbolic knowledge -- the point of running it in the loop.
- Vehicle is at
- The mission ends with
full_abort(controlled ascent).
The servant belief goes through the client API: @Belief/BeliefResult are
exported from dynos_client, so a remote servant running with dynos_client
alone reports beliefs exactly as an in-tree robot class does with the
backend-side @Belief.
Replacing the stub
Replace StochasticSim with a small adapter over your simulator, keeping the
same two methods:
goto(target): command your simulator to drive to target (a waypoint name)
and return whether it arrived.
position(): return the name of the waypoint the vehicle is currently on, or
None when it is between waypoints (the belief then reports "unchecked" and the
planner keeps its prior position).
Coordinates follow the project convention: (longitude, latitude), degrees for
geographic, meters for local_enu. Altitude is part of a point's identity.
Test offline
Before pointing at the real backend, run the package's own tests:
pip install -e "dynos-sim-bridge/[dev]"
pytest dynos-sim-bridge/tests/ -v
These exercise StochasticSim, the goto plumbing, and the at belief. No
network or session needed. The end-to-end loop (backend polls the belief and
continues or replans) is covered by the sentry integration test
tests/sentry/test_servant_beliefs.py.
Run it for real
Two terminals.
Terminal 1 is your simulator bridge:
dynos login # logins persist across terminals but expire after an hour
dynos session create --robot sentry-mock
dynos connect dynos_sim_bridge.runnable:SimBridgeNode
Leave it running. It executes goto whenever the backend reaches a leg, and
answers the at belief whenever the backend polls it.
Terminal 2 is the mission. Create the survey zone and run:
dynos call create zone.json
from dynos_client import RemoteOrchestrator
from dynos_sentry.sentry import Zone
from dynos_sim_bridge.mission import build_sim_survey_mission
orch = RemoteOrchestrator.from_config(timeout_s=3600)
for r in orch.execute_blocks(build_sim_survey_mission(Zone(name="site_alpha"))):
print(r)
Public API
| Symbol | From | Purpose |
|---|---|---|
SimHardware |
dynos_sim_bridge.bridge |
The robot class you edit; executes goto, observes at. |
StochasticSim |
dynos_sim_bridge.bridge |
The trivial stand-in simulator you replace. |
SimBridgeNode |
dynos_sim_bridge.runnable |
The dynos connect entry point. |
build_sim_survey_mission(zone) |
dynos_sim_bridge.mission |
Take over, survey, recover. |
Troubleshooting
Bridge never gets an assignment: the mission hasn't reached a goto leg. Check
dynos call state --scope public.
at(<name>) unresolved: the name your position() returned isn't a registered
object. Return the name of a waypoint the planner knows (e.g. the leg's
endpoint), not an ad-hoc string.
For cross-package issues (login, session, connection), see user_guide.md or
dynos-client's README.
Metadata
Release files for dynos-sim-bridge 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dynos_sim_bridge-0.2.5.tar.gz | 11.1 kB | Without provenance | Details for dynos_sim_bridge-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dynos_sim_bridge-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for dynos_sim_bridge-0.2.5-py3-none-any.whl |
Total release size: 19.9 kB
Release files / dynos_sim_bridge-0.2.5.tar.gz
| Download URL | dynos_sim_bridge-0.2.5.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f188b84713417f133d7da8601a110e9d9ff5e444e28b5f33f8c41036dd6cca3b
|
|
BLAKE2b-256 checksum How to use checksums |
073d44057e771fb52a9500026041b4843de6f534eb939e2adb7d0c5e31eab4ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Release files / dynos_sim_bridge-0.2.5-py3-none-any.whl
| Download URL | dynos_sim_bridge-0.2.5-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d54ebfcb90e47b73ff20944a2e51aae42a25b39f0f5f359545bf3a5ab18c00b3
|
|
BLAKE2b-256 checksum How to use checksums |
cc6babfe2f582f1a385040c5a4c3be1c4cf27ef2558804c1fa7ea623844e9b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Security for dynos-sim-bridge 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.