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 reboot command for SITL #24052

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

unjambonakap
Copy link

@unjambonakap unjambonakap commented Nov 28, 2024

Solved Problem

Lack of reboot function on SITL
There exists a shutdown that does a rather dirty exit()

Current state of the change

  • Functional - can reboot many times, working just fine - no memleaks (for px4_sitl_default)
  • debug prints here and there
  • temporarily put tracer.hpp that was helpful for debugger resource management issues
  • huge change - breakup needed

Solution

A no-hack solution where everything is properly deinited()
It means an unfortunately tentacular in order to achieve the graal: every resource used is then freed()

Non exhaustive list of changes that were necessary:

  • reworked the main / Pxh
  • Registering modules stop_command/request_stop/is_running in a ModuleManager
  • Adding stop functionality on some modules that do not possess it
  • Have a replacement LockstepScheduler driver when the SITL module is stopped
  • Cleaning of WorkItem removal mechanism. I strongly suspect the existing implementation have race conditions that can be dramatic (to put things in perspective, race happens on module stop())
  • Encountered many queue systems. First time really diving in the codebase, platforms/common/include/px4_platform_common/workqueue.h appears almost obsolete (used by camera_capture.cpp. Others?) - It could probably be moved to the WorkItem framework

@unjambonakap unjambonakap force-pushed the dev-reboot-terminate-posix branch from 0be9a57 to 69e55b8 Compare November 28, 2024 17:48
@unjambonakap unjambonakap force-pushed the dev-reboot-terminate-posix branch from e981a69 to f9b093a Compare November 28, 2024 18:17
@unjambonakap unjambonakap changed the title Dev reboot terminate posix Add reboot command for SITL Nov 28, 2024
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