-
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-2478: Update encoder driver methods #2161
RSDK-2478: Update encoder driver methods #2161
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
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.
LGTM, have you tested the changes on hardware?
This PR is not ready yet I will update with a comment when it is. Realized I forgot to add a function. Sorry that you already reviewed @npmenard, but yes I did test on hardware and will retest when I'm actually done! |
Should be ready now but won't pass the checks until api changes are merged |
sorry, I clicked approve on the wrong PR, I'm still reviewing |
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.
Nice job, just a couple requests.
} | ||
) | ||
|
||
type mock struct { |
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-minor] I think we can use inject.Encoder for this purpose; setupInjectRobot
can return a state object with these fields that gets mutated by the injected methods via closure. Then you can check the values on the state in the tests. Helps with codebase consistency if everything is using inject, but if it turns out to be too much trouble don't force it
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.
leaving this as is for now
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 really important change is in motor_encoder.go
, the rest are optional and I agree with Gautham's comment about trying our best to not pass in protobuf structs.
@gvaradarajan @randhid I think I covered everything, but it resulted in a lot more changes so let me know if anything else comes up! |
} | ||
if !props[encoder.TicksCountSupported] { | ||
return nil, | ||
errors.New("cannot create an encoded motor without an encoder that has propery TicksCountSupported") |
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.
[nit] typo + maybe add
errors.New("cannot create an encoded motor without an encoder that has propery TicksCountSupported") | |
errors.New("encoder type is %v need an encoder that supports Ticks for an encoded motor", props) |
This covers RSDK-2477 (Add client and server files), RSDK-2478 (update driver methods), and RSDK-2479 (add encoder to registry), to make separate driver packages for single, incremental, and AMS encoders.