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

Motors keeps momentum after it is stopped #197

Open
williamcorsel opened this issue Apr 7, 2023 · 3 comments
Open

Motors keeps momentum after it is stopped #197

williamcorsel opened this issue Apr 7, 2023 · 3 comments

Comments

@williamcorsel
Copy link

I noticed that motors seem to keep some momentum after they are stopped and started again when using the current main branch. There also seems to be quite a long spin-up time in this case.

An example script to simulate the behaviour:

from buildhat import Motor
import time

speed = 50
delay = 4
delay_stop = 2

motor = Motor('A')

while True:
    print(f"Start {speed}")
    motor.start(speed)
    time.sleep(delay)

    print("Stop")
    motor.stop()
    time.sleep(delay_stop)

    print(f"Start {-speed}")
    motor.start(-speed)
    time.sleep(delay)

    print("Stop")
    motor.stop()
    time.sleep(delay_stop)

Motor behaviour:

buildhat_motor_stop.mp4

Are there some settings I can tweak to improve the responsiveness in this case? I noticed that using motor.set_speed_unit_rpm(True) already reduces the momentum issue somewhat (and improves the spin-up time significantly).

@chrisruk
Copy link
Contributor

Thanks for reporting this and especially for the video, that's very helpful!

@danielr
Copy link

danielr commented Jan 4, 2024

I can confirm the exact same behavior, which makes controlling a robot almost impossible. 😟 Did you find any solution or workaround?

@williamcorsel
Copy link
Author

Sadly no. You could try and use the .pwm function directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants