def obstacle(self): sensordata = readsensor() self.clear={'F1':False,'F2':False,'F3':False,'L1':False,'L2':False,'R1':False,'R2':False} if sensordata['F'] > 30 : self.clear['F1'] = True if sensordata['F'] > 45 : self.clear['F2'] = True if sensordata['F'] > 60 : self.clear['F3'] = True if sensordata['LF'] > 35 : self.clear['L1'] = True if sensordata['LF'] > 45 : self.clear['L2'] = True if sensordata['RF'] > 35 : self.clear['R1'] = True if sensordata['RF'] > 45 : self.clear['R2'] = True return (self.clear)
along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import sys, time, os import serial import RPi.GPIO as GPIO #import SerialOut import config from espeak import espeak #from lidar_lite import Lidar_Lite from AnaSensorData import readsensor import PServo ##lidar = Lidar_Lite() anasensor = readsensor() Maestro = Controller() a = 0 s = 0 l = 0 r = 0 start_time = time.time() delay = 0.1 # set rest time between command sends checksum = 0 GPIO.setmode(GPIO.BCM) #sensors = ('IR1','IR2','IR3','US') Maestro.setTarget (5,700) def startup(): # SerialOut.reset()