Improve timing of submitting current position to data stream in set_current_position()
of Thorlabs cube motor
#206
Labels
collaborators
Worked on by external collaborator. Might need some extra help on code integration.
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 thewait_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 thewait_for_completion()
inset_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 formessage_id
andmessage_type
it checks against?Originally posted by @ivalaginja in #200 (comment)
The text was updated successfully, but these errors were encountered: