Exemple #1
0
import numpy as np
import sys, select
import cv2
import time
import os
import RPi.GPIO as GPIO
from minisumo_motorcontrol2 import Motors_Class
from lineSense2 import lineSensor_Class
from shortrangemethod import shortrange_Class
from minisumo_motorcontrol3 import Motors_Class2
#anything less than 15 switch to short range sensors
motor1 = Motors_Class()
lineSensors = lineSensor_Class()
shortrange = shortrange_Class()
motor2 = Motors_Class2()
cap = cv2.VideoCapture(0)
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25


class longrange_Class:
    def __init__(self):

        GPIO.setmode(GPIO.BCM)
        global SPICLK
        global SPIMISO
        global SPIMOSI
        global SPICS
Exemple #2
0
import time
from lineSense2 import lineSensor_Class 
from minisumo_motorcontrol2 import Motors_Class
from longrangemethod import longrange_Class
from shortrangemethod import shortrange_Class
lineSensors= lineSensor_Class()
motors= Motors_Class()
longrange= longrange_Class()
shortrange= shortrange_Class()

motors.motor_move("w",4)

while(True):
	if(1==lineSensors.check1()):
		motors.motor_move("x",0)
		time.sleep(1)
		motors.motor_move("s",4)
	elif(1==lineSensors.check2()):
		motors.motor_move('x',0)
		time.sleep(1)
		motors.motor_move('s',4)
	elif(1==lineSensors.check3()):
		motors.motor_move('x',0)
		time.sleep(1)
		motors.motor_move('s',4)
	elif(1==lineSensors.check4()):
		motors.motor_move('x',0)
		time.sleep(1)
		motors.motor_move('s',4)
	elif(shortrange.rngsens()>3):
		motors.motor_move('x',0)