Skip to content

fix(mobile): preserve fractional limits for integer controls - #937

Open
Elon-Jiang wants to merge 1 commit into
petercorke:mainfrom
Elon-Jiang:fix/integer-vehicle-limits
Open

Elon-Jiang wants to merge 1 commit into
petercorke:mainfrom
Elon-Jiang:fix/integer-vehicle-limits

Conversation

@Elon-Jiang

Copy link
Copy Markdown

Summary

A control callback returning integers, such as lambda vehicle, t, x: [1, 0], can leave a simulated vehicle stationary. Bicycle, Unicycle and DiffSteer allocate integer u_limited outputs, then truncate fractional speed, acceleration or steering limits on assignment. With speed_max=0.5 and dt=0.1, the Bicycle callback produces x=0; the equivalent floating callback produces x=0.05.

Allocate these three output arrays as floating point. Numerical/public behaviour changes: integer inputs retain fractional limits and produce the same motion as equivalent floating inputs. Public signatures, input arrays, limiting equations and working floating-input behaviour are unchanged.

Related issue

Fixes #936, reported and claimed before implementation. Checked all 24 open PR file lists and relevant full history/searches. #929 changes reverse odometry, with no overlapping limiting fix.

Validation

Normal editable installation with dev/Swift dependencies on macOS arm64, Python 3.12.13; both native C++ extensions confirmed loaded. No hardware is involved.

  • Original source: all 66 new regression cases fail. Floating callbacks and direct constant controls demonstrate working controls.
  • MPLBACKEND=Agg python -m pytest tests/test_mobile.py -q: 116 passed, 6 skipped. The six skips combine steering limits with DiffSteer, which limits individual wheel speeds. Tests cover integer lists, tuples and arrays, both directions, fractional speed/acceleration/steering bounds, unchanged input arrays, and actual step callbacks.
  • Full required command pytest tests/ --ignore=tests/test_blocks.py --timeout=50 --timeout_method=thread -q: original 2394 passed, 24 failed, 6 errors, 3 skipped; fix 2460 passed, the same 24 failing and 6 error test nodes, 9 skipped. Both have 242 passing subtests. Existing failures involve model resources/cache and unrelated model tests; the six fixture errors involve local Notebook/kernel permissions. Cache exceptions varied between permissions and missing git references after an interrupted fetch. These are not green full-suite results. An unrestricted attempt exceeded the unchanged 50-second budget while fetching external robot-assets.
  • mypy: success, 165 source files. Ruff formatting passes for both changed files; Ruff reports the same 24 baseline diagnostics, with no new diagnostics. git diff --check passes.

Hosted CI, documentation builds and other operating systems remain for upstream validation.

Checklist

  • Checked for existing work and claimed the Issue.
  • Conventional Commits title and one focused fix.
  • Added regression coverage and stated numerical/public behaviour changes.
  • Full local suite green (baseline/environment limitations above).
  • Human personally reviewed the final diff (this automated submission makes no human-review attestation).

Prepared and tested with OpenAI Codex (GPT-6).

Co-authored-by: OpenAI Codex (GPT-6) <noreply@openai.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity · 2 duplication

Metric Results
Complexity 10
Duplication 2

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.

This branch has not been deployed

No deployments
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.

Integer control callbacks lose fractional vehicle limits and stop motion

1 participant