Beispiel #1
0
def main():
    while True:
        request = Jarvis.takeCommand()
        response = chatbot.get_response(request)

        Jarvis.speak(response)
        print('Jarvis: ', response)
        if "exit" in request or "quit" in request or "bye" in request:
            Jarvis.speak("bye sir,Thanks for talking with me")
            print("Jarvis: bye sir,Thanks for talking with me")
            exit()
Beispiel #2
0
def do_test(test, data_set):
    """ Run appropriate CH algorithm
    return time to complete in ticks
    """
    if test == "Jarvis Algorithm ":
        t1 = time.perf_counter()
        Jarvis.do_Jarvis(data_set)
        t = time.perf_counter()
    else:
        t1 = time.perf_counter()
        Grahams.do_Grahams(data_set)
        t = time.perf_counter()
    return t - t1
Beispiel #3
0
def main():
    # Run MavLink software
    logging.info("RUNNING SERVER")

    server = TCP_Server.MAVServer("localhost", 8777)
    image = Image_Recognition.MAVImageRecognition(server)
    jarvis = Jarvis.Jarvis(server, image)

    server_thread = threading.Thread(target=TCP_Server.main, args=(server, ))
    image_thread = threading.Thread(target=Image_Recognition.main,
                                    args=(image, ))
    jarvis_thread = threading.Thread(target=Jarvis.main, args=(jarvis, ))

    server_thread.start()

    while not server.server_started:
        time.sleep(0.1)
    image_thread.start()
    jarvis_thread.start()
    """
    time_start = time.time()
    timeout = 10
    while time.time() < time_start + timeout:
        pass
    """
    jarvis_thread.join()
    image_thread.join()
    server_thread.join()
Beispiel #4
0
def main():
    # enable color on windows
    colorama.init()
    # start Jarvis
    jarvis = Jarvis.Jarvis()
    command = " ".join(sys.argv[1:]).strip()
    jarvis.executor(command)
Beispiel #5
0
def test_maxhull(algo):
    """
    Tests that check_maxhull_list method correctly returns a list
    with all points on the hull
    """
    err_count = 0
    if(algo == "Jarvis"):
        for i in range(3, 60):
            if len(Jarvis.do_Jarvis(Utils.make_maxhull_list(i))) != i:
                err_count += 1
        return err_count
    else:
        for i in range(3, 60):
            if len(Grahams.do_Grahams(Utils.make_maxhull_list(i))) != i:
                err_count += 1
        return err_count
Beispiel #6
0
    def mutate(self, id, parent):
        parent_coefs = parent.net.coefs_
        child_coefs = parent_coefs[:]
        for i in range(len(parent_coefs)):
            for j in range(len(parent_coefs[i])):
                for k in range(len(parent_coefs[i][j])):
                    child_coefs[i][j][k] = parent_coefs[i][j][k] * (
                        random.random() * 3 - 1.5)

        parent_intercepts = parent.net.intercepts_
        child_intercepts = parent_intercepts[:]
        for i in range(len(parent_intercepts)):
            for j in range(len(parent_intercepts[i])):
                child_intercepts[i][j] = parent_intercepts[i][j] * (
                    random.random() * 3 - 1.5)

        return Jarvis.Jarvis(self.gens, id, layers, child_coefs,
                             child_intercepts)
Beispiel #7
0
def test_minhull(algo):
    """
    Tests that check_minhull_list method correctly returns a list
    with exactly 3 points on the hull
    """
    size = 100
    err_count = 0
    if(algo == "Jarvis"):
        for i in range(0, 100):
            if len(Jarvis.do_Jarvis(Utils.make_minhull_list(size))) != 3:
                err_count += 1
            size += 10
        return err_count
    else:
        for i in range(0, 100):
            if len(Grahams.do_Grahams(Utils.make_minhull_list(size))) != 3:
                err_count += 1
            size += 10
        return err_count
Beispiel #8
0
    def breed(self, mother, father, id):

        mother_coefs = mother.net.coefs_
        father_coefs = father.net.coefs_
        child_coefs = father_coefs[:]
        for i in range(len(mother_coefs)):
            for j in range(len(mother_coefs[i])):
                for k in range(len(mother_coefs[i][j])):
                    if random.random() <= self.mutate_chance:
                        if random.randint(0, 1) == 1:
                            child_coefs[i][j][k] = mother_coefs[i][j][k]
                    else:
                        if random.randint(0, 1) == 1:
                            child_coefs[i][j][k] = mother_coefs[i][j][k] * (
                                random.random() * 3 - 1.5)
                        else:
                            child_coefs[i][j][k] = father_coefs[i][j][k] * (
                                random.random() * 3 - 1.5)

        mother_intercepts = mother.net.intercepts_
        father_intercepts = father.net.intercepts_
        child_intercepts = father_intercepts[:]
        for i in range(len(mother_intercepts)):
            for j in range(len(mother_intercepts[i])):
                if random.random() <= self.mutate_chance:
                    if random.randint(0, 1) == 1:
                        child_intercepts[i][j] = mother_intercepts[i][j]
                else:
                    if random.randint(0, 1) == 1:
                        child_intercepts[i][j] = mother_intercepts[i][j] * (
                            random.random() * 3 - 1.5)
                    else:
                        child_intercepts[i][j] = father_intercepts[i][j] * (
                            random.random() * 3 - 1.5)

        return Jarvis.Jarvis(self.gens, id, layers, child_coefs,
                             child_intercepts)
Beispiel #9
0
from Jarvis import *
from microphoneMonitor import *

