Changed the throttle and fixed the left motors spin
This commit is contained in:
parent
abe591f3b8
commit
4ecbb9ef90
1 changed files with 9 additions and 4 deletions
13
rally.py
13
rally.py
|
|
@ -58,12 +58,12 @@ while sonar.distance < 20:
|
|||
break
|
||||
|
||||
print(">>>>> Starting movement!!!")
|
||||
mot_right.throttle = 0.5
|
||||
mot_left.throttle = 0.5
|
||||
mot_right.throttle = 1
|
||||
mot_left.throttle = - 1
|
||||
|
||||
while True:
|
||||
# Find the motor revolutions
|
||||
revleft = enc_left.position / COUNTS_PER_REV
|
||||
revleft = - enc_left.position / COUNTS_PER_REV
|
||||
revright = enc_right.position / COUNTS_PER_REV
|
||||
|
||||
distleft = revleft * circumference
|
||||
|
|
@ -77,4 +77,9 @@ while True:
|
|||
print("Target reached!!!")
|
||||
mot_left.throttle = 0
|
||||
mot_right.throttle = 0
|
||||
break
|
||||
break
|
||||
|
||||
mot_right.throttle = 1
|
||||
mot_left.throttle = - 1
|
||||
|
||||
time.sleep(0.05)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue