-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Open
Copy link
Labels
topic: controlIssues involving control system algorithmsIssues involving control system algorithms
Description
Describe the bug
If I understand the docs right, I should be able to control the distance PID's tolerances, but I don't seem to be able to.
To reproduce
Steps to reproduce the behavior:
- Assemble Prime Hub with 2 small motors in A and B, no wheels
- Python code:
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Direction, Port
from pybricks.robotics import DriveBase
from pybricks.tools import wait
hub = PrimeHub()
right_motor = Motor(Port.B, positive_direction=Direction.CLOCKWISE)
left_motor = Motor(Port.A, positive_direction=Direction.COUNTERCLOCKWISE)
drive_base = DriveBase(left_motor, right_motor, 57.2, 96.1)
drive_base.reset(distance=0)
#drive_base.distance_control.target_tolerances(position=1)
drive_base.straight(1000)
while True:
print(f"Drove: {drive_base.distance()}")
wait(500)Expected behavior
When I run this with no wheels it prints 1003 in 10/10 runs.
(With wheels and a real robot actually driving, I get random numbers between 999 and 1004.
I expected that uncommenting the commented line would get me consistent numbers at least in the 999-1001 range. I also tried position=0.9, but any number between 0 and 1 seems to hang without ever printing anything. At no point did I ever observe the wheel spinning backwards at the end of the maneuver to correct for the overshoot.
Metadata
Metadata
Assignees
Labels
topic: controlIssues involving control system algorithmsIssues involving control system algorithms