wip
This commit is contained in:
@@ -80,14 +80,27 @@ class MotionBase:
|
|||||||
flag1='Gate3[1].Chan[1].UserFlag'
|
flag1='Gate3[1].Chan[1].UserFlag'
|
||||||
flag0='P0';flag1='P1'
|
flag0='P0';flag1='P1'
|
||||||
prg='''
|
prg='''
|
||||||
//Gather.Enable=2 if done in the sync program
|
//Gather.Enable=2 is done in the sync program
|
||||||
Coord[1].TimeBaseSlew=1 //1E-4 is default
|
Coord[1].TimeBaseSlew=1 //1E-4 is default
|
||||||
Coord[1].DesTimeBase=0
|
Coord[1].DesTimeBase=0
|
||||||
Coord[1].Q[1]=-1
|
Coord[1].Q[1]=-1
|
||||||
//while({flag0}==0){{}}
|
|
||||||
'''.format(plcId=plcId, crdId=crdId, flag0=flag0, flag1=flag1)
|
'''.format(plcId=plcId, crdId=crdId, flag0=flag0, flag1=flag1)
|
||||||
self.sync_prg=prg
|
self.sync_prg=prg
|
||||||
self.sync_run='&{crdId}b{prgId}r'''.format(prgId=prgId, plcId=plcId, crdId=crdId)
|
self.sync_run='&{crdId}b{prgId}r'''.format(prgId=prgId, plcId=plcId, crdId=crdId)
|
||||||
|
#download and start triggerSync code
|
||||||
|
comm=self.comm
|
||||||
|
|
||||||
|
sftp=comm.sftp
|
||||||
|
dst='/tmp/triggerSync'
|
||||||
|
src=os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/triggerSync/triggerSync'))
|
||||||
|
sftp.put(src, dst)
|
||||||
|
sftp.chmod(dst, 0o755)
|
||||||
|
self.cmdSync=cmd='LD_LIBRARY_PATH=/opt/ppmac/libppmac/ '+dst
|
||||||
|
#self.syncShell=comm.shell_channel(cmd)
|
||||||
|
#self.syncChan=sc=comm._client.exec_command(cmd)
|
||||||
|
#ch=sc[1].channel
|
||||||
|
#ch.settimeout(1)
|
||||||
|
#print ('starting '+cmd)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
'runs the code sync_run which has been generated with setup_sync()'
|
'runs the code sync_run which has been generated with setup_sync()'
|
||||||
@@ -99,3 +112,17 @@ class MotionBase:
|
|||||||
raise 'Need to call setup sync before'
|
raise 'Need to call setup sync before'
|
||||||
gpascii.send_block(cmd)
|
gpascii.send_block(cmd)
|
||||||
|
|
||||||
|
dst='/tmp/triggerSync'
|
||||||
|
src=os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/triggerSync/triggerSync'))
|
||||||
|
cmd='LD_LIBRARY_PATH=/opt/ppmac/libppmac/ '+dst
|
||||||
|
# self.syncShell=comm.shell_channel(cmd)
|
||||||
|
|
||||||
|
try:
|
||||||
|
cmd=self.cmdSync
|
||||||
|
except AttributeError: pass
|
||||||
|
else:
|
||||||
|
import time
|
||||||
|
time.sleep(1)
|
||||||
|
self.syncChan=sc=comm._client.exec_command(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -486,6 +486,16 @@ class ShapePath(MotionBase):
|
|||||||
gt.wait_stopped(verbose=True)
|
gt.wait_stopped(verbose=True)
|
||||||
self.rec=rec=gt.upload()
|
self.rec=rec=gt.upload()
|
||||||
|
|
||||||
|
try:
|
||||||
|
syncShell=self.syncShell
|
||||||
|
except AttributeError: pass
|
||||||
|
else:
|
||||||
|
print(syncShell.sync())
|
||||||
|
del self.syncShell
|
||||||
|
syncShell.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pts=self.points
|
pts=self.points
|
||||||
ofsy=-rec[0,2]+pts[0,1]
|
ofsy=-rec[0,2]+pts[0,1]
|
||||||
ofsx=-rec[0,3]+pts[0,0]
|
ofsx=-rec[0,3]+pts[0,0]
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ void trigsim_func(void *arg)
|
|||||||
rt_task_sleep_until(rtSlice+5*1E6); //in ns
|
rt_task_sleep_until(rtSlice+5*1E6); //in ns
|
||||||
pshm->P[1]=0;
|
pshm->P[1]=0;
|
||||||
|
|
||||||
if(pshm->Coord[1].Q[0]==-10)
|
//if(pshm->Coord[1].Q[0]==-10)
|
||||||
|
if(pshm->Coord[1].DesTimeBase==0)
|
||||||
{
|
{
|
||||||
rt_task_sleep_until(rtSlice+10*1E6); //in ns
|
rt_task_sleep_until(rtSlice+10*1E6); //in ns
|
||||||
pshm->P[0]=1;
|
pshm->P[0]=1;
|
||||||
|
|||||||
Reference in New Issue
Block a user