Hi Matt, Phil,
Phil - do you know how sending work to a tab would jive with the blacs state machine? I don't remember enough details to know how things would go, but I could imagine that maybe a plugin could queue work for a blacs device but it wouldn't happen until after a shot completed or something. I could be way off base here though.
I think that the mirrors which only need an oscilloscope and photodetector to align
could be controlled with a plugin by controlling that hardware directly instead of via a blacs tab. In fact lock monitor would be pretty well suited to this, so you probably wouldn't even need to create your own plugin. You'd still need to write some code to talk to the hardware etc., but you wouldn't have to learn how to write blacs plugins. You could have it read the optical power from a scope, then have it automatically realign the beam if the power falls below some threshold. You can actually have pretty minimal code duplication too if you organize it well. For example, see how the
Zaber stage labscript device is set up. There is a `ZaberInterface` class that can be used from anywhere, even outside of blacs/labscript, to control a Zaber stage. All of the blacs-specific code is contained in `ZaberWorker`. So your plugin could just use its `ZaberInterface`-equivalent class to control any hardware that doesn't have an associated blacs tab, and then it would use the same hardware interfacing code that blacs uses.
As for the alignment which requires running experiments with atoms, I can't think of a great way to do that with a plugin so I think it might be better to use a lyse script. In this approach you could have lyse use runmanager's remote interface to run experiments. The lyse script would run a series of these experiments, scanning the mirror position, then do some analysis to determine the optimal position. You could then have it update your hdf5 globals file with the result so that future shots will be compiled with the newly-calibrated mirror position. This approach could also be used for alignments which don't require atoms since you could write a labscript sequence which just read a value off of a scope. That is probably slower than using a plugin, and probably less convenient to automatically trigger a realignment when needed, but maybe it would be convenient to use the same approach to align your beams whether or not you need atoms to do so.
I also have a vague memory that others on this mailing list have done some work on just-in-time compilation of sequences to handle calibrated values. They may have done things very similar to what you are considering, so they would likely have more helpful input.
Cheers,
Zak