minor changes

This commit is contained in:
2022-09-16 12:26:17 +02:00
parent d52a6cebba
commit 00588f8d68
2 changed files with 35 additions and 18 deletions

View File

@@ -9,13 +9,13 @@
shape an optimal path with given points shape an optimal path with given points
verbose bits: verbose bits:
1 basic info 0x01 basic info
2 plot sorting steps 0x02 plot sorting steps
4 list program 0x04 list program
4 upload progress 0x08 upload progress
8 plot gather path 0x10 plot gather path
16 plot pvt trajectory (before motion) 0x20 plot pvt trajectory (before motion)
32 print sync details 0x40 print sync details
Gather motor order Gather motor order
@@ -136,8 +136,8 @@ class DebugPlot:
ax1=fig.add_subplot(2, 1, 1) ax1=fig.add_subplot(2, 1, 1)
ax2=fig.add_subplot(2, 1, 2) ax2=fig.add_subplot(2, 1, 2)
#ax.xaxis.set_ticks(t) #ax.xaxis.set_ticks(t)
ax1.stem(t, pv[:,0], '-r') ax1.stem(t, pv[:,0], '-r',use_line_collection=True)
ax2.stem(t, pv[:,1], '-g') ax2.stem(t, pv[:,1], '-g',use_line_collection=True)
ax1.plot(tt, ppx, '-r', label='x') ax1.plot(tt, ppx, '-r', label='x')
ax2.plot(tt, ppy, '-g', label='y') ax2.plot(tt, ppy, '-g', label='y')
@@ -483,7 +483,7 @@ class ShapePath(MotionBase):
self.points=pts self.points=pts
verb=self.verbose verb=self.verbose
if verb&2: if verb&0x02:
self.plot_points(pts) self.plot_points(pts)
plt.show(block=False) plt.show(block=False)
@@ -508,7 +508,7 @@ class ShapePath(MotionBase):
self.points=pts self.points=pts
verb=self.verbose verb=self.verbose
if verb&2: if verb&0x02:
self.plot_points(pts) self.plot_points(pts)
plt.show(block=False) plt.show(block=False)
@@ -614,7 +614,7 @@ class ShapePath(MotionBase):
#print(idx) #print(idx)
pts=pts[idx] pts=pts[idx]
if verb&2: if verb&0x02:
DebugPlot.plot_points(pts) DebugPlot.plot_points(pts)
plt.show(block=False) plt.show(block=False)
self.points=pts self.points=pts
@@ -667,7 +667,8 @@ class ShapePath(MotionBase):
#gt.set_property(Period=acq_per) #gt.set_property(Period=acq_per)
self.meta.update({'acq_per':acq_per,'address':address}) self.meta.update({'acq_per':acq_per,'address':address})
def setup_coord_trf(self): def setup_coord_trf(self,fx='X',fy='Y',cz='0'):
# FY:1, FX:2, ROT_Y:3, CX:4, CZ:5,
if self.comm is None: return if self.comm is None: return
comm = self.comm comm = self.comm
gpascii = comm.gpascii gpascii = comm.gpascii
@@ -683,6 +684,22 @@ class ShapePath(MotionBase):
//#8->0 //#8->0
//#1..8j/ //#1..8j/
''' '''
prg=f'''&1a
&1#3->0
&1#4->0
&1#6->0
&1#7->0
&0#3->0
&0#4->0
&0#6->0
&0#7->0
&1
#1->{fy}
#2->{fx}
#5->{cz}
#1,2,5j/
'''
gpascii.send_block(prg) gpascii.send_block(prg)
def setup_motion(self,prgId=2,fnPrg=None,mode=0,**kwargs): def setup_motion(self,prgId=2,fnPrg=None,mode=0,**kwargs):
@@ -702,6 +719,7 @@ class ShapePath(MotionBase):
numPad : number of padding points to reduce aliasing (default=16) numPad : number of padding points to reduce aliasing (default=16)
''' '''
prg=['close all buffers','open prog %d'%(prgId)] prg=['close all buffers','open prog %d'%(prgId)]
verb=self.verbose
comm=self.comm comm=self.comm
if comm is not None: if comm is not None:
gpascii=comm.gpascii gpascii=comm.gpascii
@@ -745,8 +763,7 @@ class ShapePath(MotionBase):
else: else:
n=-numPad n=-numPad
pv[ 1:-1,(2,3)] = v[:n]*scale pv[ 1:-1,(2,3)] = v[:n]*scale
verb=self.verbose if verb&0x20:
if verb&16:
dp=DebugPlot(self);self.pvt=dp.plot_gen_pvt(pv) dp=DebugPlot(self);self.pvt=dp.plot_gen_pvt(pv)
plt.show(block=False) plt.show(block=False)
@@ -781,7 +798,7 @@ class ShapePath(MotionBase):
prg.append('close') prg.append('close')
#prg.append('&1\nb%dr\n'%prgId) #prg.append('&1\nb%dr\n'%prgId)
if self.verbose & 4: if verb&0x04:
for ln in prg: for ln in prg:
print(ln) print(ln)
@@ -790,7 +807,7 @@ class ShapePath(MotionBase):
fh.write('\n'.join(prg)) fh.write('\n'.join(prg))
fh.close() fh.close()
if comm is not None: if comm is not None:
gpascii.send_block(prg) gpascii.send_block(prg,verb&0x08)
self.prg=prg self.prg=prg

View File

@@ -40,7 +40,7 @@ static float timeOfs=0.f; //time ofset
#define SIMFLAG1 (pshm->Coord[1].Q[11]) #define SIMFLAG1 (pshm->Coord[1].Q[11])
//#define SIMFLAG0 (pshm->P[10]) //#define SIMFLAG0 (pshm->P[10])
//#define SIMFLAG1 (pshm->P[11]) //#define SIMFLAG1 (pshm->P[11])
//Power PMAC Software Reference Manual.pdf page 760 //Power PMAC Software Reference Manual.pdf Gate3[i].Chan[j].Status -> page 919 UserFlag
#define FLAG0 (gate3_1->Chan[0].Status&0x800) #define FLAG0 (gate3_1->Chan[0].Status&0x800)
#define FLAG1 (gate3_1->Chan[1].Status&0x800) #define FLAG1 (gate3_1->Chan[1].Status&0x800)