Editing PIDtest
authorJordi <jordiguerrero@gmail.com>
Sat, 13 Feb 2016 17:30:14 +0000 (17:30 +0000)
committerJordi <jordiguerrero@gmail.com>
Sat, 13 Feb 2016 17:30:14 +0000 (17:30 +0000)
PID_test.py

index 7d5a139..d31bdec 100644 (file)
@@ -11,6 +11,7 @@ from Fresonbot import Fresonbot
 #global distance
 robot1 = Fresonbot() # Using Fresonbot class
 
+# Use it variable to describe your trajectory ([x1,y2,x2,y2,....,xn,yn])
 it = iter([400,0,400,400,0,400,200,200,0,0,400,0,400,400,0,400,200,200,0,0])
 #it = iter([400,0,400,400,0,400,200,200,0,0])
 #it = iter([200,0,200,200,0,200,0,0])
@@ -84,21 +85,20 @@ def goTarget():
         time.sleep(0.02)
     return
 
+#Initializing variables
 IncTicksLeft = 0
 IncTicksRight = 0
-
 distanceLeft = 0
 distanceRight = 0
-
 lastHeadingError = 0
 headingErrorIntegral = 0
 velocityTranslational = 50
 sensitivityLimit = 5
 u = 0
-
 VelLeft = 50
 VelRight = 50
 
+#Main program
 robot1.getTicks();
 
 start_dt = time.time() * 1000
@@ -112,6 +112,7 @@ robot1.getPosition();
 for xT, yT in zip(it, it):
     xTarget = xT
     yTarget = yT
+
     goTarget();
 
 robot1.stop();