wip: first working proto
This commit is contained in:
parent
1847c8ebef
commit
f67e7992ba
@ -139,8 +139,9 @@ class OnePointIterator( ):
|
||||
for i in range(0, e[1]):
|
||||
self.ref.xyrgb_step = (self.ref.prev_x + step * delta_x,
|
||||
self.ref.prev_y + step * delta_y) + rgb # + self.ref.xyrgb_prev[2:]# + rgb
|
||||
print(self.ref.xyrgb_step)
|
||||
# print(self.ref.xyrgb_step)
|
||||
yield self.ref.xyrgb_step
|
||||
|
||||
self.ref.prev_x, self.ref.prev_y = x, y
|
||||
self.ref.xyrgb_prev = [x, y]
|
||||
|
||||
@ -192,19 +193,6 @@ class Tracer(object):
|
||||
|
||||
|
||||
|
||||
def GetPoints(self, capacity):
|
||||
"""
|
||||
Iterates points and sends them to OnePoint
|
||||
|
||||
:param capacity:
|
||||
:return:
|
||||
"""
|
||||
iterator = OnePointIterator(self)
|
||||
# i = list(next(iterator))
|
||||
# d = [list(next(iterator)) for i in range(capacity)]
|
||||
d = [list(next(iterator)) for i in range(capacity)]
|
||||
|
||||
return d
|
||||
|
||||
def prepare(self):
|
||||
raise Exception("Please override the method")
|
||||
@ -247,7 +235,6 @@ class Tracer(object):
|
||||
Main loop common for every dac driver
|
||||
:return:
|
||||
"""
|
||||
|
||||
self.before_loop()
|
||||
|
||||
started = 0
|
||||
@ -279,10 +266,10 @@ class Tracer(object):
|
||||
if order == 1:
|
||||
""" 1 : Get the new EDH / The zoom || trapezoidal / homography settings for the laser """
|
||||
print("Tracer", self.laser_id, "new EDH ORDER in redis")
|
||||
# gstt.EDH[self.laser_id] = np.array(
|
||||
# ast.literal_eval(self.redis.get('/EDH/' + str(self.laser_id)).decode('ascii')))
|
||||
# # Back to user point list
|
||||
# self.redis.set('/order/' + str(self.laser_id), 0)
|
||||
gstt.EDH[self.laser_id] = np.array(
|
||||
ast.literal_eval(self.redis.get('/EDH/' + str(self.laser_id)).decode('ascii')))
|
||||
# Back to user point list
|
||||
self.redis.set('/order/' + str(self.laser_id), 0)
|
||||
|
||||
#
|
||||
if order == 2:
|
||||
@ -341,22 +328,11 @@ class Tracer(object):
|
||||
# self.redis.set('/lstt/' + str(self.laser_id), self.last_status.playback_state)
|
||||
# pdb.set_trace()
|
||||
# How much room?
|
||||
|
||||
capacity = self.get_points_capacity()
|
||||
self.redis.set('/cap/' + str(self.laser_id), capacity)
|
||||
iterator = OnePointIterator(self)
|
||||
points = [next(iterator) for i in range(capacity)]
|
||||
|
||||
# points = self.GetPoints(capacity)
|
||||
|
||||
# print("Writing %d points" % (cap, ))
|
||||
# t0 = time.time()
|
||||
# if self.laser_id == 2:
|
||||
# print(points)
|
||||
self.write(points)
|
||||
# t1 = time.time()
|
||||
# print("Took %f" % (t1 - t0, )
|
||||
|
||||
if not started:
|
||||
print("Tracer", self.laser_id, "starting with", gstt.kpps[self.laser_id], "kpps")
|
||||
self.begin(0, gstt.kpps[self.laser_id])
|
||||
|
@ -1,4 +1,5 @@
|
||||
import ctypes
|
||||
import random
|
||||
|
||||
from libs3 import gstt
|
||||
from libs3 import homographyp
|
||||
@ -49,7 +50,7 @@ class TracerHelios(Tracer):
|
||||
pass
|
||||
|
||||
def get_points_capacity(self):
|
||||
return 30000
|
||||
return 1000
|
||||
|
||||
# def GetPoints(self, capacity):
|
||||
# a = [2,3]
|
||||
@ -85,31 +86,31 @@ class TracerHelios(Tracer):
|
||||
# status_attempts += 1
|
||||
# print("attempt {}".format(status_attempts))
|
||||
# HeliosLib.WriteFrame(j, 3000, 0, ctypes.pointer(frames[i % 30]), 1000) # Send the frame
|
||||
try :
|
||||
points = [ *i for i in items ]
|
||||
frames = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
frame_type = HeliosPoint * 1000
|
||||
x = 0
|
||||
y = 0
|
||||
for i in range(30):
|
||||
y = round(i * 0xFFF / 30)
|
||||
frames[i] = frame_type()
|
||||
for j in range(1000):
|
||||
if (j < 500):
|
||||
x = round(j * 0xFFF / 500)
|
||||
else:
|
||||
x = round(0xFFF - ((j - 500) * 0xFFF / 500))
|
||||
frames[i][j] = HeliosPoint(int(x), int(y), 255, 255, 255, 255)
|
||||
for i in range(150):
|
||||
for j in range(numDevices):
|
||||
frame_type = HeliosPoint * self.get_points_capacity()
|
||||
frame = frame_type()
|
||||
helios_id = 0
|
||||
# print("hello got {} points".format(len(points)))
|
||||
points = [point for point in points]
|
||||
for i, point in enumerate(points):
|
||||
a = 0
|
||||
# @todo why are there 2 tuples in the object ???
|
||||
for one_point in point:
|
||||
x, y, r, g, b = one_point
|
||||
# x = random.randrange(1500,2500)
|
||||
# y = random.randrange(1500,2500)
|
||||
# r = 255
|
||||
# g = 255
|
||||
# b = 255
|
||||
break
|
||||
print(x,y,r,g,b)
|
||||
frame[i] = HeliosPoint(int(x), int(y), int(r), int(g), int(b), 255)
|
||||
statusAttempts = 0
|
||||
# Make 512 attempts for DAC status to be ready. After that, just give up and try to write the frame anyway
|
||||
while (statusAttempts < 512 and HeliosLib.GetStatus(j) != 1):
|
||||
while (statusAttempts < 512 and HeliosLib.GetStatus(helios_id) != 1):
|
||||
statusAttempts += 1
|
||||
HeliosLib.WriteFrame(j, 30000, 0, ctypes.pointer(frames[i % 30]), 1000) # Send the frame
|
||||
|
||||
except Exception as exc :
|
||||
print (exc)
|
||||
f = ctypes.pointer(frame)
|
||||
# int HeliosDac::WriteFrame(unsigned int devNum, unsigned int pps, std::uint8_t flags, HeliosPoint* points, unsigned int numOfPoints)
|
||||
r = HeliosLib.WriteFrame(0, 300, 0, f, len(frame))
|
||||
|
||||
def get_warped_point(self, x, y):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user