openhumanoids / signal-scope

A live plotting tool for LCM message fields.
BSD 3-Clause "New" or "Revised" License
13 stars 17 forks source link

automatic resizing function #22

Open mfocchi opened 8 years ago

mfocchi commented 8 years ago

Dear Pat

we are starting to use the signal_scope as the default debugging tool in our lab at IIT.
A nice functionality we had in our previous simulation software oscilloscope (we used SL http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.4178&rep=rep1&type=pdf) was to be able to 1) resize the Yaxis limits around the variable value (basically the plot was magnified around the variable value at the instant we typed a certain refresh command). Then, if the variable was changing, 2) the Yaxis limit were moving too (e.g. if we have an increasing amplitude sine the Yaxis limits were "moving" at each cycle as the amplitude was increasing). This was applicable to all the plots. It would be very useful to trigger the reset (1) functionality with a button and the (2) functionality with a toggle switch button. Let me know if something is not clear and if this is feasible.

cheers Michele

patmarion commented 8 years ago

Did you try right-clicking on the plot window and choose "Reset Y Axis Scale". Does that do the functionality you describe in 1? A toggle switch for "auto rescale" would be nice indeed, I imagine that would be straight forward to implement.

mfocchi commented 8 years ago

all right, "Reset Y Axis Scale" does the 1) thanks! but it would be nice to do for all the plots together (since we have a lot of dofs, we have e.g. 18 plots on average, and we need to rescale 1 by 1 that way)

patmarion commented 8 years ago

Here's a quick workaround:

This command will work in your current version of signal-scope but it might segfault because of a python threading issue that I just fixed.

If you want, you could attempt to add a button to the toolbar or an action with a keyboard shortcut to the Edit menu that does the same thing. Just have a look at mainwindow.cpp and find MainWindow::clearHistory(). That function is a good example of looping over each plot. All you have to do is loop over each plot and call onResetYAxisScale. To auto rescale, you could call that function from the draw loop, see the very end of MainWindow::onRedrawPlots() where it loops over each plot.

mfocchi commented 8 years ago

ok thanks! I will have a look

jbcolme commented 8 years ago

Hi Pat,

I work with Michele. The button has been added. Do you think this could be usefull to others? I can make a pull request if you want to take a look.

Cheers.

patmarion commented 8 years ago

Yes, please open a pull request, that would be great.

patmarion commented 8 years ago

I'll leave this issue open to track the remaining feature request, a toggle button to turn on automatic resizing of the plots.