예제 #1
0
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.nn_treads = [0, 0]
        self.currentImage = None
        self.peripherals = {'lights': False, 'stealth': False, \
                            'detect': True, 'camera': 0}

        self.action_choice = 1
        self.action_labels = ['forward', 'backward', 'left', 'right']
        self.action_vectors_motor = [[1, 1], [-1, -1], [-1, 1], [1, -1]]
        self.action_vectors_neuro = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]

        self.n1 = 32 * 24 * 3
        self.n2 = 2
        self.n3 = 4

        self.w1 = 0.00001 * np.random.random((self.n1 + 1, self.n2))
        self.w2 = 0.01 * np.random.random((self.n2 + 1, self.n3))

        self.dw1 = np.zeros(self.w1.shape)
        self.dw2 = np.zeros(self.w2.shape)

        self.L1 = 0.000001
        self.L2 = 0.001
        self.M = 0.9
    def __init__(self):

        # Set up basics
        Rover20.__init__(self)
        self.wname = 'Rover 2.0: Hit ESC to quit'
        self.quit = False

        # Set up controller using PyGame
        pygame.display.init()
        pygame.joystick.init()
        self.controller = pygame.joystick.Joystick(0)
        self.controller.init()

         # Defaults on startup: lights off, ordinary camera
        self.lightsAreOn = False
        self.stealthIsOn = False

        # Tracks button-press times for debouncing
        self.lastButtonTime = 0

        # Try to create OpenCV named window
        try:
            if cv:
                cv.NamedWindow(self.wname, cv.CV_WINDOW_AUTOSIZE )
            else:
                pass
        except:
            pass

        self.pcmfile = open('rover20.pcm', 'w')
예제 #3
0
	def __init__(self):
		Rover20.__init__(self)

		self.quit = False

		self.lightsAreOn = False
		self.stealthIsOn = False

		# each integer may be -1, 0, or 1
		self.treads = [0,0]

		# window must be open and in focus for pygame to take input
		self.windowSize = [640, 480]

		# used to only refresh the video and not the unused pixels
		self.imageRect = (160,120,320,240)

		# Live video frames per second
		self.fps = 48

		# stores what the camera currently sees
		self.currentImage = None

		self.displayCaption = "Keyboard Rover 2.0"

		pygame.init()
		pygame.display.init()
		pygame.display.set_caption(self.displayCaption)

		self.screen = pygame.display.set_mode(self.windowSize)
		self.clock = pygame.time.Clock()
예제 #4
0
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.nn_treads = [0, 0]
        self.currentImage = None
        self.peripherals = {'lights': False, 'stealth': False,
                            'detect': True, 'camera': 0}

        self.action_choice = 1
        self.action_labels = ['forward', 'backward', 'left', 'right']
        self.action_vectors_motor = [[1, 1], [-1, -1], [-1, 1], [1, -1]]
        self.action_vectors_neuro = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]

        self.n1 = 32 * 24 * 3
        # Number of neurons on the network
        self.number_of_neurons = 5
        # Number of actions available, like forward, back , left and right.
        self.number_of_actions = 4

        self.network_weight_one = 0.0001 * np.random.random((self.n1 + 1, self.number_of_neurons))
        self.network_weight_two = 0.01 * np.random.random((self.number_of_neurons + 1, self.number_of_actions))

        self.dw1 = np.zeros(self.network_weight_one.shape)
        self.dw2 = np.zeros(self.network_weight_two.shape)

        # learning rate of network
        self.network_learning_rate_one = 0.001
        # learning rate of network
        self.network_learning_rate_two = 0.01
        # Network Momemtum Value
        self.M = .5
예제 #5
0
	def __init__(self):
		Rover20.__init__(self)

		self.quit = False

		self.lightsAreOn = False
		self.stealthIsOn = False

		# each integer may be -1, 0, or 1
		self.treads = [0,0]

		# window must be open and in focus for pygame to take input
		self.windowSize = [640, 480]

		# used to only refresh the video and not the unused pixels
		self.imageRect = (160,120,320,240)

		# Live video frames per second
		self.fps = 48

		# stores what the camera currently sees
		self.currentImage = None

		self.displayCaption = "Keyboard Rover 2.0"

		pygame.init()
		pygame.display.init()
		pygame.display.set_caption(self.displayCaption)

		self.screen = pygame.display.set_mode(self.windowSize)
		self.clock = pygame.time.Clock()
예제 #6
0
    def initialize(self):
        print "Initializing Rover Module..."

        # Set up basics
        Rover20.__init__(self)
        self.wname = 'Rover 2.0: Hit ESC to quit'
        self.quit = False

        # Set up controller using PyGame
        pygame.display.init()
        pygame.joystick.init()
        print "Initializing Joystick..."
        self.controller = pygame.joystick.Joystick(0)
        self.controller.init()

        # Defaults on startup: lights off, ordinary camera
        self.lightsAreOn = False
        self.stealthIsOn = False

        # Tracks button-press times for debouncing
        self.lastButtonTime = 0

        # Try to create OpenCV named window
        # print "Creating OpenCV Window..."
        # try:
        #     if cv:
        #         cv.NamedWindow(self.wname, cv.CV_WINDOW_AUTOSIZE )
        #     else:
        #         pass
        # except:
        #     pass

        self.pcmfile = open('rover20.pcm', 'w')
