Skip to content
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

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

martha-johnston
Copy link
Contributor

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 be motor.Motor, it would have to be specifically gpio.Motor because the interface doesn't implement all the API functions. And imo gpio.Motor in DoCommand is no better than single.Encoder in setup.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.

@martha-johnston martha-johnston requested review from a team and JohnN193 and removed request for a team November 12, 2024 21:59
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Nov 12, 2024
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.
Copy link
Contributor Author

@martha-johnston martha-johnston Nov 12, 2024

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)
Copy link
Contributor Author

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

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 13, 2024
Copy link
Member

@JohnN193 JohnN193 left a 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

@martha-johnston martha-johnston merged commit b460122 into viamrobotics:main Nov 13, 2024
16 checks passed
hexbabe pushed a commit to hexbabe/sean-rdk that referenced this pull request Nov 14, 2024
hexbabe pushed a commit to hexbabe/sean-rdk that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants