Skip to content

Commit d019861

Browse files
tpayne-censystechjulianoes
authored andcommitted
feat(core): add SetHeartbeatWatchdogTimeout RPC
Add a gRPC path to enable or disable the heartbeat watchdog at runtime. timeout_s is a double in seconds: 0 disables the watchdog, and values greater than 0 must be at least 1 (timeouts between 0 and 1 are invalid).
1 parent 0b13334 commit d019861

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

protos/core/core.proto

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,27 @@ service CoreService {
3232
* if the client hangs or dies, heartbeats stop.
3333
*
3434
* Has no effect if no watchdog is configured (e.g. with the
35-
* --heartbeat-watchdog-timeout option of mavsdk_server).
35+
* --heartbeat-watchdog-timeout option of mavsdk_server, or
36+
* SetHeartbeatWatchdogTimeout).
3637
*/
3738
rpc FeedHeartbeatWatchdog(FeedHeartbeatWatchdogRequest) returns(FeedHeartbeatWatchdogResponse) {}
39+
/*
40+
* Set the heartbeat watchdog timeout.
41+
*
42+
* When timeout_s is greater than 0, the periodic heartbeats sent by MAVSDK
43+
* are only sent as long as FeedHeartbeatWatchdog is called at least once
44+
* per timeout period. If the watchdog times out, heartbeats stop until it
45+
* is fed again.
46+
*
47+
* When timeout_s is 0, the watchdog is disabled and heartbeats follow the
48+
* usual policy (always_send_heartbeats or a connected system).
49+
*
50+
* Values greater than 0 and less than 1 are rejected.
51+
*
52+
* This is an alternative to configuring the watchdog at mavsdk_server
53+
* startup with the --heartbeat-watchdog-timeout option.
54+
*/
55+
rpc SetHeartbeatWatchdogTimeout(SetHeartbeatWatchdogTimeoutRequest) returns(SetHeartbeatWatchdogTimeoutResponse) {}
3856
}
3957

4058
message SubscribeConnectionStateRequest {}
@@ -50,6 +68,11 @@ message SetMavlinkTimeoutResponse {}
5068
message FeedHeartbeatWatchdogRequest {}
5169
message FeedHeartbeatWatchdogResponse {}
5270

71+
message SetHeartbeatWatchdogTimeoutRequest {
72+
double timeout_s = 1; // Timeout in seconds. 0 disables the watchdog. Minimum 1 when enabled.
73+
}
74+
message SetHeartbeatWatchdogTimeoutResponse {}
75+
5376
// Connection state type.
5477
message ConnectionState {
5578
bool is_connected = 2; // Whether the vehicle got connected or disconnected

0 commit comments

Comments
 (0)