Repository navigation
fix(project-airsim): integrate JSBSim in 1 ms substeps so the quadrotor rests and flies - #439
Open
andrewjong wants to merge 1 commit into
Open
andrewjong wants to merge 1 commit into
andrewjong wants to merge 1 commit into
Conversation
…or rests and flies With JSBSim physics, jsbsim-dt equalled the 3 ms simulator tick (as in upstream's quadrotor example). At that step quadrotor_x's landing-gear friction (mu = 5) solves unstably: the vehicle chatters on the ground (IMU spikes near 50 m/s^2, ground-truth rates +/-0.3 rad/s) and PX4 needs ~90 s before preflight passes. Project AirSim runs JSBSim in substeps of at most jsbsim-dt per tick, so capping it at 1 ms gives three substeps: at rest, ready in ~5 s, no measurable CPU or RTF cost. Spawn mode and Unreal collision were ruled out; the model is unchanged. - generate_scene.py: jsbsim-dt = min(tick, JSBSIM_MAX_DT_S = 1 ms) - harness: --physics fast-physics|jsbsim for Project AirSim runs (sets PROJECT_AIRSIM_PHYSICS; part of the campaign fingerprint); listed in `airstack help test` - contract test pins the cap; guide and release note drop "experimental" - VERSION 0.21.0-dev.21 Validated: liveliness + takeoff/hover/land at 0.5/1/2 m/s on --physics jsbsim, 20/20. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What features did you add and/or bugs did you address?
Which GitHub issue does this address?
No issue. It finishes the JSBSim option of the Project AirSim backend (feat(sim): Project AirSim simulator backend (airstack up --sim projectairsim) #437), which was merged as experimental.
Additional description if not fully described in the GitHub issue
With
--physics jsbsim, PX4 took about 90 s to pass preflight. The vehicle chattered on the ground: accelerometer spikes near 50 m/s² and ground-truth roll/pitch rates of ±0.3 rad/s while it should have been at rest.Cause: we integrated JSBSim at the 3 ms simulator tick (
jsbsim-dt= tick, as in upstream's quadrotor example). At that step the landing-gear friction ofquadrotor_x(μ = 5) solves unstably. The spike size matches the friction limit (5 × 55 N ≈ 49 m/s² on 5.6 kg), and consecutive samples flip sign, which is the signature of numerical instability rather than real sliding.Ruled out:
start-landed, ground free, airborne like upstream);main).The earlier "airborne spawn rejected" finding was the empty
jsbsim-modelbug, fixed in feat(sim): Project AirSim simulator backend (airstack up --sim projectairsim) #437.Please add videos and images to demonstrate the feature.
No visual change. Evidence is PX4's state at rest and the flight metrics below.
How did you implement it?
simulation/project-airsim/config/generate_scene.py:jsbsim-dt = min(tick, JSBSIM_MAX_DT_S)withJSBSIM_MAX_DT_S = 0.001. Project AirSim runs JSBSim in substeps of at mostjsbsim-dtper clock tick (in both v1.1.0 andmain), so the default 3 ms tick now runs three 1 ms substeps. The JSBSim model is unchanged.cs_vehicle_at_restTest harness: new
--physics fast-physics|jsbsimoption. For Project AirSim runs it setsPROJECT_AIRSIM_PHYSICS, same asairstack up --physics; other sims ignore it. It is part of the run's campaign fingerprint, so JSBSim metrics are never compared against fast-physics ones; unset keeps existing fingerprints unchanged.airstack help testlists it.Docs: the guide's physics table no longer calls JSBSim experimental and explains the substep. The 0.21.0 release note is updated.
How do you run and use it?
Then fly as with fast-physics, for example with the GCS takeoff and land tasks. Per robot via a fleet file:
robots.<name>.physics: jsbsim.Testing with PyTest
What pytests did you add to ensure the feature is reliable and robust? What metrics are used?
test_jsbsim_substeps_at_most_1msintests/meta/test_project_airsim_scene_contract.pypins the cap: 1 ms at the default tick, and a finer tick is used as-is. The new--physicsoption lets the existing liveliness and takeoff/hover/land tests run on JSBSim, using their usual metrics.What's the exact command to run the pytests that test your feature?
What are the expected results of the tests?
Unit/meta: 439 passed. The JSBSim system run passed 20/20. Against fast-physics on the same harness and image:
test_px4_ready)Odometry error against ground truth is 0.38–0.55 m on JSBSim (0.28–0.39 m on fast-physics). That includes a constant −0.20 m altitude offset, because JSBSim's vehicle rests on its gear 0.2 m above the spawn point.
Documentation
Was mkdocs.yml updated? (y/n)
n. Existing pages changed: the Project AirSim guide (physics section) and the release notes.
mkdocs build --strictis clean.Do the docs have sufficient scope such that a newcomer can easily reproduce and use your feature?
Yes. The guide's physics section covers selection, the substep and its reason, and the test flag.
Is there sufficient visual media?
Not applicable.
Versioning
Did you make sure to bump the version number in the
.envfile according to semantic versioning?Yes: 0.21.0-dev.20 → 0.21.0-dev.21.
🤖 Generated with Claude Code