Skip to content

Add tangram bridge: TANGRAM plugin, frontend package, and docs - #19

Merged
abc8747 merged 16 commits into
mainfrom
feature/tangram-bridge
Jul 26, 2026
Merged

Add tangram bridge: TANGRAM plugin, frontend package, and docs#19
abc8747 merged 16 commits into
mainfrom
feature/tangram-bridge

Conversation

@amorfinv

Copy link
Copy Markdown
Collaborator

Summary

  • New TANGRAM example plugin (example_plugins/tangram.py) bridging the simulation to a tangram deployment over Redis: publishes SI-unit snapshots on to:<channel>:* (wall-clock rate-capped via tangram_max_hz) and listens for stack commands on from:<channel>:*
  • Redis is an optional extra (uv sync --extra tangram); fakeredis added to the dev group so tests need no Redis server
  • New tangram_minisky frontend plugin package (Vue/TS): aircraft map layer, trail layer, aircraft-count and sim-control widgets
  • New guide docs/guides/tangram.md wired into the mkdocs nav

Test plan

  • uv run pytest tests/unit/test_tangram_plugin.py tests/integration/test_tangram_bridge.py — 19 passed
  • End-to-end against a live tangram deployment

🤖 Generated with Claude Code

amorfinv and others added 3 commits July 19, 2026 09:56
…er Redis

Publishes SI-unit snapshots to to:<channel>:* (rate-capped via
tangram_max_hz) and listens for stack commands on from:<channel>:*.
Redis ships as an optional extra (uv sync --extra tangram); tests run
against fakeredis in the dev group.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…trol widgets)

Vue/TS tangram plugin package with an aircraft map layer, trail layer,
aircraft-count and sim-control widgets; frontend build output ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@amorfinv amorfinv self-assigned this Jul 19, 2026
@amorfinv amorfinv added the enhancement New feature or request label Jul 19, 2026
@amorfinv

Copy link
Copy Markdown
Collaborator Author

Hi @abc8747, I have moved the plugin here. Ill work on getting it to match xoolive/traffic#531

Regarding the simulation time controls. Currently minisky can stream a simulation and exposes controls such as play, stop, reset, and changing speed. I suspect these could get out of sync with other tangram plugins since minisky takes care of its own clock.

It is possible to control the simulation without using the stream server. see here. In this way the minisky tangram plugin can effectively control the speed of the simulation and stay in sync with other data.

Note that minisky does not yet support rewinding. Not sure if this is something that will be necessary.