예제 #7
0
    def __init__(self):

        # Set up basics
        Rover20.__init__(self)
        self.wname = 'Rover 2.0: Hit ESC to quit'
        self.quit = Fsetalse

        # Set up controller using PyGame
        pygame.display.init()
        pygame.joystick.init()
        self.controller = pygame.joystick.Joystick(0)
        self.controller.init()

         # Defaults on startup: lights off, ordinary camera
        self.lightsAreOn = False
        self.stealthIsOn = False

        # Tracks button-press times for debouncing
        self.lastButtonTime = 0

        # Try to create OpenCV named window
        try:
            if cv:
                cv.NamedWindow(self.wname, cv.CV_WINDOW_AUTOSIZE )
            else:
                pass
        except:
            pass

        self.pcmfile = open('rover20.pcm', 'w')
예제 #8
0
	def __init__(self):
		Rover20.__init__(self)
		self.quit = False
		self.peripherals = {'lights': False, 'stealth': False, 'camera': 0}
		self.treads = [0,0]
		self.currentImage = None
		self.lock = threading.Lock()
예제 #9
0
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.nn_treads = [0, 0]
        self.currentImage = None
        self.peripherals = {'lights': False, 'stealth': False, \
                            'detect': True, 'camera': 0}

        self.action_choice = 1
        self.action_labels = ['forward', 'backward', 'left', 'right']
        self.action_vectors_motor = [[1, 1], [-1, -1], [-1, 1], [1, -1]]
        self.action_vectors_neuro = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0],
                                     [0, 0, 0, 1]]

        self.n1 = 32 * 24 * 3
        self.n2 = 2
        self.n3 = 4

        self.w1 = 0.00001 * np.random.random((self.n1 + 1, self.n2))
        self.w2 = 0.01 * np.random.random((self.n2 + 1, self.n3))

        self.dw1 = np.zeros(self.w1.shape)
        self.dw2 = np.zeros(self.w2.shape)

        self.L1 = 0.000001
        self.L2 = 0.001
        self.M = 0.9
예제 #10
0
 def __init__(self):
     Rover20.__init__(self)
     self.currentImage = None
     self.quit = False
     self.action_choice = 1
     self.action_labels = ['left', 'forward', 'right', 'backward']
     self.action_vectors = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
     self.data = np.ones(240 * 320 + 4)
예제 #11
0
 def __init__(self):
     Rover20.__init__(self)
     self.currentImage = None
     self.quit = False
     self.action_choice = 1
     self.action_labels = ['left', 'forward', 'right', 'backward']
     self.action_vectors = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
     self.data = np.ones(240 * 320 + 4)
예제 #12
0
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.orb = cv2.ORB()
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.currentImage = None
        self.peripherals = {"lights": False, "stealth": False, "detect": True, "camera": 0}
예제 #13
0
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.orb = cv2.ORB()
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.currentImage = None
        self.peripherals = {'lights': False, 'stealth': False, \
              'detect': True, 'camera': 0}
예제 #14
0
 def __init__(self):
     Rover20.__init__(self)
     print self.get_battery_percentage()
     #self.rover = Rover20()
     pygame.init()
     #self.file_name = 'filename'
     self.quit = False
     self.image = None
     self.run()
     self.close()
예제 #15
0
파일: Shell.py 프로젝트: circleupx/RALVINN
    def __init__(self):
        Rover20.__init__(self)
        self.quit = False
        self.lock = threading.Lock()

        self.treads = [0, 0]
        self.nn_treads = [0, 0]
        self.currentImage = None
        self.peripherals = {"lights": False, "stealth": False, "detect": True, "camera": 0}

        self.action_choice = 1
        self.action_labels = ["forward", "backward", "left", "right"]
        self.action_vectors_motor = [[1, 1], [-1, -1], [-1, 1], [1, -1]]
        self.action_vectors_neuro = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]

        self.n1 = 32 * 24 * 3
        # Number of neurons on the network
        self.number_of_neurons = 50
        # Number of actions available, like forward, back , left and right.
        self.number_of_actions = 4

        self.network_weight_one = 0.0001 * np.random.random((self.n1 + 1, self.number_of_neurons))
        self.network_weight_two = 0.01 * np.random.random((self.number_of_neurons + 1, self.number_of_actions))

        self.dw1 = np.zeros(self.network_weight_one.shape)
        self.dw2 = np.zeros(self.network_weight_two.shape)

        # learning rate of network
        self.network_learning_rate_one = 0.001
        # learning rate of network
        self.network_learning_rate_two = 0.01
        # Network Momemtum Value
        self.M = 0.5

        self.currentImage = None

        self.act1 = None

        self.act2 = None

        self.act22 = None

        self.bias = None

        self.pattern = None

        self.delta_w1 = None

        self.delta_w2 = None

        self.category = None

        self.sse = None

        self.error = None
    def __init__(self):
        """Sign follower initiation."""

        # Set up basics for Odometer
        self.state = (0, 0, 0)  #x,y,theta
        self.path = []  #list will contain points of previous positions)
        Rover20.__init__(self)
        self.wname = 'Rover 2.0: Hit ESC to quit'
        self.quit = False
        self.fileIndex = 0
        self.fname = 'filename'

        # Defaults on start-up: lights off, ordinary camera
        self.lightsAreOn = False
        self.stealthIsOn = False

        # Initiate My Turtle graphics to be used as a map.

        self.pcmfile = open('rover20.pcm', 'w')
        self.myturtle = Turtle()
        self.myturtle.speed(0)
        self.myturtle.pencolor("blue")
        self.nocommand_counter = 0
예제 #17
0
 def __init__(self):
     Rover20.__init__(self)
     self.heard = False
예제 #18
0
 def __init__(self):
     Rover20.__init__(self)
     self.heard = False