Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cleanup function for SITL Gazebo on macOS #24110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

farhangnaderi
Copy link
Contributor

@farhangnaderi farhangnaderi commented Dec 14, 2024

Solved Problem

When running PX4 SITL on macOS, pressing Ctrl+C would not always cleanly stop the simulation processes (e.g., gz sim). This often forced users to press Ctrl+C multiple times or manually kill processes.

Solution

  • Added a cleanup() function guarded by if [ "$(uname)" = "Darwin" ].
  • Within cleanup(), use pkill -f "gz sim" || true to stop Gazebo simulation processes.
  • Clear the trap for INT TERM signals right before exit 0.

Changelog Entry

For release notes:

New Gazebo Harmonic SITL on MacOS 

Alternatives

We could also add a kill 0 call or a broader signal handling mechanism, but pkill -f "gz sim" suffices for macOS SITL with minimal side effects.

Test coverage

  • Local testing on macOS Sequoia.

Context

N/A

I cannot add reviewers here. @mrpollo @MaEtUgR @ThomasDebrunner you might want to try.

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-dec-18-2024/42886/1

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