Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve timing of submitting current position to data stream in set_current_position() of Thorlabs cube motor #206

Open
ivalaginja opened this issue May 24, 2024 · 1 comment
Assignees
Labels
collaborators Worked on by external collaborator. Might need some extra help on code integration.

Comments

@ivalaginja
Copy link
Collaborator

ivalaginja commented May 24, 2024

Ok this one is tricky. If we do not wait for completion in the set_current_position(), it intercepts the first command and executes the second command instead, and correctly. So I am fine with this behavior and don't want to add the wait_for_completion() there.

However, the method get_current_position() gets called too early and puts an intermediate position on the current_position data stream, which the device reads while it is moving. Which is obviously not at all what we want.

We then tried adding the wait_for_completion() anyway, to fix the wrong values on the data stream, but in this case it just finishes running the first command. Data stream value is still wrong. And it puts command 2 in a cache apparently and runs it before the next command that is sent to the motor... also not the behavior we want, so I still vote against adding the wait_for_completion() in set_current_position().

Since this was so weird, we checked the data stream values after calling home() a couple of times and this is always fine, so it's something about the command data stream monitoring and getting the real device position before the device stops moving.

I don't actually understand what wait_for_completion() does. @a-sevin, maybe you can help out with this conundrum? What does it do and what are the values for message_id and message_type it checks against?

Originally posted by @ivalaginja in #200 (comment)

@ivalaginja
Copy link
Collaborator Author

@a-sevin even if I assigned you, this is not a high-priority issue at this time so don't sweat it if you can't look into this anytime soon.

@ivalaginja ivalaginja changed the title Improve timing of submitting current position to data stream in set_current_position() Improve timing of submitting current position to data stream in set_current_position() of Thorlabs cube motor May 24, 2024
@ivalaginja ivalaginja added the collaborators Worked on by external collaborator. Might need some extra help on code integration. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collaborators Worked on by external collaborator. Might need some extra help on code integration.
Projects
None yet
Development

No branches or pull requests

2 participants