mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-26 23:19:33 +00:00
upgrade
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import socket
|
||||
import play_animation
|
||||
import time
|
||||
sock = socket.socket()
|
||||
serv = '192.168.1.10'
|
||||
port = 1234
|
||||
serv = '192.168.1.10' # Change to server ip
|
||||
port = 35001
|
||||
sock.connect((serv, port))
|
||||
sock.send(bytes('left','utf-8'))
|
||||
command = ''
|
||||
@@ -53,19 +54,8 @@ def time_synch():
|
||||
return response.tx_time-time.time()
|
||||
|
||||
|
||||
def pl_anim(c_frame):
|
||||
def pl_anim():
|
||||
global command
|
||||
takeoff()
|
||||
for frame in c_frame:
|
||||
if command != 'pause':
|
||||
time.sleep(0.1)
|
||||
play_animation.do_next_animation(frame)
|
||||
|
||||
|
||||
if __name__==__main__:
|
||||
t_0 = Thread(target=receive)
|
||||
t_0.daemon = True
|
||||
t_0.start()
|
||||
play_animation.read_animation_file()
|
||||
dtime=time_synch() - time.time()
|
||||
|
||||
@@ -78,8 +68,28 @@ if __name__==__main__:
|
||||
if 'synch' in command:
|
||||
dtime=time_synch() - time.time()
|
||||
print(dtime)
|
||||
|
||||
play_animation.takeoff()
|
||||
for frame in play_animation.frame():
|
||||
if command != 'pause':
|
||||
time.sleep(0.1)
|
||||
play_animation.do_next_animation(frame)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__==__main__:
|
||||
t_0 = Thread(target=receive)
|
||||
t_0.daemon = True
|
||||
t_0.start()
|
||||
|
||||
t_1 = Thread(target=pl_anim)
|
||||
t_1.daemon = True
|
||||
t_1.start()
|
||||
|
||||
|
||||
|
||||
|
||||
pl_anim(play_animation.frame())
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ cr_cet = 0
|
||||
copters = 1
|
||||
conn = []
|
||||
conn_2 = []
|
||||
file = ''
|
||||
afile = ''
|
||||
data = b''
|
||||
addr = []
|
||||
addr_2 = []
|
||||
@@ -228,18 +228,25 @@ class Widget(QMainWindow, main_gui.Ui_MainWindow):
|
||||
copters = self.swarm_size_spinBox.value()
|
||||
|
||||
def upload_animation(self):
|
||||
global file
|
||||
file = easygui.fileopenbox(filetypes=["*.csv"],multiple=True) # вызов окна проводника для выбора файла
|
||||
global afile
|
||||
afile = easygui.fileopenbox(filetypes=["*.csv"],multiple=True) # вызов окна проводника для выбора файла
|
||||
|
||||
def start_animation(self):
|
||||
global file
|
||||
for counter, sub_file in enumerate(file):
|
||||
global afile
|
||||
global d_time
|
||||
for counter, sub_file in enumerate(afile):
|
||||
f = open(sub_file, 'r')
|
||||
prog = f.read()
|
||||
self.sender(b'programm' + bytes(prog, 'utf-8')+b'stop', str(counter))
|
||||
time.sleep(0.1)
|
||||
for i in range(len(afile)):
|
||||
self.sender(bytes('begin_anim('+str(time.time()+d_time+10)+')','utf-8', str(counter))
|
||||
|
||||
t1 = Thread(target=self.start_retime)
|
||||
t1.daemon = True
|
||||
t1.start()
|
||||
|
||||
|
||||
def start_retime(self):
|
||||
for i in range(11):
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user