feat(core): add heartbeat watchdog (deadman timer) (#2895)#2905
Open
tpayne-censystech wants to merge 1 commit into
Open
feat(core): add heartbeat watchdog (deadman timer) (#2895)#2905tpayne-censystech wants to merge 1 commit into
tpayne-censystech wants to merge 1 commit into
Conversation
Add heartbeat_watchdog_timeout_s to Mavsdk::Configuration. While configured, periodic heartbeats are only sent as long as feed_heartbeat_watchdog() (C++/C API) or the FeedHeartbeatWatchdog RPC keeps being called at least once per timeout period; on expiry heartbeats latch off, including across reconnects and discovery, until fed again, so they reflect the liveness of the client application. A feed only restarts heartbeats stopped by the watchdog, and only if they are supposed to be sent in the first place (always_send_heartbeats or a connected system); it never starts heartbeats that are off for any other reason. mavsdk_server accepts the timeout via the new --heartbeat-watchdog-timeout CLI option, plumbed through the new mavsdk_server_run_with_mavlink_ids_and_options() C API entry point. Covered by unit tests in heartbeat_watchdog_test.cpp (expiry, latching, policy, feed restart, runtime reconfiguration) and a gRPC forwarding test in core_service_impl_test.cpp.
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.
Implements external control of MAVSDK heartbeat emission, per the API added in mavlink/MAVSDK-Proto#415.
When enabled, this disables MAVSDK's internally generated HEARTBEAT sending and drives emission from the client via a runtime-configurable deadman timeout. The client refreshes within the timeout to keep heartbeats flowing; if it crashes, disconnects, or stops servicing the path, MAVSDK stops sending, so PX4 sees the GCS/companion component go offline and triggers the configured lost-link failsafe (e.g. RTL). MAVSDK continues to own heartbeat content (sysid, compid, mav_type, etc.); the client only controls whether emission continues. Default behavior is unchanged.
Includes the proto submodule bump to the merged commit, regenerated mavsdk_server code, and the core implementation with tests.
Depends on mavlink/MAVSDK-Proto#415 (merge first).
Closes #2895
Contributed by Tyler Payne on behalf of Censys Technologies, Inc.