microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
35 stars 26 forks source link

Handle 'Motion outside limits' exceptions #22

Open mickp opened 9 years ago

mickp commented 9 years ago

Currently, these go unhandled and show up in the standard error, and this occasionally breaks mosaic and stagemover's state (I have not yet found a reliable way to reproduce this)..

mickp commented 8 years ago

Partially fixed in merge #138 . Mosaic now stops cleanly on movement errors.

iandobbie commented 4 years ago

Suggested that Danny think about implementing something in new touchscreen window.

A suggestion is to make relevant axis border flash red, other ideas welcome.

carandraug commented 4 years ago

A suggestion is to make relevant axis border flash red, other ideas welcome.

The corresponding border flashing red, and the whole stage draw shaking would be something common on games to indicate this sort of thing.

carandraug commented 3 years ago

This issue was mentioned on the latest UI meeting. Instead of making border flash red, it was suggested that it could just display an error message.

iandobbie commented 3 years ago

Ok, how about just a modal dialogue? I have just added them in my branch motion-errors. One drawback this involves importing wx into the handlers/stagePositioner.py file which seems like overkill. Do we need a gui/error-dialouge.py or similar to deal with this case, the mosaic with no camera active and the openGL out of memory errors that Ilan is getting?

iandobbie commented 2 years ago

Thinking about this again, the core problem seems to be solved in that the stageposition handler traps the error and raises a RuntimeError eg:

raise RuntimeError("Tried to move %s " % (self.name) + "outside soft motion limits (target %.2f, limits [%.2f, %.2f])" % (pos, self.softLimits[0], self.softLimits[1]))

I think the calling function should do a try except and catch the raised exception but it should probably be a custom MotionLimits error or similar.

iandobbie commented 2 years ago

I have a branch that traps most movement errors in https://github.com/iandobbie/cockpit/tree/motion-errors. It raises a MotionError on attempted motion outside limits and traps this in various places a generates a modal dialog that says you are trying to move outside limits.

This could be replaced with a pulsing edges in question but I think that the mosaic or macro stage control might not be visible.