-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Feature] Make motor rotation sensor reset optional #389
Comments
This allows the encoder offset to be preserved between consecutive scripts. It may also be useful to preserve values for system uses like port view. pybricks/support#389
This adds a reset_angle=True keyword argument to the Motor class initialization. Setting it to false allows the encoder offset to be preserved between consecutive scripts. This way, you'd need to reset robot mechanisms only once instead of every time you run a program. pybricks/support#389
This adds a `reset_angle=True` keyword argument to the Motor class initializer. Setting it to false allows the encoder angle to be preserved between consecutive scripts. This way, you'd need to reset robot mechanisms only once instead of every time you run a program. pybricks/support#389
I've been using this in practice for some time, and it's really useful. I think it's worth committing. A second potential benefit is that you can diagnose problems in a new REPL or something like port view, if we ever have that feature. In the long run, we should be able to cut the implementation size a bit by not having to pass the argument all the way down, but we can look at this when we overhaul the way we deal with ports in general. |
Already implemented via pybricks/pybricks-micropython@4d6d172, so closing. |
Is your feature request related to a problem? Please describe.
When building robots with gears, the absolute angle feature cannot really be used. Instead, you usually have to run some initialization routine to reset the mechanism, to make your own "absolute" zero point.
It would be nice if you needed to run this only once after boot, instead of every time a program starts.
Describe the solution you'd like
When you initialize a motor, we implicitly call
reset_angle()
, so that it resets to the angle of the absolute marker. We could make this optional. Then the angle offset would be unchanged between programs.Proposed API: Add a
reset_angle
keyword argument to theMotor
class init, and let it default toTrue
so it is fully backwards compatible.The text was updated successfully, but these errors were encountered: