Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
9d00337c09 | |||
7e2d7c4afb |
25
LJ.conf
25
LJ.conf
@ -2,7 +2,7 @@
|
|||||||
lasernumber = 1
|
lasernumber = 1
|
||||||
debug = 0
|
debug = 0
|
||||||
rediserverip = 0.0.0.0
|
rediserverip = 0.0.0.0
|
||||||
wwwip = 192.168.1.14
|
wwwip = 127.0.0.1
|
||||||
nozoscip = 127.0.0.1
|
nozoscip = 127.0.0.1
|
||||||
oscserverip = 127.0.0.1
|
oscserverip = 127.0.0.1
|
||||||
autostart = artnet
|
autostart = artnet
|
||||||
@ -10,22 +10,23 @@ wstype = ws
|
|||||||
wsport = 9001
|
wsport = 9001
|
||||||
|
|
||||||
[laser0]
|
[laser0]
|
||||||
|
dac_family = extern_cmd
|
||||||
|
cmd = ./tracers/lj_rust/lj_rust ./tracers/lj_rust/settings.toml
|
||||||
color = -1
|
color = -1
|
||||||
type = LOCAL
|
type = DS1000
|
||||||
dac_family = etherdream
|
ip = 192.168.1.35
|
||||||
ip = 127.0.0.1
|
kpps = 25000
|
||||||
kpps = 10000
|
|
||||||
centerx = 7.0
|
|
||||||
centery = 61.0
|
|
||||||
zoomx = 312.0
|
|
||||||
zoomy = 1039.0
|
|
||||||
sizex = 32000.0
|
|
||||||
sizey = 32000.0
|
|
||||||
finangle = -0.02263757042605427
|
|
||||||
intens = 255.0
|
intens = 255.0
|
||||||
red = 100
|
red = 100
|
||||||
green = 100
|
green = 100
|
||||||
blue = 100
|
blue = 100
|
||||||
|
centerx = -21504.0
|
||||||
|
centery = 21504.0
|
||||||
|
zoomx = 8.90625
|
||||||
|
zoomy = 20.671875
|
||||||
|
sizex = 32000.0
|
||||||
|
sizey = 32000.0
|
||||||
|
finangle = 0.0
|
||||||
swapx = -1
|
swapx = -1
|
||||||
swapy = -1
|
swapy = -1
|
||||||
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||||
|
0
configure.py
Normal file → Executable file
0
configure.py
Normal file → Executable file
@ -103,6 +103,7 @@ from libs3 import settings, plugins, homographyp,log
|
|||||||
r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0)
|
r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0)
|
||||||
#r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0, password='-+F816Y+-')
|
#r = redis.StrictRedis(host=gstt.RediServerIP , port=6379, db=0, password='-+F816Y+-')
|
||||||
|
|
||||||
|
workers = []
|
||||||
|
|
||||||
GenericCommands = ["start", "align", "ljclient", "scene", "addest", "deldest", "dest", "clientnumber", "vcvrack", "fft", "mitraille", "faceosc", "midigen", "viewgen", "audiogen", "noteon", "cc", "ljpong", "ljwars", "mouse", "emergency", "simu", "status", "run", "nozoid", "planet", "live", "words", "ai", "bank0", "pose", "lj", "cycl", "glyph", "pong", "maxw", "custom1", "square", "regen", "trckr", "aurora", "line1", "ForwardUI", "settings", "debug", "pl", "plugins"]
|
GenericCommands = ["start", "align", "ljclient", "scene", "addest", "deldest", "dest", "clientnumber", "vcvrack", "fft", "mitraille", "faceosc", "midigen", "viewgen", "audiogen", "noteon", "cc", "ljpong", "ljwars", "mouse", "emergency", "simu", "status", "run", "nozoid", "planet", "live", "words", "ai", "bank0", "pose", "lj", "cycl", "glyph", "pong", "maxw", "custom1", "square", "regen", "trckr", "aurora", "line1", "ForwardUI", "settings", "debug", "pl", "plugins"]
|
||||||
|
|
||||||
@ -726,18 +727,23 @@ def LJautokill():
|
|||||||
print('Shutdown order for tracer '+str(laser), 9)
|
print('Shutdown order for tracer '+str(laser), 9)
|
||||||
r.set('/order/'+str(laser), 9)
|
r.set('/order/'+str(laser), 9)
|
||||||
|
|
||||||
|
for (n,dac_worker) in enumerate(workers):
|
||||||
|
log.warn(f'Entering tracer{n} ...')
|
||||||
|
dac_worker.join()
|
||||||
|
|
||||||
lasernumber= gstt.LaserNumber -1
|
lasernumber= gstt.LaserNumber -1
|
||||||
log.warn("Ending tracer0...")
|
# log.warn("Ending tracer0...")
|
||||||
worker0.join()
|
# worker0.join()
|
||||||
if lasernumber >0:
|
# if lasernumber >0:
|
||||||
log.warn("Ending tracer1...")
|
# log.warn("Ending tracer1...")
|
||||||
worker1.join()
|
# worker1.join()
|
||||||
if lasernumber >1:
|
# if lasernumber >1:
|
||||||
log.warn("Ending tracer2...")
|
# log.warn("Ending tracer2...")
|
||||||
worker2.join()
|
# worker2.join()
|
||||||
if lasernumber >2:
|
# if lasernumber >2:
|
||||||
log.warn("Ending tracer3...")
|
# log.warn("Ending tracer3...")
|
||||||
worker3.join()
|
# worker3.join()
|
||||||
|
|
||||||
|
|
||||||
log.warn("Laser feedbacks resetting...")
|
log.warn("Laser feedbacks resetting...")
|
||||||
for laserid in range(0,lasernumber+1):
|
for laserid in range(0,lasernumber+1):
|
||||||
|
@ -65,6 +65,7 @@ dacnumber = 0
|
|||||||
kpps = [25000,25000,25000,25000]
|
kpps = [25000,25000,25000,25000]
|
||||||
lasertype = ["LOCAL","LOCAL","LOCAL","LOCAL"]
|
lasertype = ["LOCAL","LOCAL","LOCAL","LOCAL"]
|
||||||
dacfamily = ["etherdream","etherdream","etherdream","etherdream"]
|
dacfamily = ["etherdream","etherdream","etherdream","etherdream"]
|
||||||
|
cmd = [None,None,None,None]
|
||||||
intensity = [-1,-1,-1,-1]
|
intensity = [-1,-1,-1,-1]
|
||||||
intens = [-1,-1,-1,-1]
|
intens = [-1,-1,-1,-1]
|
||||||
red = [100,100,100,100]
|
red = [100,100,100,100]
|
||||||
|
@ -32,6 +32,8 @@ def Write():
|
|||||||
config.set(laser, 'ip', str(gstt.lasersIPS[i]))
|
config.set(laser, 'ip', str(gstt.lasersIPS[i]))
|
||||||
config.set(laser, 'type', str(gstt.lasertype[i]))
|
config.set(laser, 'type', str(gstt.lasertype[i]))
|
||||||
config.set(laser, 'dac_family', str(gstt.dacfamily[i]))
|
config.set(laser, 'dac_family', str(gstt.dacfamily[i]))
|
||||||
|
if gstt.dacfamily[i] == "extern_cmd":
|
||||||
|
config.set(laser, 'cmd', str(gstt.cmd[i]))
|
||||||
config.set(laser, 'kpps', str(gstt.kpps[i]))
|
config.set(laser, 'kpps', str(gstt.kpps[i]))
|
||||||
config.set(laser, 'intens', str(gstt.intens[i]))
|
config.set(laser, 'intens', str(gstt.intens[i]))
|
||||||
config.set(laser, 'red', str(gstt.red[i]))
|
config.set(laser, 'red', str(gstt.red[i]))
|
||||||
@ -69,6 +71,8 @@ def Read():
|
|||||||
gstt.lasersIPS[i]= config.get(laser, 'ip')
|
gstt.lasersIPS[i]= config.get(laser, 'ip')
|
||||||
gstt.lasertype[i]= config.get(laser, 'type')
|
gstt.lasertype[i]= config.get(laser, 'type')
|
||||||
gstt.dacfamily[i] = config.get(laser, 'dac_family')
|
gstt.dacfamily[i] = config.get(laser, 'dac_family')
|
||||||
|
if gstt.dacfamily[i] == "extern_cmd":
|
||||||
|
gstt.cmd[i] = config.get(laser, 'cmd')
|
||||||
gstt.kpps[i] = config.getint(laser, 'kpps')
|
gstt.kpps[i] = config.getint(laser, 'kpps')
|
||||||
gstt.intens[i] = config.getfloat(laser, 'intens')
|
gstt.intens[i] = config.getfloat(laser, 'intens')
|
||||||
gstt.red[i] = config.getint(laser, 'red')
|
gstt.red[i] = config.getint(laser, 'red')
|
||||||
@ -90,4 +94,3 @@ def Read():
|
|||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(gstt.ConfigName)
|
config.read(gstt.ConfigName)
|
||||||
|
|
||||||
|
84
main.py
84
main.py
@ -82,7 +82,6 @@ elif os_name == "Darwin": # macOS
|
|||||||
elif os_name == "Linux":
|
elif os_name == "Linux":
|
||||||
print("Plateform: Linux")
|
print("Plateform: Linux")
|
||||||
|
|
||||||
|
|
||||||
def dac_process(number, pl):
|
def dac_process(number, pl):
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -90,6 +89,7 @@ def dac_process(number, pl):
|
|||||||
|
|
||||||
print("Starting dac process", number)
|
print("Starting dac process", number)
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
d = tracer.DAC(number,pl)
|
d = tracer.DAC(number,pl)
|
||||||
@ -325,7 +325,7 @@ def osc_thread():
|
|||||||
#
|
#
|
||||||
def get_Host_name_IP():
|
def get_Host_name_IP():
|
||||||
try:
|
try:
|
||||||
host_name = socket.gethostname()
|
host_name = "localhost" #socket.gethostname()
|
||||||
host_ip = socket.gethostbyname(host_name)
|
host_ip = socket.gethostbyname(host_name)
|
||||||
print("Hostname : ", host_name)
|
print("Hostname : ", host_name)
|
||||||
print("IP : ", host_ip)
|
print("IP : ", host_ip)
|
||||||
@ -480,10 +480,32 @@ for sceneid in range(0,gstt.MaxScenes+1):
|
|||||||
r.set('/order/'+str(laserid), 0)
|
r.set('/order/'+str(laserid), 0)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# For tracer as external command
|
||||||
|
#
|
||||||
|
import subprocess
|
||||||
|
import select
|
||||||
|
def spawn(cmd):
|
||||||
|
p = subprocess.Popen(cmd,
|
||||||
|
shell=True,
|
||||||
|
stdin=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL)
|
||||||
|
return p
|
||||||
#
|
#
|
||||||
# Starts one DAC process per requested Laser
|
# Starts one DAC process per requested Laser
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def signal_handler(sig, frame):
|
||||||
|
print('You pressed Ctrl+C!')
|
||||||
|
commands.LJautokill()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# Bug in 3.8.4 MacOS default multiprocessing start method is spawn. Spawn doesn't work properly
|
# Bug in 3.8.4 MacOS default multiprocessing start method is spawn. Spawn doesn't work properly
|
||||||
@ -498,33 +520,44 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
log.infog("Resquested DACs mode")
|
log.infog("Resquested DACs mode")
|
||||||
|
|
||||||
lasernumber = gstt.LaserNumber -1
|
#lasernumber = gstt.LaserNumber -1
|
||||||
print("LaserNumber = ", gstt.LaserNumber)
|
print("LaserNumber = ", gstt.LaserNumber)
|
||||||
log.info("Starting "+str(gstt.LaserNumber) + " DACs process...")
|
log.info("Starting "+str(gstt.LaserNumber) + " DACs process...")
|
||||||
|
|
||||||
|
commands.workers = []
|
||||||
|
for lasernumber in range(0,gstt.LaserNumber):
|
||||||
# Launch one process (a tracer3 instance) by laser
|
# Launch one process (a tracer3 instance) by laser
|
||||||
dac_worker0= Process(target=dac_process, args=(0,0,))
|
if gstt.dacfamily[lasernumber] == "extern_cmd":
|
||||||
dac_worker0.start()
|
dac_worker = spawn(gstt.cmd[lasernumber])
|
||||||
commands.worker0 = dac_worker0
|
dac_worker.name = f'ExternCmd{lasernumber}'
|
||||||
print("Tracer 0 : name", dac_worker0.name , "pid", dac_worker0.pid )
|
dac_worker.join = dac_worker.wait
|
||||||
|
else:
|
||||||
|
dac_worker= Process(target=dac_process, args=(lasernumber,0,))
|
||||||
|
dac_worker.start()
|
||||||
|
|
||||||
if lasernumber >0:
|
#commands.worker0 = dac_worker0 # ???
|
||||||
dac_worker1= Process(target=dac_process, args=(1,0,))
|
commands.workers.append(dac_worker)
|
||||||
commands.worker1 = dac_worker1
|
print(f"Tracer {lasernumber} : name", dac_worker.name , "pid", dac_worker.pid )
|
||||||
print("Tracer 1 : name", dac_worker1.name , "pid", dac_worker1.pid )
|
print("DAC Family:", gstt.dacfamily[lasernumber]);
|
||||||
dac_worker1.start()
|
|
||||||
|
|
||||||
if lasernumber >1:
|
# if lasernumber >0:
|
||||||
dac_worker2= Process(target=dac_process, args=(2,0,))
|
|
||||||
dac_worker2.start()
|
|
||||||
commands.worker2 = dac_worker2
|
|
||||||
print("Tracer 2 : name", dac_worker2.name , "pid", dac_worker2.pid )
|
|
||||||
|
|
||||||
if lasernumber >2:
|
# dac_worker1= Process(target=dac_process, args=(1,0,))
|
||||||
dac_worker3= Process(target=dac_process, args=(3,0,))
|
# commands.worker1 = dac_worker1
|
||||||
print("Tracer 3 : name", dac_worker3.name , "pid", dac_worker3.pid )
|
# print("Tracer 1 : name", dac_worker1.name , "pid", dac_worker1.pid )
|
||||||
commands.worker3 = dac_worker3
|
# dac_worker1.start()
|
||||||
dac_worker3.start()
|
|
||||||
|
# if lasernumber >1:
|
||||||
|
# dac_worker2= Process(target=dac_process, args=(2,0,))
|
||||||
|
# dac_worker2.start()
|
||||||
|
# commands.worker2 = dac_worker2
|
||||||
|
# print("Tracer 2 : name", dac_worker2.name , "pid", dac_worker2.pid )
|
||||||
|
|
||||||
|
# if lasernumber >2:
|
||||||
|
# dac_worker3= Process(target=dac_process, args=(3,0,))
|
||||||
|
# print("Tracer 3 : name", dac_worker3.name , "pid", dac_worker3.pid )
|
||||||
|
# commands.worker3 = dac_worker3
|
||||||
|
# dac_worker3.start()
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -542,8 +575,8 @@ if __name__ == '__main__':
|
|||||||
print("python3 configure.py")
|
print("python3 configure.py")
|
||||||
log.err('Exiting...')
|
log.err('Exiting...')
|
||||||
#gstt.wwwIP = hostIP
|
#gstt.wwwIP = hostIP
|
||||||
commands.LJautokill()
|
#commands.LJautokill()
|
||||||
sys.exit()
|
#sys.exit()
|
||||||
|
|
||||||
# Launch OSC thread listening to oscserver
|
# Launch OSC thread listening to oscserver
|
||||||
print("OSC server to receive messages (UI,...)")
|
print("OSC server to receive messages (UI,...)")
|
||||||
@ -612,6 +645,3 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
|
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user