Feat: cache last set stage positions #749
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a (somewhat hidden) new feature: the ability to query the "last set" stage positions (i.e. the last known command sent from the core to a stage device). The use case arises during an MDA (when we can relatively safely assume that only the core, and not, say, a joystick, is controlling the stage), and we want to at least have the option to avoid sending a command to a device if we suspect that it is unnecessary. The new API here would now be:
that's a bit hard to discover (perhaps rightly so), but could be carefully used by applications if desired.
obvious caveats that should be heeded when using this:
setRelativePositionis used, to reflect the fact that we know they are stale... and we don't try to be smarter about updating them).questions
CMMCore::setOrigin, I set the lastPosition to "0" ... is that a correct interpretation of the semantics of that command?lastKnownPosition, and also update the cache anytime we callStage->GetPosition?pStage->SetAdapterOrigin?