laserglyph and webui improvments

This commit is contained in:
leduc 2019-01-01 11:13:12 +01:00
parent 5f7a87cd95
commit 531a5f0490
5 changed files with 49 additions and 17 deletions

View File

@ -26,7 +26,7 @@ warpdest = [[-1500., 1500.],
[laser1]
color = -1
ip = 192.168.1.3
ip = 192.168.1.5
kpps = 25000
centerx = 506
centery = 413
@ -64,7 +64,7 @@ warpdest = [[-1500., 1500.],
[laser3]
color = -1
ip = 192.168.1.3
ip = 192.168.1.4
kpps = 25000
centerx = 0
centery = 0

View File

@ -27,6 +27,7 @@ viewer_distance = 2.2
eye_spacing = 100
nadir = 0.5
observer_altitude = 30000
#observer_altitude = 10000
# elevation = z coordinate
# 0.0 or -2000 pop out)
@ -45,8 +46,7 @@ vertices = [
# Define the vertices that compose each of the 6 faces. These numbers are
# indices to the vertices list defined above.
#faces = [(0,1,2,3),(1,5,6,2),(5,4,7,6),(4,0,3,7),(0,4,5,1),(3,2,6,7)]
faces = [(0,1,2,3),(1,5,6,2),(5,4,7,6),(4,0,3,7),(0,4,5,1),(3,2,6,7)]
faces = [(0,1,2,3),(0,4,5,1),(1,5,6,2),(2,3,7,6),(6,5,4,7),(7,3,0,4)]
def LeftShift(elevation):
@ -106,6 +106,18 @@ def Draw2PL():
Shape = []
Left = []
Right = []
x = vertices[0][0]
y = vertices[0][1]
z = vertices[0][2]
Left.append( Proj(x+LeftShift(z*5),y,z,0,0,counter))
Right.append(Proj(x+RightShift(z*5),y,z,0,0,counter))
#framy.PolyLineOneColor(Shape, c = white, PL = 0, closed = False)
framy.PolyLineOneColor(Left, c = red, PL = 1, closed = False)
framy.PolyLineOneColor(Right, c = green, PL = 2, closed = False)
for fa in faces:
#print ""
#print "face",fa
@ -133,11 +145,7 @@ def Draw2PL():
framy.rPolyLineOneColor(Left, c = red, PL = 1, closed = False, xpos = 200, ypos = 250, resize = 1, rotx =0, roty =0 , rotz=0)
framy.rPolyLineOneColor(Right, c = blue, PL = 2, closed = False, xpos = 200, ypos = 250, resize = 1, rotx =0, roty =0 , rotz=0)
'''
#print framy.LinesPL(0)
#print framy.LinesPL(1)
#print framy.LinesPL(2)
#counter -= 1
#counter += 1
#if counter >360:
# counter =0
@ -153,6 +161,18 @@ def Draw1PL():
#Shape = []
Left = []
Right = []
# Polyline will "move" the laser to this first point in black, then move to the next with second point color.
# For more accuracy in dac emulator, repeat this first point.
# Here the cube start always with vertice 0
x = vertices[0][0]
y = vertices[0][1]
z = vertices[0][2]
Left.append( Proj(x+LeftShift(z*5),y,z,0,counter,0))
Right.append(Proj(x+RightShift(z*5),y,z,0,counter,0))
for fa in faces:
#print ""
#print "face",fa
@ -163,8 +183,10 @@ def Draw1PL():
x = vertices[point][0]
y = vertices[point][1]
z = vertices[point][2]
#print x,y,z
#print "left",x+LeftShift(z*25),y,z, Proj(x+LeftShift(z*25),y,z)
#print x,y,z,counter
#if point == 0:
# print Proj(x+LeftShift(z*5),y,z,0,0,counter)
#print "left", Proj(x+LeftShift(z*25),y,z,0,counter,0)
#print "right",x+RightShift(z*25),y,z, Proj(x+RightShift(z*25),y,z)
@ -173,8 +195,9 @@ def Draw1PL():
Right.append(Proj(x+RightShift(z*25),y,z,0,counter,0))
#framy.PolyLineOneColor(Shape, c = white, PL = 0, closed = False)
framy.PolyLineOneColor(Left, c = red, PL = 0, closed = False)
framy.PolyLineOneColor(Right, c = green, PL = 0, closed = False)
#print Left
framy.PolyLineOneColor(Left, c = red, PL = 0, closed = True)
framy.PolyLineOneColor(Right, c = green, PL = 0, closed = True)
'''
framy.rPolyLineOneColor(Shape, c = white, PL = 0, closed = False, xpos = 200, ypos = 250, resize = 1, rotx =0, roty =0 , rotz=0)
@ -183,7 +206,7 @@ def Draw1PL():
'''
framy.LinesPL(0)
time.sleep(0.1)
counter -= 1
counter += 1
if counter >360:
counter =0

View File

@ -239,7 +239,6 @@ class DAC(object):
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connstatus = self.conn.connect_ex((gstt.lasersIPS[mylaser], port))
#print "Connection status for", self.mylaser,":", self.connstatus
#print 'debug', debug, gstt.debug
# ipconn state is -1 at startup (see gstt) and modified here
r.set('/lack/'+str(self.mylaser), self.connstatus)
gstt.lstt_ipconn[self.mylaser] = self.connstatus
@ -249,7 +248,6 @@ class DAC(object):
self.PL = PL
# Lower case pl is the actual point list coordinates
print "Init laser",self.mylaser,"asking for ckey", self.clientkey+str(self.mylaser)
self.pl = ast.literal_eval(r.get(self.clientkey + str(self.mylaser)))
if r.get('/EDH/'+str(self.mylaser)) == None:
@ -264,6 +262,7 @@ class DAC(object):
self.newstream = self.OnePoint()
if gstt.debug >0:
print "Init laser",self.mylaser,"asked for ckey", self.clientkey+str(self.mylaser)
if self.connstatus != 0:
#print ""
print "Connection ERROR",self.connstatus,"with laser", str(mylaser),":",str(gstt.lasersIPS[mylaser])

View File

@ -86,9 +86,19 @@
onOpen: function () {
_WS.showout(_WS.uri);
_WS.showout('CONNECTED');
document.getElementById("on").value = 1;
},
onClose: function () {
_WS.showout('DISCONNECTED');
document.getElementById("on").value = 0;
document.getElementById("lstt/0").value = 0;
document.getElementById("lstt/1").value = 0;
document.getElementById("lstt/2").value = 0;
document.getElementById("lstt/3").value = 0;
document.getElementById("lack/0").value = 0;
document.getElementById("lack/1").value = 0;
document.getElementById("lack/2").value = 0;
document.getElementById("lack/3").value = 0;
},
onMessage: function (e) {
var res = e.data.split(" ");

View File

@ -558,7 +558,7 @@
function draw() {
// Clear Canvas At The Start Of Every Frame
ctx.restore
//ctx.restore
if (pl2.length > 0)
{