-
Notifications
You must be signed in to change notification settings - Fork 113
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
[RSDK-2226] audit GPIO servo code #2283
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
a202740
lowercase S in microsecond suffix
penguinland 728c791
tweak comments
penguinland 75f5537
add explanatory comment
penguinland 06aec2f
more tweaks to text
penguinland fdebaf0
update test to match new error message
penguinland c5c0785
rename min->minDeg and max->maxDeg
penguinland ad52574
point out the frequency we're checking in the error
penguinland 0fc4520
add comment
penguinland ac2b683
tweak: don't create variables until you're going to use them, helps w…
penguinland 29edfe0
scaffolding: remove this TODO later
penguinland f37119f
remove obvious comments
penguinland 678ce5d
comment tweak
penguinland c8d10fe
Rename scale -> degsPerUs or usPerDeg
penguinland 40dfbd5
add comment
penguinland 9f3da1e
don't multiply by 1
penguinland fb10e97
fix comment
penguinland 233d3b4
error messages should be unique, to pinpoint where they came from
penguinland 16bc42b
Add comment
penguinland 3302de7
REVERTME: add debug information
penguinland 463019f
clean up from rebase
penguinland 6549786
initialize the servo's frequency
penguinland f6b2aa9
remove debugging info, name magic constant
penguinland 8207659
try fixing bad rebase again. How did this get through last time?
penguinland 0240a7b
Remove redundant if statement
penguinland f477809
Move min/max time calculations higher, in anticipation of using them …
penguinland 61bd967
don't set the frequency so high that you can't move to the longest po…
penguinland 8b65489
pr feedback
penguinland 5fb5c9b
pr feedback: the deadband width is smaller than minUs
penguinland d5a9c65
make lint
penguinland 0a48adb
get tests to pass again
penguinland 040ad5b
make the maximum deadband width 50 microseconds
penguinland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool :) does the calculated frequency gets floored in this case? also why do minUs+maxUs if at most we should turn on the PWM for maxUs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I set the GPIO pin to high (duty cycle is 100%), it cuts power to the motor entirely. I infer that the servo needs some amount of time with the PWM signal low, so it can be confident it knows how long it was high. What's the minimum time it can be low? I dunno; probably the same as the minimum it can be high, so the period should be at least minUs+maxUs. but I just made all that up, because I don't actually know how servos work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The amount of time the signal needs to spend low is the "dead band width," and the motors I've seen so far have it in the 1-10 microsecond range. My defaulting to 500 microseconds is super overkill. I'll change this to go faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense i'll defer to you to select the best value but would suggest 100us to be on the safe side :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100 seems exceptionally slow, but I bumped it up to 50. You're right that 10 was probably too fast for a global maximum.