jarvis = Jarvis(train_mode=True)
heard = MicrophoneMonitor()

while 1:
    command = heard.monitor_microphone(jarvis.name)
    jarvis.listener(command)
Beispiel #10
0
    for i in range(n):
        datax = random.randint(lowerX + 5, upperX - 5)
        datay = random.randint(lowerY + 5, upperY - 5)
        d.append((datax, datay))


def plotGraphic(data, ch, name):

    datax = [x[0] for x in data]
    datay = [x[1] for x in data]
    dataxch = [x[0] for x in ch]
    dataych = [x[1] for x in ch]

    plt.plot(dataxch, dataych, 'g.-', markersize=5)
    plt.plot(datax, datay, 'b.', markersize=5)
    plt.axis([lowerX, upperX, lowerY, upperY])

    plt.xlabel('x label')
    plt.ylabel('y label')

    plt.title('First Simple Plot - ' + name)
    plt.show()


if __name__ == "__main__":
    data = []
    fillData(data, 10)
    #data=sorted(data,key=lambda k:k[::-1])
    plotGraphic(data, Graham.run(data, upperX, upperY), 'Graham')
    plotGraphic(data, Jarvis.run(data), 'Jarvis')
    plotGraphic(data, QuickHull.run(data), 'Quick Hull')
Beispiel #11
0
def main():
    jarvis = Jarvis.Jarvis()
    jarvis.executor()
Beispiel #12
0
{
  "type": "service_account",
  "project_id": "divine-aegis-273407",
  "private_key_id": "532f45235374478c5431cc563d97eb8948656c70",
  "private_key": "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQClHuRDGP71I2uLz8QKDlZv8iX+IrmnXWfHvi3/Q/nQM0x5cwnoGQnjSmHGPW03aydnkrtshJVWGDE22RA+VHM+xCE+9fLPei5kFiHVznfdwd0fQ5qE16tHvhnBuODDOyBXIuLxukStMssdBs3Fs1CLZ0f8PW/KKi6cHhL4RP7HKLY97MKXL0f4/j9L3mZ1OGQ/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Ca3mTHNU+zfUXa0I9Ubkp9GMebDc7LvQ9DQT95dD8oIoScZWq714ngX5/ce6K6QXOnlAaAfovTVrTNXUygaYDWUiqE5Us/+w7ug5nl7FdvXPQOK/wTnhq3qFpYBfUOlna3bH+fZ4hAoGBAL6ozj2/EYoyZlo6fcfncowgxPoIsthJJIMxTL9R7VK3CpK5u3JKD2W/Grm1UTTjfvqayGJaqB0fYFcD7tnkS/5q1I88vTwt0yIm8CnHUnpPEa+Fd2ij9Gp5VLKmBg7N5Lr424UEHCIarWu9LmrRMAM4Q9FwqXZ7JaSK9FAGMdYv",
  "client_email": "*****@*****.**",
  "client_id": "100049148430509442181",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/cloud-vision%40divine-aegis-273407.iam.gserviceaccount.com"
}
'''
r = sr.Recognizer()
m = sr.Microphone()
jarvis = Jarvis.jarvis()

try:
    print("A moment of silence, please...")
    with m as source: 
        r.adjust_for_ambient_noise(source)

    print("Set minimum energy threshold to {}".format(r.energy_threshold))
    jarvis.greetings()
    while True:
        print("Say something!")
        with m as source: audio = r.listen(source)
        print("Got it! Now to recognize it...")
        try:
            # recognize speech using Google Speech Recognition
            user_value = r.recognize_google(audio)
pygame.display.set_caption(caption)
font = pygame.font.Font(None, 20)
clock = pygame.time.Clock()

coords = []
segs = []
run = True

while run:
    for event in pygame.event.get():
        if event.type == QUIT:
            run = False
        elif event.type == MOUSEBUTTONDOWN:
            coords.append(event.pos)
            if len(coords) >= 3:
                segs = jar.jarvis_march(coords)
        elif event.type == KEYDOWN:
            if event.key == K_SPACE:
                segs = []
                coords = []
            elif event.key == K_ESCAPE:
                pygame.quit()
    try:
        screen.fill(Color('white'))
    except:
        pygame.error
        print('Quit')

    #piirretaan teksti
    y = 10
    for line in text:
Beispiel #14
0
import Jarvis
import Utils

p = [Utils.Point(1, 1), Utils.Points(3, 4)]
Jarvis.do_Jarvis(p)
Beispiel #15
0
 def make_random_player(self, id):
     return Jarvis.Jarvis(self.gens, id, layers)
Beispiel #16
0
def main():
    jar = Jarvis()
    jar.start()
Beispiel #17
0
pygame.display.set_caption(caption)
font = pygame.font.Font(None, 20)
clock = pygame.time.Clock()

coords = []
segs = []	
run = True

while run:
	for event in pygame.event.get():
		if event.type == QUIT:
			run = False
		elif event.type == MOUSEBUTTONDOWN:
			coords.append(event.pos)
			if len(coords) >= 3:
				segs = jar.jarvis_march(coords)
		elif event.type == KEYDOWN:
			if event.key == K_SPACE:
				segs = []
				coords = []
			elif event.key == K_ESCAPE:
				pygame.quit()
	try:
		screen.fill(Color('white'))
	except:
		pygame.error
		print('Quit')

	#piirretaan teksti
	y = 10
	for line in text:
Beispiel #18
0
def main():
    jarvis = Jarvis.Jarvis()
    command = " ".join(argv[1:]).strip()
    jarvis.executor(command)