11from pybricks .hubs import MoveHub
22from pybricks .pupdevices import ColorDistanceSensor , Motor
3- from pybricks .parameters import Port , Stop , Color , Direction
3+ from pybricks .parameters import Port , Direction
44from pybricks .robotics import DriveBase
55from pybricks .tools import wait
66
2626# The gears are configured for the head.
2727actuator = Motor (Port .D , Direction .COUNTERCLOCKWISE , gears = (24 , 40 ))
2828
29-
30- # Work around <https://github.com/pybricks/support/issues/323>.
31- drive .distance_control .limits (duty = 100 )
32-
33-
3429#################################
3530# Define some helpful functions #
3631#################################
@@ -52,11 +47,9 @@ def stand_up():
5247
5348 # Save the old settings to restore later.
5449 settings = drive .settings ()
55- limits = drive .distance_control .limits ()
5650
5751 # Set speed and acceleration high so that
5852 # we can make R2-D2 jerk forward or backward.
59- drive .distance_control .limits (1000 , 5000 )
6053 drive .settings (1000 , 5000 )
6154
6255 # Drive quickly and stop to make R2-D2 change position.
@@ -65,7 +58,6 @@ def stand_up():
6558
6659 # Restore the old settings.
6760 drive .settings (* settings )
68- drive .distance_control .limits (* limits )
6961
7062 drive .straight (- 40 )
7163 wait (500 )
@@ -116,7 +108,6 @@ def stare_and_turn(angle):
116108# If you want to adjust the settings, it can be useful
117109# to print the defaults so you know where to start.
118110# print('default drive settings', drive.settings())
119- # print('default drive limits', drive.distance_control.limits())
120111
121112
122113################
0 commit comments