Skip to content

Motors keeps momentum after it is stopped #197

@williamcorsel

Description

@williamcorsel

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions