Feat: cache last set stage positions#749
Open
tlambert03 wants to merge 3 commits intomicro-manager:mainfrom
Open
Feat: cache last set stage positions#749tlambert03 wants to merge 3 commits intomicro-manager:mainfrom
tlambert03 wants to merge 3 commits intomicro-manager:mainfrom
Conversation
- Introduced g_Keyword_LastSetPosition, g_Keyword_LastSetPositionX, and g_Keyword_LastSetPositionY to MMDeviceConstants.h. - These keywords will facilitate tracking of the last set positions for devices.
Member
I believe so.
I think that would be nice. We might be able to utilize change notifications as well in the future (by either living with the jump forward & back after setting the position, or coming up with a way to query whether a stage is going to issue notifications).
Probably best to clear the cache. One other thing: it's generally best to avoid holding two locks at the same time (because if the order of acquisition ever differs, it will dead lock). So when the function is already acquiring the device adapter lock ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?