diff --git a/LJ.conf b/LJ.conf index 69d6b6f..17a495d 100644 --- a/LJ.conf +++ b/LJ.conf @@ -10,10 +10,10 @@ autostart = artnet [laser0] color = -1 type = DS1000 -ip = 192.168.2.4 +ip = 192.168.2.44 kpps = 25000 centerx = 0 -centery = 765 +centery = 0 zoomx = 45.0 zoomy = 45.0 sizex = 32000 @@ -32,8 +32,8 @@ color = -1 type = LOCAL ip = 192.168.2.43 kpps = 25000 -centerx = -11970 -centery = -6510 +centerx = 0 +centery = 0 zoomx = 30.0 zoomy = 30.0 sizex = 32000 @@ -54,11 +54,11 @@ ip = 192.168.2.6 kpps = 25000 centerx = 0 centery = 0 -zoomx = 45.0 -zoomy = 45.0 -sizex = 30600 +zoomx = 85.0 +zoomy = 85.0 +sizex = 32000 sizey = 32000 -finangle = -4.0 +finangle = 0.0 swapx = -1 swapy = -1 lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)] @@ -70,7 +70,7 @@ warpdest = [[-1500., 1500.], [laser3] color = -1 type = LUKE400 -ip = 192.168.2.3 +ip = 192.168.2.4 kpps = 25000 centerx = 0 centery = 0 diff --git a/LJ_template..conf b/LJ_template..conf index fa413f6..90d0b10 100644 --- a/LJ_template..conf +++ b/LJ_template..conf @@ -56,9 +56,9 @@ centerx = 0 centery = 0 zoomx = 45.0 zoomy = 45.0 -sizex = 30600 +sizex = 32000 sizey = 32000 -finangle = -4.0 +finangle = 0.0 swapx = -1 swapy = -1 lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)] diff --git a/README.md b/README.md index ee8e4ff..77f08e0 100644 --- a/README.md +++ b/README.md @@ -354,7 +354,9 @@ About hardware setup, especially if you have several lasers : ILDA cables are in # 2 useful and *always working tools* from j4cdac github repository : sitter and talk. -- Sitter will display all etherdreams available on the network and their state (playing, idle,...). python sitter.py or use the compiled version (for macOS). May need tkinter : pip3 install tk +- Sitter will display all etherdreams available on the network and their state (playing, idle,...). python sitter.py or use the compiled version (for macOS). May need tkinter : +pip3 install tk ++/- : sudo apt install python-tk - Talk : will draw a 4 colors square. Try : python3 talk3.py -h # @@ -375,6 +377,30 @@ Generic : There is a nice websocket debug tool : websocat. +# +# Troubleshooting +# + +Try these steps in this order ; + +- Use talk3 in ethertools directory : this ensure your computer can connect to the etherdream. See ethertools chapter in this readme. If talk3 doesn't works, check the hardware, connections,... + +python3 talk3.py -i etherdreamIP + +- You should see "connected to yourLJserverIP" on webUI. If not : LJ is not started / your network configuration is bad / a wrong IP in the configure parameters : python3 configure.py. + +- Switch to simu page. If you don't see anything : check redis server or your points in redis doesn't respect pointlist formatting (see command reference). + +- If talk3 works but you don't see your points : click on the Grid icon in Align page. This will override your pointlist and display squares. If Grid works : recomputed points by tracers are bad with given values in LJ.conf. + +"Bad points" ? + +- too small movement : some lasers (with small angle like 40°) won't display anything if zoomx/zoomy are too small. Increase zoomx / zoomy in LJ.conf. Try 50-100 values. +- off center : check in LJ.conf centerX and centerY. Reset them to 0. +- not enough points. + +*Don't kill your scanners : becareful with kpps setting.* + # # LJ commands reference # diff --git a/clitools/generators/fromRedis.py b/clitools/generators/fromRedis.py deleted file mode 100755 index 31d9da2..0000000 --- a/clitools/generators/fromRedis.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- -# -*- mode: Python -*- - - -''' - -This generator reads a frame from redis -v0.1.0 - -Use it to create feedback loops by writing to the same frame -or to copy the frame from someone else - -LICENCE : CC - -by cocoa - -''' - -from __future__ import print_function -import ast -import argparse -import json -import redis -import sys -import time -name="generator::fromRedis" - - -def debug(*args, **kwargs): - if( verbose == False ): - return - print(*args, file=sys.stderr, **kwargs) - - -argsparser = argparse.ArgumentParser(description="Dummy generator") -argsparser.add_argument("-k","--key",required=True,help="Redis key to look after",default=30,type=str) -argsparser.add_argument("-i","--ip",help="IP address of the Redis server ",default="127.0.0.1",type=str) -argsparser.add_argument("-p","--port",help="Port of the Redis server ",default="6379",type=str) -argsparser.add_argument("-f","--fps",help="Frame Per Second",default=30,type=int) -argsparser.add_argument("-v","--verbose",action="store_true",help="Verbose output") -args = argsparser.parse_args() - -fps = args.fps -verbose = args.verbose -key = args.key -ip = args.ip -port = args.port -optimal_looptime = 1 / fps -debug(name+" optimal looptime "+str(optimal_looptime)) - -r = redis.Redis( - host=ip, - port=port) - -while True: - start = time.time() - # Read from Redis - line = r.get(key) - # Decode as list of tuples - pointsList = ast.literal_eval(line.decode('ascii')) - # convert to list of lists - pointsList = [list(elem) for elem in pointsList] - # Convert to JSON string - line = json.dumps( pointsList ) - debug(name,"Key:{} line:{}".format(key,line)) - # Output - print(line, flush=True); - looptime = time.time() - start - if( looptime < optimal_looptime ): - time.sleep( optimal_looptime - looptime) - debug(name+" micro sleep:"+str( optimal_looptime - looptime)) - - diff --git a/ethertools/talk3.py b/ethertools/talk3.py index b841124..b4de9ef 100755 --- a/ethertools/talk3.py +++ b/ethertools/talk3.py @@ -35,7 +35,7 @@ import sys argsparser = argparse.ArgumentParser(description="Draw a square on a laser via Etherdream DAC") -argsparser.add_argument("-i","--ip",help="Etherdream IP (default : first etherdream broadcast received",default="True",type=str) +argsparser.add_argument("-i","--ip",help="Etherdream IP (default : first etherdream broadcast received)",default="True",type=str) diff --git a/libs3/cli.py b/libs3/cli.py index 7af0f73..06f47c8 100644 --- a/libs3/cli.py +++ b/libs3/cli.py @@ -15,6 +15,7 @@ from /team/laser from libs3 import gstt import argparse import subprocess +from libs3 import settings as Settings def handle(): @@ -112,8 +113,7 @@ def handle(): # Lasers = number of laser connected otherwise will be autodetected with one minimum if args.Lasers != None: gstt.LaserNumber = args.Lasers - else: - gstt.LaserNumber = 1 + Settings.Write() if args.bhoroscIP != None: diff --git a/libs3/commands.py b/libs3/commands.py index 133c2e7..3651580 100644 --- a/libs3/commands.py +++ b/libs3/commands.py @@ -92,7 +92,7 @@ Bob could use /pl/2/0 and /pl/2/1 and Lisa could use /pl/2/2 and /pl/2/3. import types, time, socket from libs3 import gstt import redis -from libs3 import settings, plugins, homographyp +from libs3 import settings, plugins, homographyp,log r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0) @@ -333,6 +333,9 @@ def handler(oscpath, args): print() print("new laser number",args[0]) print() + gstt.LaserNumber = int(args[0]) + settings.Write() + if oscpath[2] == "regen": print() @@ -352,6 +355,7 @@ def handler(oscpath, args): print() gstt.debug = int(args[0]) plugins.SendAll("/debug "+str(gstt.debug)) + settings.Write() if oscpath[2] == "rescan": @@ -359,11 +363,13 @@ def handler(oscpath, args): DAChecks() print("Done.") - if oscpath[2] == "rstrt": + if oscpath[2] == "restart": print() print("Restarting", args[0], "...") if args[0] == "lj": - raise Restart(time.asctime()) + LJautokill() + import os + os.execv(sys.executable, ['python3'] + sys.argv) else: plugins.Restart(args[0]) print() @@ -586,6 +592,31 @@ def isconnected(IP): time.sleep(delay) return ipup ''' +def LJautokill(): + + log.warn("LJ stopping...") + print(gstt.LaserNumber,"Tracers launched") + lasernumber= gstt.LaserNumber -1 + log.warn("Ending tracer0...") + worker0.join() + if lasernumber >0: + log.warn("Ending tracer1...") + worker1.join() + if lasernumber >1: + log.warn("Ending tracer2...") + worker2.join() + if lasernumber >2: + log.warn("Ending tracer3...") + worker3.join() + + log.warn("Laser feedbacks resetting...") + for laserid in range(0,lasernumber+1): + + r.set('/lack/'+str(laserid),64) + r.set('/lstt/'+str(laserid),64) + r.set('/cap/'+str(laserid),0) + log.infog("LJ stopped.") + # autodetect DACs in LJ.conf. def DAChecks(): diff --git a/libs3/gstt.py b/libs3/gstt.py index 8af2178..193098d 100644 --- a/libs3/gstt.py +++ b/libs3/gstt.py @@ -23,7 +23,7 @@ ljpath='' anims= [[],[],[],[]] # How many lasers are connected. Different that "currentlaser" and "dacnumber" (=autodetected) -LaserNumber = -1 +LaserNumber = 4 # What laser client to listen at launch SceneNumber = 0 diff --git a/libs3/tracer3.py b/libs3/tracer3.py index 78ceaff..02ffa1e 100644 --- a/libs3/tracer3.py +++ b/libs3/tracer3.py @@ -526,7 +526,8 @@ class DAC(object): # print("Writing %d points" % (cap, )) #t0 = time.time() - #print points + #if self.mylaser == 2: + # print(points) self.write(points) #t1 = time.time() # print("Took %f" % (t1 - t0, ) diff --git a/main.py b/main.py index bf33162..a633d63 100755 --- a/main.py +++ b/main.py @@ -440,21 +440,25 @@ if __name__ == '__main__': # Launch one process (a newdacp instance) by etherdream dac_worker0= Process(target=dac_process, args=(0,0,)) dac_worker0.start() + commands.worker0 = dac_worker0 print("Tracer 0 : name", dac_worker0.name , "pid", dac_worker0.pid ) if lasernumber >0: dac_worker1= Process(target=dac_process, args=(1,0,)) + commands.worker1 = dac_worker1 print("Tracer 1 : name", dac_worker1.name , "pid", dac_worker1.pid ) dac_worker1.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("") #def Run(): @@ -511,14 +515,13 @@ if __name__ == '__main__': except Exception: log.err("Exception") traceback.print_exc() - - except Restart(moment): - print("Autokill asked at", moment) # Gently stop on CTRL C finally: + commands.LJautokill() + ''' dac_worker0.join() if lasernumber >0: dac_worker1.join() @@ -533,8 +536,9 @@ if __name__ == '__main__': r.set('/lack/'+str(laserid),64) r.set('/lstt/'+str(laserid),64) r.set('/cap/'+str(laserid),0) + ''' + - print("Fin de LJ.") #if __name__ == "__main__": # Run()