Conversation
|
Perhaps a slight misunderstanding here — the aim of #807 was to avoid notifying the final position at the start of the move (note that the move does not complete during the SetPosition call), because that causes GUI displays to jump to the destination and back to an intermediate point, if the stage already notifies during the move — which I think the Demo stage does, or at least that's what the code looks like. On the other hand, it's true that ASITiger does not currently notify position changes at all (since #807, like many stages). @nicost Do you think it makes sense for stages to notify their destination at the start of a move, when asynchronous notifications are not immediately available? Also Cc @jondaniels, @bls337. |
|
I do not think that any callbacks should be made for devices that do not generate callbacks themselves. After #808 is merged, the calling code can figure out whether or not to expect callbacks from a stage and decide its own strategy how to deal with that. |
|
I am also confused about the CDemoXYStage additions. It seems to be reporting perfectly for me now. I see the stage updating its position a couple of times, simulating a stage moving with a finite speed, and arriving at the predetermined position. |
|
I was not aware of this callback, as it was implemented in the base class and not specifically for ASI. Nor did I know people were using it. I can see how it is confusing to invoke the callback when Just brainstorming here, how about adding a new method to CXYStageBase that calls in order: |
|
Ah, sorry, maybe I've misunderstood the purpose of this callback and how to use it. In /**
* @brief Signal that the XY stage has arrived at a new position.
*/
int OnXYStagePositionChanged(double xPos, double yPos)
{
if (callback_)
return callback_->OnXYStagePositionChanged(this, xPos, yPos);
return DEVICE_NO_CALLBACK_REGISTERED;
}and then again in /**
* @brief Signal the UI when the XY stage has reached a new position.
*/
virtual int OnXYStagePositionChanged(const Device* caller, double xPos, double yPos) = 0;Based on this, it seems to me that Is there a different callback that emits once the stage has reached its final destination after a move? |
|
AFAIK there isn't a place in the stage device adapter structure where the device adapter knows that a move is complete. As a result, the device adapter cannot emit the The calling code normally initiates a stage move (e.g. using Maybe there could be a bit of code in the |
yeah, that's my understanding as well, for better or worse. And definitely, many of the device adapters don't follow the behavior here; and therefore it becomes semantically inconsistent to do it, and rely on it, in some devices when you know you can't rely on it in all devices.
Yeah, the general challenge of signaling the completion of a move has been left to the application level. for what it's worth, both MMStudio and pymmcore-plus have such a construct.
I can definitely sympathize with the desire of the PR here :) ... but it's hard if not impossible to present this as a device-consistent API |
|
Agreed with all. I think what makes the most sense under the current structure is:
And as Nico mentioned, #808 will soon give applications (including, e.g., the Stage Control window) better tools for this. The Demo XY stage simulates type 1 (especially since #597, but confounded by the
As Jon mentioned, I think we should update the |
|
Fantastic, thanks for clarifying and proving context here. I'll close this PR. |
|
For the record, the ASI controller can indicate move completion using a TTL output and this is routinely used in real life (using mode TTL Y=2). If you really need the |
Follow up to #807
In this PR, I'm updating the
OnXYStagePositionChangedcallback on theCDemoXYStageto report the final position rather than the starting position.I'm also adding a
OnXYStagePositionChangedcallback for the ASITiger XY stage, which currently does not emit this callback. I haven't tested this with hardware, but I think it looks like a pretty straightforward change which does not modify the original behavior of relying onCXYStageBase<CXYStage>::SetPositionUm(x, y).