Core¶
- class mavsdk.core.ConnectionState(is_connected)¶
Bases:
objectConnection state type.
- Parameters:
is_connected (bool) – Whether the vehicle got connected or disconnected
- class mavsdk.core.Core(async_plugin_manager)¶
Bases:
AsyncBaseAccess to the connection state and core configurations
Generated by dcsdkgen - MAVSDK Core API
- async connection_state()¶
Subscribe to ‘connection state’ updates.
- Yields:
connection_state (ConnectionState) – Connection state
- async feed_heartbeat_watchdog()¶
Feed the heartbeat watchdog.
MAVSDK can be configured with a heartbeat watchdog (deadman timer). While configured, the periodic heartbeats sent by MAVSDK are only sent as long as this keeps being called within the timeout period. If the watchdog times out, heartbeats stop until it is fed again.
Call this at least twice per timeout period. Heartbeats are sent at 1 Hz and the deadline is only checked when one is due, so feeding exactly once per period leaves no margin and a single late feed already drops a heartbeat.
This allows MAVSDK’s heartbeats to reflect the liveness of the client: if the client hangs or dies, heartbeats stop.
Has no effect if no watchdog is configured (e.g. with the –heartbeat-watchdog-timeout option of mavsdk_server, or SetHeartbeatWatchdogTimeout).
- name = 'Core'¶
- async set_heartbeat_watchdog_timeout(timeout_s)¶
Set the heartbeat watchdog timeout.
When timeout_s is greater than 0, the periodic heartbeats sent by MAVSDK are only sent as long as FeedHeartbeatWatchdog is called at least once per timeout period. If the watchdog times out, heartbeats stop until it is fed again.
When timeout_s is 0, the watchdog is disabled and heartbeats follow the usual policy (always_send_heartbeats or a connected system).
Values greater than 0 and less than 2 are rejected: heartbeats are sent at 1 Hz, so a timeout shorter than two heartbeat periods cannot be met reliably.
This is an alternative to configuring the watchdog at mavsdk_server startup with the –heartbeat-watchdog-timeout option.
- Parameters:
timeout_s (double) – Timeout in seconds. 0 disables the watchdog. Minimum 2 when enabled.
- async set_mavlink_timeout(timeout_s)¶
Set timeout of MAVLink transfers.
The default timeout used is generally (0.5 seconds) seconds. If MAVSDK is used on the same host this timeout can be reduced, while if MAVSDK has to communicate over links with high latency it might need to be increased to prevent timeouts.
- Parameters:
timeout_s (double) – Timeout in seconds