Skip to content

fix(mobile): parse each lidar record using its own layout - #966

Closed
Afloat16 wants to merge 2 commits into
petercorke:mainfrom
Afloat16:fix/posegraph-lidar-records
Closed

Afloat16 wants to merge 2 commits into
petercorke:mainfrom
Afloat16:fix/posegraph-lidar-records

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

PoseGraph(lidar=True) reads the beam count only from the first ROBOTLASER1 record, assumes that every record has zero remission values, and filters every scan using the first scan's maximum range. Valid mixed records can therefore silently lose range samples, read a pose field as the timestamp, or discard valid points.

For example, a two-beam record followed by a three-beam record with ranges [2, 3, 4] and timestamp 456 currently produces [2, 3] and timestamp 0. A nonempty remission array also shifts the timestamp without being accounted for.

Change

Read each record's beam and remission counts before locating its ranges and acquisition timestamp. Store its maximum range with the scan and use that limit in scanxy(). Keep the existing range/bearing return format and first-scan summary properties; clarify that verbose beam information describes the first scan.

The record offsets match the upstream g2o RobotLaser::read() implementation: ranges, remissions, two poses, five motion/safety fields, then the acquisition timestamp.

Validation

  • Eleven regression cases cover growing and shrinking beam counts, a scan with no beams, plain and zipped input, nonempty remission values, increasing and decreasing maximum ranges, and uniform-record compatibility.
  • Unchanged main: 9 failed, 2 passed in the new cases.
  • pytest tests/test_posegraph_lidar_records.py tests/test_mobile_posegraph.py tests/test_posegraph_indices.py tests/test_graph_planners.py -q --timeout=30: 86 passed, 18 subtests passed, including the existing real killian.g2o.zip fixture.
  • mypy: all 166 source files passed. The new test module passes Ruff lint, both changed files pass Ruff formatting, and git diff --check passes.
  • The complete repository/platform matrix was not run locally.

Prior work

Checked all 91 existing fork heads and upstream PRs/issues. The two earlier fork branches that change PoseGraph.py concern weighted optimization cost and retain the old first-record layout assumptions. #770 addresses graph vertex indices and #783 addresses graph access and diagnostics; their actual patches do not change the lidar record layout.

Primary contributor: Afloat16.

Prepared with ChatGPT (GPT-6 Astra Pro) assistance.

Read beam counts, remission counts and range limits per scan so mixed ROBOTLASER1 records retain their ranges, timestamp and valid points.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
@codacy-production

codacy-production Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 0 duplication

Metric Results
Complexity 15
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Initialize the first-scan beam count and avoid shadowing range in scanxy to resolve the two new Codacy annotations.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
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.

1 participant