Esempio n. 1
0
def main():
	
	image = pygame.image.load('resources%sa.png' % os.sep)
	newmover = mover.Mover(x=12,y=12, direction=0, speed=0, image=image.convert_alpha())
	global gameinfo
	gameinfo = readmap.ReadMap('1.map')

	cam = camera.cam(newmover.x, newmover.y, width, height, gameinfo.gamemap.width()*32, gameinfo.gamemap.height()*32)
	
	while True:
		pygame.event.pump()
		key = pygame.key.get_pressed()

		controls(key, newmover)
		gravity(newmover, 4, 24)

#		cam.move(newmover.x, newmover.y)
		
		for k in gameinfo.gamemap.map():
			for i in k:						
				screen.blit(i.mat, (i.posx*32-cam.x,i.posy*32-cam.y))
		screen.blit(newmover.image, (newmover.x-cam.x,newmover.y-cam.y))
		cam.move(newmover.x, newmover.y)
		for ent in gameinfo.entlist.entlist:
			print ent.position()
			screen.blit(ent.mat, (ent.position()[0]-cam.x,ent.position()[1]-cam.y))
		pygame.display.flip()
		clock.tick(90)
Esempio n. 2
0
def video_feed():
    global feed
    if feed == '1':
        if get_pic_stat():
            return Response(
                gen(cam(get_frames())),
                mimetype='multipart/x-mixed-replace; boundary=frame')
        else:
            flash("Pictures have been disabled. Check your settings.")
            return render_template('index.html', mess="LOL")

    if feed == '2':
        if get_vid_stat():
            return Response(
                rec(cam(get_frames())),
                mimetype='multipart/x-mixed-replace; boundary=frame')
        else:
            flash("Videos have been disabled. Check your settings.")
            return render_template('index.html', mess="LOL2")

    if feed == '3':
        return Response("Server stopped!")
Esempio n. 3
0
def main():
	
	global gameinfo
	gameinfo = readmap.ReadMap('1.map')
	newmover = mover.Mover(x=gameinfo.gamemap.start[0]*32,y=gameinfo.gamemap.start[1]*32, direction=0, speed=0)

	cam = camera.cam(newmover.x, newmover.y, width, height, gameinfo.gamemap.width()*32, gameinfo.gamemap.height()*32)
	
	ui = display.display()

	while True:
		pygame.event.pump()

		newmover.loop(gameinfo, screen)

		#Gamemap display
		for k in gameinfo.gamemap.map():
			for i in k:						
				screen.blit(i.mat, (i.posx*32-cam.x,i.posy*32-cam.y))

		#Entity display
		for ent in gameinfo.entlist.entlist:
			offcount = (32-ent.height,32-ent.width)
			screen.blit(ent.mat, 
			(ent.position()[0]+offcount[0]/2-cam.x,
			ent.position()[1]+offcount[1]-cam.y))
		
		#Player display
		screen.blit(newmover.image, (newmover.x-cam.x,newmover.y-cam.y))

		#UI elements
		ui.ui(screen, cam, newmover, gameinfo)

		#Camera update
		cam.move(newmover.x, newmover.y)

		pygame.display.flip()
		clock.tick(90)
Esempio n. 4
0
cui = cUI()  # интерфейс создается сразу

# ========== инициализация =============================================================================================

h, Xside, Yside, vel = cui.setStuff()
vrep.simxFinish(-1)
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 15000, 5)
if clientID != -1:
    print('|    Connected to AUV              |')
res, auv = vrep.simxGetObjectHandle(clientID, "Sphere",
                                    vrep.simx_opmode_oneshot_wait)

# создание объектов классов
path = PP(clientID, auv, vel)
camera = cam(clientID, "Vision_sensor")

# отправка нулевых сил
forceD = [0, 0, 0, 0]
s_force = vrep.simxPackFloats(forceD)
vrep.simxSetStringSignal(clientID, "ForceD", s_force, vrep.simx_opmode_oneshot)

# планировщик маршрута
path.setPolygon(h, Xside, Yside, vel)
path.makePath()

# ========== начало работы =============================================================================================
time.sleep(1)
vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)
print("|              start               |")
print("|                                  |")
Esempio n. 5
0
import camera

bias = []


def bias_cal(x):

    cv2.imshow("test", x)
    cv2.waitKey(10)

    gray = cv2.cvtColor(x, cv2.COLOR_BGR2GRAY)
    bias.append(gray)


camera.cam(bias_cal, count=10)

bias = np.median(bias, axis=0)

bias -= np.min(bias)
bias = bias.astype(np.uint8)

plt.imshow(bias)
plt.show()

# %% Live test

# cv2.namedWindow("test")


def live(x):
def aleyna(data):
    
    if "open code" in data:
        pyautogui.hotkey('ctrl', 't')
        time.sleep(2)
        os.system('cd /home/tim/Dokumente/projects/Virtual_assistant')
        os.system('code .')

    elif "introduce yourself" in data:
        speak("I am aleyna. Tims personal Desktop assistant. I am currently on version " + aleyna_version + " I am able to manage and automate a lot of tasks. Here is a demonstration")
        os.system('io.elementary.terminal -n')
        os.system("cd /home/tim/Dokumente(Virtual_assistant")
        os.system("python aleyna_introduction.py")
        time.sleep(4)
        pyautogui.hotkey('alt', 'f4')
        pyautogui.press('left')
        time.sleep(1)
        pyautogui.press('enter')
        speak("I can as well start a program")  
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite('blender')
        pyautogui.press('enter')
        time.sleep(4)
        pyautogui.hotkey('alt', 'f4')
        speak("Or control the camera")
        cam("Here is Aleyna")
        time.sleep(3)
        pyautogui.hotkey('alt', 'f4')

    elif "hostname" in data:
        hname = socket.gethostname()
        ip = socket.gethostbyname(hname)
        print("Host Name is:" + hname)
        print("Computer IP Address is:" + ip)
        speak("Your hostname is" + hname)
        speak("Your Ip Address is" + ip)

    elif "camera" in data:
        cam("webcam")        

    elif "discord" in data:
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite("discord")
        pyautogui.press('enter')
        
    elif "what time is it" in data:
        speak("it is " + currentTime)


    elif "terminal" in data:
        print("Opening Terminal")
        pyautogui.hotkey('ctrl', 't')

    elif "zoom" in data:
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite('zoom-client')
        pyautogui.press('enter')

    elif "blender" in data:
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite('blender')
        pyautogui.press('enter')

    elif "discord" in data:
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite("discord")
        pyautogui.press('enter')

    elif "whatsapp" in data:
        os.system("io.elementary.terminal -n")
        time.sleep(3)
        pyautogui.typewrite("whatsapp-for-linux")
        pyautogui.press('enter')

    elif "stop" in data:
        speak("Bye and take care!")
        quit()

    elif "power off" in data:
        print("Shutting down the pc...")
        speak("Goodbye Tim")
        os.system("poweroff")

    elif "reboot" in data:
        print("Rebooting the pc...")
        speak("I am rebooting now")  
        os.system("reboot")