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

make gotoaz()/movement commands in general to be non-blocking #38

Closed
fergusL opened this issue Oct 1, 2019 · 0 comments
Closed

make gotoaz()/movement commands in general to be non-blocking #38

fergusL opened this issue Oct 1, 2019 · 0 comments

Comments

@fergusL
Copy link
Contributor

fergusL commented Oct 1, 2019

Anthony advice from slack:

In POCS we use the threading module in the Python Standard Library.

In that module there's Thread, Timer, Event and Lock. Those are the bits you'll need.

https://docs.python.org/3/library/threading.html

For the non-blocking moves the basic idea is that you write a function that contains the while loop that checks when it's time to stop the move, you create a Thread and pass it that function, start the move, start the Thread, then return. The Thread will run in the background and stop the move then at target. (edited)

You can use Events to do simple communication between threads, e.g. you can pass one to the dome movement thread and use it to stop the move early if the abort function is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant