Hey,
I had similar requirements a few years ago and came up with a rolling-scope block:
I haven't used this code for quite a while so no guarantees but maybe it can serve as a base for your own implementation.
Hope that helps! Cheers, Julian Am 18.12.2019 um 22:30 schrieb Lukas Haase <address@hidden>:
Hello,
I have a block which computes a distance and outputs this distance regularly (10x per second) via a message.
I am looking for a way to plot this distance over time: Basically, whenever a new update comes in, it should show this value while keeping a certain amount of past samples so that the distance can be seen over time.
I played with the QT GUI Time Sink for quite some time (playing with sample rate, update period, sending a vector of same numbers in the message or sending just a vector with one element). The value updates but it only shows the point at t=0 which moves up and down on the y-axis ... but I do not get the history over time.
I also tried implementing a "message-to-sample" converter that works like this:
def incoming_msg(self, msg): # whenever new message comes in, update our state if pmt.is_f32vector(msg): dist = pmt.to_python(msg) self.distance = dist[0]
def work(self, input_items, output_items): # this is a source block output_items[0][:] = self.distance # for each block, just output constant signal return len(output_items[0])
Now I see a constant line that shifts up and down regularly, but still no distance-vs-time plot.
Any suggestions?
Thanks, Luke
|