@@ -106,7 +106,7 @@ def forward(self):
106
106
self .set_motor_dps (self .MOTOR_LEFT + self .MOTOR_RIGHT ,
107
107
self .get_speed ())
108
108
109
- def drive_cm (self , dist , blocking = False ):
109
+ def drive_cm (self , dist , blocking = True ):
110
110
# dist is in cm
111
111
# if dist is negative, this becomes a backward move
112
112
@@ -130,10 +130,10 @@ def drive_cm(self, dist, blocking=False):
130
130
StartPositionRight + WheelTurnDegrees ) is False :
131
131
time .sleep (0.1 )
132
132
133
- def drive_inches (self , dist , blocking = False ):
133
+ def drive_inches (self , dist , blocking = True ):
134
134
self .drive_cm (dist * 2.54 , blocking )
135
135
136
- def drive_degrees (self , degrees , blocking = False ):
136
+ def drive_degrees (self , degrees , blocking = True ):
137
137
# these degrees are meant to be wheel rotations.
138
138
# 360 degrees would be a full wheel rotation
139
139
# not the same as turn_degrees() which is a robot rotation
@@ -256,7 +256,7 @@ def close_eyes(self):
256
256
self .close_left_eye ()
257
257
self .close_right_eye ()
258
258
259
- def turn_degrees (self , degrees ):
259
+ def turn_degrees (self , degrees , blocking = True ):
260
260
# this is the method to use if you want the robot to turn 90 degrees
261
261
# or any other amount. This method is based on robot orientation
262
262
# and not wheel rotation
@@ -276,6 +276,12 @@ def turn_degrees(self, degrees):
276
276
(StartPositionLeft + WheelTurnDegrees ))
277
277
self .set_motor_position (self .MOTOR_RIGHT ,
278
278
(StartPositionRight - WheelTurnDegrees ))
279
+
280
+ if blocking :
281
+ while self .target_reached (
282
+ StartPositionLeft + WheelTurnDegrees ,
283
+ StartPositionRight - WheelTurnDegrees ) is False :
284
+ time .sleep (0.1 )
279
285
280
286
281
287
# the following functions may be redundant
0 commit comments