Skip to content

Commit

Permalink
Fix turn X degrees block, as an incentive to upgrade to 1.0.2 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
CleoQc authored and Dexter Industries committed Jul 24, 2017
1 parent a9db453 commit dd5cb23
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Software/Python/easygopigo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def forward(self):
self.set_motor_dps(self.MOTOR_LEFT + self.MOTOR_RIGHT,
self.get_speed())

def drive_cm(self, dist, blocking=False):
def drive_cm(self, dist, blocking=True):
# dist is in cm
# if dist is negative, this becomes a backward move

Expand All @@ -130,10 +130,10 @@ def drive_cm(self, dist, blocking=False):
StartPositionRight + WheelTurnDegrees) is False:
time.sleep(0.1)

def drive_inches(self, dist, blocking=False):
def drive_inches(self, dist, blocking=True):
self.drive_cm(dist * 2.54, blocking)

def drive_degrees(self, degrees, blocking=False):
def drive_degrees(self, degrees, blocking=True):
# these degrees are meant to be wheel rotations.
# 360 degrees would be a full wheel rotation
# not the same as turn_degrees() which is a robot rotation
Expand Down Expand Up @@ -256,7 +256,7 @@ def close_eyes(self):
self.close_left_eye()
self.close_right_eye()

def turn_degrees(self, degrees):
def turn_degrees(self, degrees, blocking=True):
# this is the method to use if you want the robot to turn 90 degrees
# or any other amount. This method is based on robot orientation
# and not wheel rotation
Expand All @@ -276,7 +276,12 @@ def turn_degrees(self, degrees):
(StartPositionLeft + WheelTurnDegrees))
self.set_motor_position(self.MOTOR_RIGHT,
(StartPositionRight - WheelTurnDegrees))


if blocking:
while self.target_reached(
StartPositionLeft + WheelTurnDegrees,
StartPositionRight - WheelTurnDegrees) is False:
time.sleep(0.1)

# the following functions may be redundant
my_gpg = EasyGoPiGo3()
Expand Down

0 comments on commit dd5cb23

Please sign in to comment.