-
Notifications
You must be signed in to change notification settings - Fork 0
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
update REVThroughBoreDutyCycleEncoder so it gets enough readings to initialize properly #94
base: main
Are you sure you want to change the base?
Conversation
…r, so isConnected() returns when it's had enough readings to initialize
@@ -8,6 +8,7 @@ public class REVThroughBoreDutyCycleEncoder extends DutyCycleEncoder implements | |||
public REVThroughBoreDutyCycleEncoder(int channel) { | |||
super(channel); | |||
setDutyCycleRange(1. / 1025., 1024. / 1025.); | |||
setConnectedFrequencyThreshold(976 /* 975.6 on spec sheet*/); |
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.
public boolean isConnected() {
return getFrequency() > m_frequencyThreshold;
}
so we might want to be careful about rounding up the threshold (especially since isConnected uses strict greater-than)
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.
ah, I see. at 976, it'll never "spin up".. nice catch. changing to 975.
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.
please test this a significant number of times on-robot. i would like to make sure that it regularly reaches 976 Hz (or whether we should set the threshold frequency at 974 so that it will allow 975 Hz as well)
…d` will get a chance to report that it's connected.
thank you! good catch on the strict >. changed threshold to 975. PTAL? |
Description
ConnectedFrequencyThreshold
forREVThroughBoreDutyCycleEncoder
to the right value. this allowsisConnected
to return true only after the encoder has enough readings to initialize properly.Shoulder
just to useisConnected
vs its own initialization timerHow Has This Been Tested?
Needs testing on RevB