Skip to content

Commit

Permalink
Merge pull request #81 from CleoQc/DexterOS
Browse files Browse the repository at this point in the history
fix turn block
  • Loading branch information
CleoQc authored Jul 28, 2017
2 parents 95eec85 + f86a7b9 commit 6c31951
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 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,6 +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
Expand Down

0 comments on commit 6c31951

Please sign in to comment.