|
From: | Nate Temple |
Subject: | Re: QT block to plot datapoints as they come in and keep history |
Date: | Wed, 18 Dec 2019 13:39:14 -0800 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |