dimanche 6 décembre 2020

How to implement a process as a observer for UI to a data stream

Overview

I have a stream of addressed data being sent back and forth on a bus (think robot arm position if that helps get the idea) that I'm processing and logging. The bandwidth is big enough to bog down a core on a slow CPU so I want to run a GUI on another process to view select elements of the data live, But I'm unsure of the proper way to design this.

My idea

In python, my idea is to create a process to manage the live data then ship it to the main GUI process(multiprocess.value()) running the PyQt5. In there it will use a sort of smart observer to distribute the data to the labels at 10Hz.

Previous Bad Implementation

I'm cautious because I tried doing this using appjar in a thread but my GUI had a lot more overhead not just including appjar and I sent over a list in a queue. The main problem with this is kept overflowing the queue implemented to be an inter-thread connection and it displayed everything as fast as it came in.

Is it good practice to use processes in this way? is there a better implementation or pattern? I think it may help by noting this is my first use of multiprocessing and I was told that should be treated as disconnected from the main process. I'm not sure if this is true. This seems a valid claim?

Aucun commentaire:

Enregistrer un commentaire