Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rqt_plot: (matplot only) shows strange output after running for ~5 minutes (progressively gets worse) #48

Closed
ablasdel opened this issue Dec 10, 2012 · 10 comments
Assignees

Comments

@ablasdel
Copy link
Contributor

The issue:snapshot14

steps to duplicate
execute the UnderstandingTopics tutorial (http://www.ros.org/wiki/ROS/Tutorials/UnderstandingTopics)
leave the rqt_plot open for an extended period of time.
You will see the following:
after

It should look like the following (it starts this way and progressively gets worse:
before1

groovy
using rqt 1.5

@ghost ghost assigned DorianScholz Dec 10, 2012
@DorianScholz
Copy link
Member

From the screenshots it looks like rxplot also has this problem (maybe not as strong), is that correct?
Then I would guess this has something to do with the MatPlot backend.
Could you try to reproduce this with the PyQtGraph and QwtPlot backends? (selectable form the settings menu)

@ablasdel
Copy link
Contributor Author

Yes it happens on rxplot too but it does seem more pronounced on the rqt
version.

I will try to reproduce on the other plotters today.

@ablasdel
Copy link
Contributor Author

Tested QwtPlot and it doesn't seem to happen (so far I will continue running this to be sure)

After fixing a bug in pyqtgraph in pyqtgraph/graphicsItems/PlotItem/PlotItem.py:

        if name is not None and self.legend is not None:
->
        if name is not None and hasattr(self, 'legend') and self.legend is not None:

It also doesn't seem to happen.
It looks pretty clear that this is a MatPlot bug.

Perhaps we should depend on one of the other packages and make it the default?

@ablasdel
Copy link
Contributor Author

Just to note it gets really bad and really slow after awhile of running. I talked with some people here and they mentioned this slowness has been an issue in rxplot for some time.
Really bad

@DorianScholz
Copy link
Member

I had a quick look at the MatPlot backend code which someone ported form rxplot and it looks like the calculation of the axes bounds might be the problem, as it calculates the min and max y values over the complete data sequence...
I made a quick change to only use the last 100 data points, which should prevent this from happening.
Could you check if this was the reason and if it looks better now?
Still this is just a dirty hack and I think we should rather depend on the PyQtGraph library, but it is not the Ubuntu package repos...
Otherwise someone has to take a deeper look into making the MatPlot backend work better.

@ablasdel
Copy link
Contributor Author

I checked it out and this did not fix the problem and actually caused some
rather hilarious bouncing in graphs with regular cycles.
You can see this bouncing if you run the following lines from the Tutorials:

http://www.ros.org/wiki/ROS/Tutorials/UnderstandingTopics

rosrun turtlesim turtlesim_node
rostopic pub /turtle1/command_velocity turtlesim/Velocity -r 1 -- 2.0  -1.8
rosrun rqt_plot rqt_plot --args /turtle1/pose/x:y

This could probably be avoided if we ensured the currently view-able graph was considered in the bound limits.

@ablasdel
Copy link
Contributor Author

Also I have some new information on the original bug.

If you pause the plot and then unpause it the time you had it paused will show up in the graph as a perfectly smooth graph and then the plotter will start to draw incorrectly again.
pauseunpause

@ablasdel
Copy link
Contributor Author

an aside: What is preventing us from depending directly on one of the other 2 plotting libraries and using those as the default?

dirk-thomas added a commit to ros-visualization/rqt_common_plugins that referenced this issue Dec 24, 2012
@dirk-thomas
Copy link
Contributor

The problem is that the matplot function is taking longer and longer and therefore block reading the incoming data. This is also the reason why "pause" make the curves perfectly smooth again.

I have update the code to not use collections for the data but simple list (which turns out to scale better), perform the calculation of the min/max y values when adding values (instead of repeatedly when drawing going over all/parts of the data).

It scales much better now but the inherent problem is not fixed - the data will always accumulate over time. We could either limit the history or add a manual clean option if we want this to be fixed completely.

@ablasdel
Copy link
Contributor Author

migrated to ros-visualization/rqt_common_plugins#19

eacousineau pushed a commit to eacousineau/rqt_common_plugins that referenced this issue May 22, 2013
dirk-thomas added a commit to ros-visualization/rqt_plot that referenced this issue Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants