Added wait_until_not_moving()#327
Merged
ddemidov merged 2 commits intoev3dev:developfrom Jun 23, 2017
dwalton76:develop-wait-until-not-moving
Merged
Added wait_until_not_moving()#327ddemidov merged 2 commits intoev3dev:developfrom dwalton76:develop-wait-until-not-moving
ddemidov merged 2 commits intoev3dev:developfrom
dwalton76:develop-wait-until-not-moving
Conversation
WasabiFan
reviewed
Jun 23, 2017
Member
WasabiFan
left a comment
There was a problem hiding this comment.
I like the thinking here. Have you used this enough to be confident that it doesn't end prematurely in various motor conditions?
| if cond(self.state): | ||
| return True | ||
|
|
||
| def wait_until_not_moving(self, timeout=None): |
Member
There was a problem hiding this comment.
You should add a documentation comment here so that it shows up on the docs site.
Collaborator
Author
There was a problem hiding this comment.
I used it when solving a 5x5x5 cube which was about 9 minutes of off/on movement of three large motors and a medium motor. If it had exited early it would have caused the cube to jam up but it was smooth sailing so I think it is good to go.
I'll add a docstring to it in the morning.
ddemidov
approved these changes
Jun 23, 2017
Member
|
Thanks! |
WasabiFan
added a commit
that referenced
this pull request
Oct 8, 2017
dwalton76
pushed a commit
that referenced
this pull request
Nov 14, 2017
* Remove "connected" attribute Fixes #327 * Fix things * I'm terrible at both staging and committing everything * Update error name and text * Fix things * Revert GyroBalancer changes * Strip exception context when device isn't connected
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.
If you call
wait_while('running', timeout=1000)there are times when the state reads bothrunningandstalledso you end up waiting for your timeout to expire even though the motor has stalled. The added function allows you to wait until the motor has stopped, either due to a stall or because it is no longer 'running'.This helps my rubiks cube robot run a good bit faster as I don't end up waiting on so many timeouts in the wait_while calls.