Match the setup recommended in the tangram plugin guide
(https://mode-s.org/tangram/plugins/frontend/) and xoolive/traffic#531:

- make example_plugins/tangram_minisky a uv workspace member, so
  `uv sync --all-packages` installs tangram_core and the plugin
  (editable) into the repo venv; `uv run tangram serve` /
  `check-plugin` then work straight from this repository
- add tsconfig.vite.json (extends tangram-core's tsconfig.node.json)
  and the documented @ts-expect-error for the vite-plugin subpath
  that ships without declarations in tangram_core 0.5.0
- add eslint (typescript-eslint + eslint-plugin-vue) and vue-tsc with
  lint / typecheck / typecheck:vite / check npm scripts; fix the one
  real finding (btoa browser global) and the auto-fixable style issues
- extend pyright to example_plugins and fix what it found: a dict
  typing error in tangram.py and Optional-access bugs in example.py
- align npm dependency ranges with tangram-core 0.5.0 so
  `tangram check-plugin` passes
- document the dev commands, the workspace run route, and the
  tangram_exe pattern for running against a local tangram checkout

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread example_plugins/tangram_minisky/src/tangram_minisky/AircraftCountWidget.vue Outdated
Comment thread example_plugins/tangram_minisky/src/tangram_minisky/__init__.py Outdated
Comment thread docs/guides/tangram.md Outdated
Comment thread example_plugins/tangram.py Outdated
Comment thread example_plugins/tangram.py Outdated
bridge = None


def convert_snapshot(snapshot: dict[str, Any]) -> dict[str, Any]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with minisky, but is there a TypedDict or dataclass defined somewhere which we can use as annotations instead of bare dicts? Since pyright is already setup I prefer removing these untyped .get() calls (ideally strict mode too)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this applies to the entire file too, there are lots of bare dict[str, Any] manipulations that are difficult to keep track of

@amorfinv amorfinv Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently get a bunch of failures when we do strict mode. so for now, I will just enforce on plugins and then in future can update core

Comment thread tests/integration/test_tangram_bridge.py
Comment thread settings.yml Outdated
Comment thread example_plugins/example.py Outdated
Comment thread example_plugins/tangram/tangram_minisky/readme.md
Comment thread docs/guides/tangram.md Outdated
@abc8747

abc8747 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

@amorfinv Thanks! I'll work on improving/exposing the clock API in the tangram core (play, pause, playback speed) and hope to get it done by Thursday. It will very much look like this in the video (let me know if you would like anything!).

Fyi, I haven't used bluesky (or any air traffic simulator) at all so I don't know too much about its internals/typical painpoints. I assume when you say "lack of rewinding" it's because it's not always possible to step physics or controller actions backward. But let's say I need to seek backward from t = 900s to t = 899s, I guess there is no way to do so other than replaying the entire t = 0..=899s segment? I'm wondering if internally it is able to serialise the history to say, a jsonl or parquet file and just reload it at the requested time.

Before I start designing the historical playback side of tangram, can you tell me what are some long-standing missing functionality you'd like to see in minisky? I'm happy to start contributing to minisky but I might only be free starting mid-Aug

@amorfinv

amorfinv commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @abc8747 thanks for all the comments. I should have some time to go over them later this week/weekend.

You are assumption about rewind is correct. currently, the only way to go from t = 900s to t = 899s is to replay the entire t = 0..=899s. I am not entirely sure how to handle it but serialising the history into a temporary file could be a nice idea.

Regarding, the clock api, I think an important part would probably be to enforce that the slowest component dictates the speed. For example, let's say we have quite a large minisky simulation. If we request a playback speed of 10x it could happen that we can only reach 5x in minisky because conflict detection is quite slow.

I will try to put this into a list somewhere else but there are a couple of parts of minisky that could use some work. These are in no particular order and vary in difficulty.

If you want to play a bit with air traffic simulator you can check my website. I currently only support bluesky simulations but also hoping to add minisky soon

@xoolive

xoolive commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Create a minisky plugin that loads an adsb flight and transform it into a simulation scenario

This is not an easy problem actually, and maybe it shouldn't be solved with a quick generic patch making it look easy. Still, it is a nice use case to be able to replay history (tangram_history) and compare with the result of a simulation, provided a scenario reconstruction strategy. I will be your first client 👍

@amorfinv

Copy link
Copy Markdown
Collaborator Author

Hi @xoolive. Yeah this will likely be quite challenging. Also perhaps it does not actually belong in the core code since it is mostly scenario generation.

amorfinv added 9 commits July 25, 2026 14:29
process() used to iterate cmdstack and then clear it, so a command
appended by another thread (e.g. the tangram Redis listener) in the
window between the loop ending and the clear was silently dropped.
Stack.commands() now detaches the pending list up front: a racing
append lands either on the detached list (runs this step) or the
fresh one (runs next step).
@amorfinv

Copy link
Copy Markdown
Collaborator Author

Hi @abc8747, I think i have answered most things. Also made a couple of new issues to address some of your comments.

Main thing was the #24. Also the clock still needs to be synced to tangram once that is ready. However, for now perhaps its ready?

@abc8747

abc8747 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

@amorfinv Thanks! I will take a closer look at it later tonight.

The clock API is not ready yet because I was busy working on integrating navaids/fixes/field 15 to tangram over at open-aviation/tangram#313, but once it is merged, we will release v0.6 then I think we can start working on it in tangram v0.7

@amorfinv

amorfinv commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

@abc8747 Ok awesome! Which x-plane data version are you using? i could not find license info about x-plane 11

@abc8747

abc8747 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

I'm not too sure about the xplane data version because the tangram_navaid plugin was written by @xoolive. tangram_navaid currently downloads the data from xoolive/traffic/data/navdata and parses it on the frontend using the traffic.js library. So tracing back the history:

  • earth_fix.dat and earth_nav.dat was added in traffic 7cdaf04 (2019-05-19) and earth_awy.dat in traffic 3e33d23 (2019-05-20)
  • traffic f29beb4 (2018-03-18) used to download data from ProfHoekstra/bluesky
  • bluesky first added the data in 996de35 (2016-12-11) and its file header mentions that it is licensed under GPL-2.0-or-later:

    640 Version - data cycle 2013.10, build 20131334, metadata AwyXP700. Copyright © 2013, Robin A. Peel (robin@x-plane.com). This data is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

  • however all three DATs in traffic are missing the header so I am not able to confirm the exact data cycle/licence. I would guess the file format for earth_nav.dat is the legacy XP NAV810 (xplane 8.10-10.52) with an AIRAC dated sometime in 2016-17, but I'm not sure for earth_fix and earth_awy.

Btw, I remember the xplane site used to say data is licensed under GPL, but after some digging it seems like the GPL clause was removed from the website somewhere between 2026-01-21 and 2026-02-07 🤔

Edit: 1901 is the likely AIRAC version

abc8747 added 2 commits July 27, 2026 02:29
…ace/lock

removes duplicate `uv.lock` and `.venv`.

- docs: replace all `npm` with `pnpm`
- upgrade to pnpm v11 and update ci
- remove python version pin
- remove brittle automated `just link_core`
fixes #19 (comment)

temporarily expose config, which will be refactored away when we work on #24
@abc8747
abc8747 marked this pull request as ready for review July 26, 2026 18:47
@abc8747

abc8747 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

@amorfinv While prototyping the tangram clock API, I keep running into issues caused by the current minisky plugin system. I will merge this first to focus on #24. After that, I think we can circle back and finish the tangram_minisky plugin improvements in a separate PR

@abc8747
abc8747 merged commit 142da23 into main Jul 26, 2026
1 check passed
@abc8747
abc8747 deleted the feature/tangram-bridge branch July 27, 2026 07:49
abc8747 added a commit that referenced this pull request Aug 1, 2026
@abc8747 abc8747 mentioned this pull request Aug 9, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants