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
11
rally.py
11
rally.py
|
|
@ -58,12 +58,12 @@ while sonar.distance < 20:
|
||||||
break
|
break
|
||||||
|
|
||||||
print(">>>>> Starting movement!!!")
|
print(">>>>> Starting movement!!!")
|
||||||
mot_right.throttle = 0.5
|
mot_right.throttle = 1
|
||||||
mot_left.throttle = 0.5
|
mot_left.throttle = - 1
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# Find the motor revolutions
|
# 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
|
revright = enc_right.position / COUNTS_PER_REV
|
||||||
|
|
||||||
distleft = revleft * circumference
|
distleft = revleft * circumference
|
||||||
|
|
@ -78,3 +78,8 @@ while True:
|
||||||
mot_left.throttle = 0
|
mot_left.throttle = 0
|
||||||
mot_right.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