Beginning Artificial Intelligence with the Raspberry Pi by Donald J. Norris

Beginning Artificial Intelligence with the Raspberry Pi by Donald J. Norris

Author:Donald J. Norris
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


# modified robotAction module

def robotAction(select):

global pwmL, pwmR, pwrThreshold, fitA, fitB, fitC

if select == 0:

# stop immediately

exit()

elif select == 1:

pwmL.ChangeDutyCycle(3.6)

pwmR.ChangeDutyCycle(2.2)

if calcPower() > pwrThreshold:

fitA = fitA - 0.5

else:

fitA = fitA + 0.5

elif select == 2:

pwmL.ChangeDutyCycle(2.2)

pwmR.ChangeDutyCycle(2.8)

if calcPower() > pwrThreshold:

fitB = fitB - 0.5

else:

fitB = fitB + 0.5

elif select == 3:

pwmL.ChangeDutyCycle(2.8)

pwmR.ChangeDutyCycle(2.2)

if calcPower() > pwrThreshold:

fitC = fitC - 0.5

else:

fitC = fitC + 0.5



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.