I'm working on a "speedometer" project for my drone. It uses the Mavlink protocol to communicate with the drone utilizing the Mavlink mirror in Mission Planner. Basically, using Queue, the "listener is setup like this:
def listener(out_que):
# from the mavlink.io page
the_connection=mavutil.mavlink_connection('tcp:localhost:14550')
the_connection.wait_heartbeat()
while True:
the_message=the_connection.recv_match(type='whatever mavlink msg',blocking=True).parameter
out_que.put(the_message)
I can print the message out using:
que = queue.Queue()
threading.Thread(target=listener, args=(que,), daemon=True).start()
while True:
value = que.get()
print(value)
However, I am trying to use this data to update the value of a kivy Speedmeter. Ive tried this two ways:
que = queue.Queue()
threading.Thread(target=listener, args=(que,), daemon=True).start()
class MyApp(App):
while True:
value=que.get()
if __name__=='__main__':
MyApp().run()
The first way does not allow the speedmeter to load but the value variable is updating.
The second:
que = queue.Queue()
threading.Thread(target=listener, args=(que,), daemon=True).start()
class MyApp(App):
value=que.get()
if __name__=='__main__':
MyApp().run()
This allows the speedmeter to load but will only update the value one time.
the .kv file looks like this:
SpeedMeter:
value: app.value
My apologies for the newbie question , but how can i get this value to update or am I going about this the wrong way?