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] Stall flag is always raised for position-based drive commands. #767

Closed
laurensvalk opened this issue Oct 28, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working topic: motors Issues involving motors

Comments

@laurensvalk
Copy link
Member

Describe the bug
The stall flag is always raised when doing position-based Drive Base commands.

While we almost never use the stall flag for this use case, it still shouldn't be set.

To reproduce

from pybricks.pupdevices import Motor
from pybricks.parameters import Port, Direction
from pybricks.robotics import DriveBase
from pybricks.tools import wait

left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.B)
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=56, axle_track=112)

# Drive forward without blocking.
drive_base.straight(500, wait=False)

# Wait until done.
while not drive_base.distance_control.done() or not drive_base.heading_control.done():
    wait(10)
    # Check for stall.
    if drive_base.distance_control.stalled() or drive_base.heading_control.stalled():
        # Shouldn't get here but we do!
        break

drive_base.stop()

Expected behavior
Drive without raising the stall flag.

@laurensvalk laurensvalk added bug Something isn't working topic: motors Issues involving motors labels Oct 28, 2022
@laurensvalk laurensvalk self-assigned this Oct 28, 2022
@laurensvalk
Copy link
Member Author

When we fix this, we should add the following flags to the data logger to see this sort of thing more quickly:

  • Stalled
  • Done/busy
  • duty/coast mode active

@laurensvalk
Copy link
Member Author

we should add the following flags to the data logger

Done via pybricks/pybricks-micropython@4f5a0ee and pybricks/pybricks-micropython@662c002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic: motors Issues involving motors
Projects
None yet
Development

No branches or pull requests

1 participant