We have a linear motor that needs to be dynamically reassigned between two coordinate systems. We have a PLC that schedules the motion programs for the coordinate systems, and manages the timing of the axis assignment properly when no motion programs are running.
It works 99% of the time, but fails sporadically and irreproducibly, on the order of every 5-20 minutes. The assignments are getting made around every 15 seconds. As suggested in the manual, we are making the release/assignment as follows.
cmdSuccess=1;
Ldata.CmdStatus=1;
cmd"&1 delete lookahead"
sendallcmds
while(Ldata.CmdStatus>0) {}
if (Ldata.CmdStatus<0) { cmdSuccess=-1; send1"delete fail %d",Ldata.CmdStatus }
Ldata.CmdStatus=1;
cmd"&1#12->0"
sendallcmds
while(Ldata.CmdStatus>0) {}
if (Ldata.CmdStatus<0) { cmdSuccess=-1; send1"assign fail %d",Ldata.CmdStatus }
Ldata.CmdStatus=1;
cmd"&1 define lookahead 1500"
sendallcmds
while(Ldata.CmdStatus>0) {}
if (Ldata.CmdStatus<0) { cmdSuccess=-1; send1"define fail %d",Ldata.CmdStatus }
There are a number of different failure modes observed.
1. The #12->0 command fails and returns -20 (illegal cmd or illegal syntax??)
2. The define lookahead command fails and returns -34 (buffer full??). Trying to define it from the terminal after everything is stopped also returns the -34 error.
3. The commands do not fail, or the send1 debug messages do not get sent, but the LHSize in question is still 0 afterward. Trying to define lookahead later (when a program checks that LHSize==0) succeeds.
4. Same as 3, but trying to define lookhead from a program or the terminal returns the -34 error.
I am running a stress test in an almost blank pmac project and have seen all of these failures a few times.
Any input on possible causes, what the error codes mean, better ways to check the status, or better ways to have 2 CSs use the same motor at different times would be appreciated.