toward trace of camera

This commit is contained in:
2022-09-09 17:43:43 +02:00
parent 8af0839281
commit 31c5df6cb5

View File

@@ -410,6 +410,13 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
#bm.setTransform(tr) # assign transform #bm.setTransform(tr) # assign transform
grp.addItem(obj) grp.addItem(obj)
#--- camera tracong images ---
self._goTrace=grp=pg.ItemGroup() # the transformation is the same as for tracked objects
grp.setZValue(-20) #lower than other objects
self.vb.addItem(grp)
#--- testing scan grid --- #--- testing scan grid ---
#self.track_objects() # first call is needed to initialize the structure self._goTracked #self.track_objects() # first call is needed to initialize the structure self._goTracked
# #go=UsrGO.Grid((120, -100), (200, 150), (30, 22), 2) # #go=UsrGO.Grid((120, -100), (200, 150), (30, 22), 2)
@@ -1070,12 +1077,29 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
pFix=pg.Point(self._goFixGrp.mapFromScene(pos)) pFix=pg.Point(self._goFixGrp.mapFromScene(pos))
pFix-=bm.pos()+bm.size()/2 pFix-=bm.pos()+bm.size()/2
#create trace
img=pg.ImageItem(self._goImg.image)
img.setZValue(100)
trImg=self._goImgGrp.transform()
trTrk=self._goTracked.transform()
tr=trImg*trTrk.inverted()[0] #TODO: check if oder correct !!!
#tr.scale(.5,.5)
img.setTransform(tr)
self._goTrace.addItem(img)
_log.debug(f'dist to beam ({pFix[0]:>0.6g} {pFix[1]:>0.6g}mm)') _log.debug(f'dist to beam ({pFix[0]:>0.6g} {pFix[1]:>0.6g}mm)')
fx_motor=self.tweakers["fast_x"] fx_motor=self.tweakers["fast_x"]
fy_motor=self.tweakers["fast_y"] fy_motor=self.tweakers["fast_y"]
fx_motor.move_rel(pFix[0]) fx_motor.move_rel(pFix[0])
fy_motor.move_rel(pFix[1]) fy_motor.move_rel(pFix[1])
self._goTrace.setTransform(self._goTracked.transform())
#fx_motor.move_abs(fx_motor.get_val()+pFix[0]) #fx_motor.move_abs(fx_motor.get_val()+pFix[0])
#fy_motor.move_abs(fy_motor.get_val()+pFix[1]) #fy_motor.move_abs(fy_motor.get_val()+pFix[1])