diff --git a/PiFaceFast.py b/PiFaceFast.py index c7c47e92e6522d8cddb1f40e5c10d2f24f6dcd16..1cee24460457f90f3bd4fb3dc60352812c21e613 100755 --- a/PiFaceFast.py +++ b/PiFaceFast.py @@ -94,7 +94,8 @@ Ymin = 420 ## Initial Head position Xcoor = 511 -Ycoor = 450 +Ycoor = int(Ymin + float(config["headYPosition"]) / 100 * (Ymax - Ymin)) +print "Calculated initial head position: XCoor " + str(Xcoor) + ", YCoor " + str(Ycoor) Facedet = 0 ## Time head wait turned @@ -140,6 +141,8 @@ except KeyError: controller.SetServo(1, Xcoor, int(config["servoSpeed"])) controller.SetServo(2, Ycoor, int(config["servoSpeed"])) +print "Positioning head: XCoor " + str(Xcoor) + ", YCoor " + str(Ycoor) + time.sleep(1) #controller.SetPid(1, 26, 12, 16) controller.SetPid(1, 26, 2, 16) @@ -180,13 +183,14 @@ def ServoHome(): global Xcoor, Ycoor, touch_tm Xcoor = 511 - Ycoor = 450 - + Ycoor = int(Ymin + float(config["headYPosition"]) / 100 * (Ymax - Ymin)) controller.SetServo(1, Xcoor, int(config["servoSpeed"])) time.sleep(0.1) controller.SetServo(2, Ycoor, int(config["servoSpeed"])) touch_tm = time.time() + print "Repositioning head: XCoor " + str(Xcoor) + ", YCoor " + str(Ycoor) + return @@ -277,7 +281,6 @@ def HotwordListenedEvent(): global HotwordListened HotwordListened = True - StartHotwordListener() print" Face tracking running."