From 4389bbfeae982a186b112a33a0e3b434208a34b9 Mon Sep 17 00:00:00 2001 From: Serge Date: Wed, 19 Jun 2019 11:00:57 +0100 Subject: [PATCH] Working cone detection with CANbus. It's awesome. --- zedMain.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zedMain.py b/zedMain.py index 59162bd..e41645c 100644 --- a/zedMain.py +++ b/zedMain.py @@ -19,9 +19,9 @@ global startFrom startFrom = 270 global steeringFactor -steeringFactor = 30 +steeringFactor = 10 global carVelocity -carVelocity = 60 +carVelocity = 70 @@ -38,6 +38,8 @@ def issueCommands(steering, velocity, exit, lastCommandTime=0.025): if exit: #can exit protocol print("Initiating CAN exit.") + issueCommands.car.set_steering_velocity(0,0) + time.sleep(0.5) issueCommands.car.exitCAN() #runs until we exit gracefully def calculateCenter(target): @@ -45,7 +47,7 @@ def calculateCenter(target): newCom = target - int(width/2) #offset from center of image if newCom != -int(width/2): #when we have a correct reading - final = calculateCenter.pastCom + (newCom-calculateCenter.pastCom) / 2 + final = calculateCenter.pastCom + (newCom-calculateCenter.pastCom) / 20 calculateCenter.pastCom = final return round(final)