Skip to content

fix(isaac-sim): pegasus drone retains PX4 state across Stop/Play#363

Merged
andrewjong merged 2 commits into
developfrom
aj/fix/isaac-pegasus-restart
May 28, 2026
Merged

fix(isaac-sim): pegasus drone retains PX4 state across Stop/Play#363
andrewjong merged 2 commits into
developfrom
aj/fix/isaac-pegasus-restart

Conversation

@andrewjong
Copy link
Copy Markdown
Member

What features did you add and/or bugs did you address?

Bumps the PegasusSimulator submodule to fe8b5a10, which fixes a bug where pressing Stop and then Play in Isaac Sim caused the drone's props to spin and veer off toward its previous PX4 setpoint instead of resetting cleanly.

No AirStack-side code changes — just a submodule pointer update and a version bump.

How did you implement it?

All fixes live in the submodule commit. Summary of what changed there:

  1. PX4 was not actually killed on Stop. Popen.kill() only targeted the parent and never wait()ed, so helper threads/children survived and kept talking to the simulator on the next Play. PX4 is now launched with start_new_session=True and the whole process group is killed via SIGTERM -> wait -> SIGKILL -> wait in kill_px4().

  2. Leaked physics callbacks reapplied stale rotor speeds. After Stop, callbacks could still read the backend's last commanded rotor speeds and apply them as thrust. _rotor_data is now zeroed on backend.stop(), and backend.update() early-returns when not running / no connection, so any stale callback applies zero thrust.

  3. Tearing down and rebuilding the multirotor caused [simulator_mavlink] poll timeout on the second Play. Isaac's add_physics_callback does not reliably overwrite an existing key, so the new multirotor's sensor callbacks failed to register and PX4 never received HIL_SENSOR. The multirotor and its physics callbacks are now kept alive across Stop/Play cycles; the per-vehicle sim_start_stop callback drives backend.start()/stop() (which relaunches a clean PX4 process each Play).

See the submodule commit message for the full rationale.

How do you run and use it?

# From the repo root, ensure the submodule is at the new pointer
git submodule update --init --recursive

# Bring up Isaac Sim with Pegasus (single drone is fine to reproduce)
airstack up isaac-sim

Then in the Isaac Sim UI:

  1. Press Play — drone spawns and PX4 connects.
  2. Press Stop.
  3. Press Play again.

Before this fix: props spin immediately and the drone drifts toward the previous setpoint; PX4 logs may show [simulator_mavlink] poll timeout.

After this fix: drone sits idle with zero thrust, PX4 reconnects cleanly, and behavior is identical to the first Play.

Testing with PyTest

No new pytests added — this is a submodule pointer bump for a UI-driven Stop/Play interaction that the current tests/ harness does not exercise (the takeoff/hover/land test runs a single Play cycle).

Existing relevant suites should continue to pass:

airstack test -m liveliness --sim isaacsim --num-robots 1 --stress-iterations 1 -v
airstack test -m takeoff_hover_land --sim isaacsim --num-robots 1 -v

Expected: same pass/fail status as develop.

Documentation

  • Was mkdocs.yml updated? n — submodule-only change, no new user-facing surface.
  • Newcomer reproduction steps are in the "How do you run and use it?" section above.
  • No new visual media; the fix is observable via the manual repro above.

Versioning

Bumped .env VERSION from 0.19.0-alpha.1 to 0.19.0-alpha.2 (bug fix on the current alpha line per the template).

andrewjong and others added 2 commits May 27, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Isaac Sim Pegasus integration to prevent PX4 and rotor-state from persisting across Isaac Sim Stop/Play cycles by bumping the PegasusSimulator submodule, and increments the AirStack release version to reflect the fix.

Changes:

  • Bump simulation/isaac-sim/extensions/PegasusSimulator submodule to include Stop/Play reset fixes (PX4 process-group teardown, rotor speed state reset, and callback lifecycle adjustments).
  • Bump .env VERSION from 0.19.0-alpha.1 to 0.19.0-alpha.2.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.env Increments the project version to 0.19.0-alpha.2 to reflect the Isaac Sim Stop/Play bug fix release.
simulation/isaac-sim/extensions/PegasusSimulator (submodule) Advances the PegasusSimulator integration to a commit that resets PX4/rotor/callback state cleanly across Stop/Play.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrewjong andrewjong merged commit dff3dc6 into develop May 28, 2026
3 of 4 checks passed
@andrewjong andrewjong deleted the aj/fix/isaac-pegasus-restart branch May 28, 2026 21:23
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