You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am under the impression drone.core.connection_state() returns a ConnectionState object which contains a single boolean variable is_connected which will be true if there is an active telemetry connection to the drone, and false otherwise.
I am writing a class to abstract away some of the telemetry code and need a member variable to indicate whether there is an active connection. e.g. the following code:
asyncdefconnect_to_drone(self):
self.drone=System()
awaitself.drone.connect(system_address=self.system_address)
self.logger.info('connected to telemetry via serial')
whileTrue:
asyncforstateinself.drone.core.connection_state():
ifstate.is_connected:
self.logger.info('drone metrics object connected to drone')
self.is_connected=Trueifnotstate.is_connected:
self.logger.info('drone metrics object disconnected to drone')
self.is_connected=Falseawaitasyncio.sleep(1)
My expectation is this code would check the connection state at a rate of ~once per second, and the self.is_connected variable would remain true as long as there is a maintained connection. Instead the logs show the response from drone.core.connection_state() repeatedly flips even when maintaining a stable connection:
INFO : drone_api : drone metrics object connected to telemetry via serial : 2024-12-05 17:42:59,852
INFO : drone_api : drone metrics object connected to drone : 2024-12-05 17:42:59,864
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:42:59,870
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:42:59,874
INFO : drone_api : drone metrics object connected to drone : 2024-12-05 17:42:59,878
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:42:59,882
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:42:59,886
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:03,357
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:03,361
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:03,364
INFO : drone_api : drone metrics object connected to drone : 2024-12-05 17:43:06,140
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:06,147
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:06,151
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:09,148
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:09,152
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:09,156
INFO : drone_api : drone metrics object connected to drone : 2024-12-05 17:43:09,327
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:09,335
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:09,339
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:20,152
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:20,156
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:20,160
INFO : drone_api : drone metrics object connected to drone : 2024-12-05 17:43:21,154
INFO : drone_api : drone metrics object disconnected to drone : 2024-12-05 17:43:21,160
....
It appears like the iterative returned by drone.core.connection_state() when there is an active connection contains 6 boolean values in the sequence [False, False, False, True, False, False]
This doesn't seem like the intended functionality.
The text was updated successfully, but these errors were encountered:
I am under the impression
drone.core.connection_state()
returns aConnectionState
object which contains a single boolean variableis_connected
which will betrue
if there is an active telemetry connection to the drone, andfalse
otherwise.I am writing a class to abstract away some of the telemetry code and need a member variable to indicate whether there is an active connection. e.g. the following code:
My expectation is this code would check the connection state at a rate of ~once per second, and the self.is_connected variable would remain true as long as there is a maintained connection. Instead the logs show the response from
drone.core.connection_state()
repeatedly flips even when maintaining a stable connection:It appears like the iterative returned by
drone.core.connection_state()
when there is an active connection contains 6 boolean values in the sequence[False, False, False, True, False, False]
This doesn't seem like the intended functionality.
The text was updated successfully, but these errors were encountered: