-
Notifications
You must be signed in to change notification settings - Fork 110
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-9037: Add AttachDirectionalAwareness to DoCommand #4552
Conversation
em.logger.Warnf("setting ramp rate to default value of 0.05 instead of %v", em.rampRate) | ||
em.rampRate = 0.05 // Use a conservative value by default. |
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.
this I just happened to see when I was testing and before it would always log "setting ramp rate to default value of 0.05 instead of 0.05"
so I changed it
@@ -213,7 +220,7 @@ func createNewMotor( | |||
return nil, err | |||
} | |||
default: | |||
m, err = setupMotorWithControls(ctx, basic, e, cfg, logger) | |||
m, err = setupMotorWithControls(ctx, m, e, cfg, logger) |
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.
all the changes in controlled motor come from this change. I wanted to remove the basic casting and try to keep everything at the motor interface level
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, we spoke offline and it seemed like this was worth doing because it might let motors defined in other languages use single encoder
I'm not sure I think this is any better than the way it was before. I considered the method Olivia suggested by converting the
DoCommand
interface into a motor object, but it couldn't bemotor.Motor
, it would have to be specificallygpio.Motor
because the interface doesn't implement all the API functions. And imogpio.Motor
inDoCommand
is no better thansingle.Encoder
insetup.go
as it was before. Open to ideas tho, because I don't love this implementation.Basically, my goal here was to avoid casting to any specific model types of either motor or encoder. I did have to cast to the
DirectionAware
type, but that seemed better since it's specific to single encoder.