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

[Bug] reset_angle() without arguments during hold gives unexpected movement #352

Closed
laurensvalk opened this issue May 28, 2021 · 1 comment
Assignees
Labels
bug Something isn't working software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: motors Issues involving motors

Comments

@laurensvalk
Copy link
Member

Describe the bug
When used without arguments, reset_angle() should reset the angle to the absolute marker.

But in some cases while holding, it jumps to zero.

To reproduce

from pybricks.pupdevices import Motor
from pybricks.parameters import Port
from pybricks.tools import wait

motor = Motor(Port.B)

motor.run_target(500, 90)
motor.reset_angle()
wait(1000)

Things do seem to work correctly when giving an angle argument or when using a different stop mode.

Expected behavior
With no arguments given, the angle should do this for positive angles:
motor.reset_angle(motor.angle() % 360)

@laurensvalk laurensvalk added bug Something isn't working topic: motors Issues involving motors software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) labels May 28, 2021
@laurensvalk laurensvalk self-assigned this May 28, 2021
@laurensvalk
Copy link
Member Author

This was reported by Tammo, who does not have a GitHub account (yet 😉).

laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue May 30, 2021
This adds a test that asserts that a stationary motor does not begin moving when the angle is reset.

Reproduces: pybricks/support#352
laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue May 30, 2021
This avoids a mismatch between the estimated and measured angle.

We are doing this in a few places now, so also move it to a function.

Fixes pybricks/support#352.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: motors Issues involving motors
Projects
None yet
Development

No branches or pull requests

1 participant