Skip to content

feat(sim): add map and terrain inputs#68

Open
Komzpa wants to merge 17 commits into
meshtastic:masterfrom
Komzpa:codex/split-input-terrain
Open

feat(sim): add map and terrain inputs#68
Komzpa wants to merge 17 commits into
meshtastic:masterfrom
Komzpa:codex/split-input-terrain

Conversation

@Komzpa
Copy link
Copy Markdown
Contributor

@Komzpa Komzpa commented May 2, 2026

Summary

  • add safe scenario YAML conversion plus geographic origin metadata for origin-backed scenarios
  • remap imported YAML node identifiers to dense simulator node indices so real Meshtastic node IDs cannot index outside fixed-size simulation arrays
  • clear stale geographic origin metadata when a later scenario has no origin, but only after the replacement scenario is accepted
  • add positioned real-mesh imports from compatible Meshtastic map /api/v1/nodes endpoints with bbox filtering, role mapping, and node limits
  • add local device NodeDB import via the Python client interface.nodesByNum, matching the data source behind meshtastic --nodes without parsing its table output
  • use normal Config.HM antenna height and Config.hopLimit defaults for imported map/NodeDB nodes instead of separate import-only defaults
  • add optional SRTM-backed terrain input that downloads/caches HGT tiles and builds an in-memory terrain grid directly from the scenario bbox
  • keep map/NodeDB altitude separate from antenna height: source altitude is absolute GPS/MSL altitude or sometimes placeholder/noisy data, while HM remains the fallback antenna height above local ground
  • when SRTM is enabled, sanity-check each imported node altitude against that node's SRTM ground sample: plausible positive altitudes are used per node, while missing, below-ground, or implausibly high values fall back to SRTM ground + antenna height
  • lift terrain-backed node z coordinates to absolute antenna altitude for existing 3D-distance geometry while preserving separate antenna-height values for path-loss models
  • replace the terrain z-mode boolean with explicit NODE_Z_REFERENCE values (ground / sea_level)
  • avoid committing terrain/origin/profile-sample state to Config until scenario validation and SRTM loading succeed
  • select the requested .hgt tile when unpacking multi-tile SRTM zip archives
  • cover live-map altitude placeholders/outliers (null, -1, 0, 42949649), plausible per-node map altitudes, NodeDB latitude/longitude shapes, southern/western SRTM tiles, equator/prime-meridian tile selection, and rejected-parse state preservation in regression tests
  • keep terrain opt-in and avoid custom terrain CSV/export formats in the user-facing flow
  • document both map endpoint import and local NodeDB import paths, including where to copy bbox values from

Stack

Validation

  • live audit of https://meshtastic.liamcottle.net/api/v1/nodes: 30,031 nodes; 14,762 altitude: null; 15,269 numeric altitudes; exact -1 appears 15 times; exact 0 does not appear in this snapshot; outliers include -1678176, 42949649, and 60000
  • .venv/bin/python -m unittest tests.test_map_input tests.test_node tests.test_lora_mesh_cli tests.test_srtm tests.test_terrain -v -> 80 tests OK
  • .venv/bin/python -m unittest discover -s tests -v -> 88 tests OK
  • ruff check loraMesh.py lib/map_input.py lib/nodedb_input.py tests/test_map_input.py tests/test_lora_mesh_cli.py
  • python3 -m compileall -q loraMesh.py lib tests -> passes; it still reports existing lib/interactive.py invalid escape sequence warnings outside this PR
  • git diff --check

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79ecff6a88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/node.py Outdated
Comment thread loraMesh.py
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch 2 times, most recently from f7d0d62 to 600f743 Compare May 3, 2026 15:11
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600f743809

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch 2 times, most recently from 2a2ead1 to 1f5a56b Compare May 3, 2026 15:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f5a56b0cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
Comment thread loraMesh.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 1f5a56b to 1f3d3cb Compare May 3, 2026 15:55
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f3d3cbf92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 1f3d3cb to 9f79c63 Compare May 3, 2026 16:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f79c63efd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
Comment thread lib/srtm.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 9f79c63 to 13fa0ba Compare May 3, 2026 16:16
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13fa0badee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 13fa0ba to d2bf614 Compare May 3, 2026 16:21
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2bf614a5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/terrain.py Outdated
Comment thread lib/srtm.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from d2bf614 to 4b58c40 Compare May 3, 2026 22:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b58c40929

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py
Comment thread loraMesh.py
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 4b58c40 to ff28a76 Compare May 3, 2026 22:27
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff28a76501

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
Copy link
Copy Markdown
Member

@GUVWAF GUVWAF left a comment

Choose a reason for hiding this comment

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

In general I like the idea. However, is it correct this currently only works for one specific map?

I left some other comments too.

Comment thread DISCRETE_EVENT_SIM.md Outdated
Comment thread lib/srtm.py Outdated
Comment thread loraMesh.py Outdated
Comment thread loraMesh.py Outdated
@Komzpa
Copy link
Copy Markdown
Contributor Author

Komzpa commented May 15, 2026

@GUVWAF should be good now

@Komzpa Komzpa marked this pull request as draft May 17, 2026 17:47
@Komzpa Komzpa marked this pull request as ready for review May 17, 2026 21:19
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 703b07297d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py
Comment thread lib/terrain.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eca2d3483d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/nodedb_input.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b2f328bdb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/srtm.py
Signed-off-by: Darafei Praliaskouski <me@komzpa.net>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41473b4b01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/map_input.py
@Komzpa
Copy link
Copy Markdown
Contributor Author

Komzpa commented May 18, 2026

@codex review

Current head: 37a392e09a87f8c726e963c81493673926ca4032

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37a392e09a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/map_input.py Outdated
@Komzpa
Copy link
Copy Markdown
Contributor Author

Komzpa commented May 18, 2026

@codex review

Current head: 388d7c6e7d33021c69eac437ebe433e9be63901d

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 388d7c6e7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/map_input.py Outdated
Comment thread lib/nodedb_input.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 388d7c6 to 7833347 Compare May 18, 2026 08:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78333473ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa
Copy link
Copy Markdown
Contributor Author

Komzpa commented May 18, 2026

@codex review

Current head: 78333473ef4eef9be66529ac8c36ecd23e03337f

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78333473ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 7833347 to 8b59706 Compare May 18, 2026 09:30
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b597064f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/srtm.py Outdated
Comment thread lib/map_input.py Outdated
@Komzpa Komzpa force-pushed the codex/split-input-terrain branch from 8b59706 to bc9314c Compare May 18, 2026 10:00
@Komzpa
Copy link
Copy Markdown
Contributor Author

Komzpa commented May 18, 2026

@codex review

Current head: bc9314ceeee33f1be8ef7b27fadba9f2176a3cc6

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants