Skip to content

Commit df0b372

Browse files
authored
droid-commander: Drop limit adjustments. (#72)
Changing the limits should no longer be required just to change the acceleration.
1 parent a9f01d9 commit df0b372

File tree

1 file changed

+1
-10
lines changed
  • sets/boost/droid-commander/r2-d2

1 file changed

+1
-10
lines changed

sets/boost/droid-commander/r2-d2/main.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pybricks.hubs import MoveHub
22
from pybricks.pupdevices import ColorDistanceSensor, Motor
3-
from pybricks.parameters import Port, Stop, Color, Direction
3+
from pybricks.parameters import Port, Direction
44
from pybricks.robotics import DriveBase
55
from pybricks.tools import wait
66

@@ -26,11 +26,6 @@
2626
# The gears are configured for the head.
2727
actuator = 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

Comments
 (0)