Program crash when using motor.reset_angle() #463
-
If I call motor.reset_angle() when the motor has not yet been used it doesn't crash but when the motor has been used and I want to reset its angle it will crash with It happens when I call it as part of a function or directly in the program code. This is using mindstorms ev3 with pybricks v2. I have tried calling motor.stop() before calling motor.reset_angle() but I get the same error now in Any ideas about how I can fix this crash? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You need to stop the motor before resetting the angle. |
Beta Was this translation helpful? Give feedback.
-
An angle argument is required, such as If you don't give an argument, it tries to reset it to the absolute value. But EV3 motors only have incremental encoders. This gives an "invalid operation error", which codes to Is the motor being used by something else like a |
Beta Was this translation helpful? Give feedback.
An angle argument is required, such as
motor.reset_angle(0)
.If you don't give an argument, it tries to reset it to the absolute value. But EV3 motors only have incremental encoders. This gives an "invalid operation error", which codes to
EPERM
in EV3 MicroPython 2.0.Is the motor being used by something else like a
DriveBase
? Then you can get this error as well. Feel free to share your whole script if you'd like us to have a closer look.