reading Pokeys pins

C Scripting questions and answers
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

>>Is the myreturn variable declared previousl y as anything other than a table?

No not declared more that once, the strange thing I can use it  any other lib
Even if I try to create a new variable table say with any random name in the probe lib it gives a compile error and soon as I run it..
I want to be able to return 2 values from a probing function and I though you said a table was the only way,

Zreturn does create in a different lib but still can't use in the probe lib even a whattable = Zreturn[0]; would error
 
>>make sure it shows up with a checkmark on it, not an X.. (just a note..)
funny thing is No X's

>>So Im not sure why you'd get a compilati on error just on that one usage
>>of the variable.

global ProbeReturn = table(0,0,0,0);
Ok exact error is script fails compilation
check back in and No X's for any lib's, bring back to in to edit global table still there try running again and get same error
Endless its reporting a false error

>>  As to the pause in the M6, if you check the toolchang e script in the system
>>library you may find a Stop call or some sort of wait that is making it pause till
>>run is pressed again. I seem to remember doing that so I could always just
>>press run again after a tool change. I believe M6 is one of those controls
>>that is scripted in system lib to perform the way I like, but it may not match
>>what you may want to do.. Perhaps the two are conflicti ng?

I changed most of the M6 function commands but off the top of my head there may still be a Stop Engine in there I will look...

I did remove the call to my dialog from the m6 and it seemed to run fine, stop and rewind were ok didn't have to estop
So looks like its something to do with the dialog getting something in auggie stuck or messed up but I can't see where
all the dialogs close just can't rewind or run again till estop hit.

Gary

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>>I want to be able to return 2 values from a probing function and I though you said a table was the only way,

  Well, there are other ways. You can just use two global values at the top of the script so
any function can set them. Its why I dont use tables, Im lazy and tend to just use
Global variables. I tend to use the script editor itself when developing anythign complex, it has better erros and debugging so you can see in realtime what the problem is with compilation and fix it. Using the script tab you dont get as much debug info on whats
going on.

    My use of dialogs has been restricted to ones showing videos or asking for an entry so
Im not sure of all the interactions with the system , your touring unknown country
for the most part.  The script editor may help in identifying whats wrong with the
compilation at least..

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I removed    //Engine.StopProgram(); line to test that didn't make a difference still no stop rewind.

Maybe you have another way to stop and wait for input and get input...

I don't see any other way to do the manual tool change and then do a touch off with the new tool and then reset the Z position.. to the new tool Hight..

I will try to run it though the script editor debugger and see what I find

if you are retuning 2 global variables i'm not sure how, as far as I can tell the return statement will only return 1 value return x,y; doesn't seem to work..
if it's a global table I can return all the values.

Just a quick update I am going to assume its the script edit run , somehow seems that's the problem, I put the line global TestReturn = ProbeReturn; at the beginning of the probe library and a print(TestReturn[1]);,  ProbeReturn has been declared as a table in another library I get compilation error from the script edit when I hit run.
Now if I run the same code in the scripter debugger I get no compilation errors and the correct value printed -2 form TestReturn[1]
So This one I have no idea, I leave this one for you.
   
Getting strange behavior when trying to run  some Gcode when I load the gcode I get no errors, when I run it I cutter comp errors and compile errors, the code runs at the to and  after first t4 m6, it stops, and I hit run it runs, but the second tool change it stops and I get the dialog continuing job stopped at it shows the work and mach coordinates and  what line to continue from I can enter any line number and then it seems to be running but gcode never continues past the tool change line...
Now if I stop all and rewind it seems that the Z axis gets lost if I click on the Z axis DRO to change to number 1.0 it changes to 0.0 if I change it to 2.0 it changes to 1.0
and so on... most of the time its 1 off the value I enter but only after running the gcode file..

I assuming auggie doesn't like g40 g41 ?


Gary
Last edited by gburk on Sun Apr 14, 2019 12:19 pm, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

>>I removed    //Engine.StopProgram(); line to test that didn't make a difference still no stop rewind.
>> Maybe you have another way to stop and wait for input and get input...
>>I don't see any other way to do the manual tool change and then do a touch off with the new tool and then reset >>the Z position. . to the new tool Hight..
>>I will try to run it though the script editor debugger and see what I find

    No, I think the script dialog for input should work. IF the scripter doesnt help, zip up all
your script library and Ill see if I can simulate it here.

>>if you are retuning 2 global variables i'm not sure how, as far as I can tell the return statement will only return 1 >>value return x,y; doesn't seem to work..
>>if it's a global table I can return all the values.

  You dont need to return globals, you just set them..

global MyProbeX = 0;
global MyProbeY = 0;

global MyProbe function()
{
...
...
  MyProbeY = 10;
  MyProbeX =  5;
}

global SomeOtherFunction = function()
{
  if( MyProbeX == 10) ....
}

  Any other script will now see the two variables as 10 and 5, nothing has to be returned. Thats
why I tended to use them as it was easier to simply declare a bunch of globals and not worry about returns.

>>Just a quick update I am going to assume its the script edit run , somehow seems that's the problem, I put the line global TestReturn = ProbeReturn; at the beginning of the probe library and a print(TestReturn[1]);,  ProbeReturn has been declared as a table in another library I get compilation error from the script edit when I hit run.
Now if I run the same code in the scripter debugger I get no compilation errors and the correct value printed -2 form TestReturn[1] .So This one I have no idea, I leave this one for you.

Hmm , sounds like the script using ProbeReturn is being installed before the one that declares it. Ill have to do some checking to see how that can happen, the system loads twice to catch such things. IT might be best to simply send me your libraries and see if I can make them run. Might show me why its off..
   
>>Getting strange behavior when trying to run  some Gcode when I load the gcode I get no errors, when I run it I cutter comp errors and compile errors g40 g41 ?

  Its part of Auggies spec that it doesnt do cutter comp. G40,41 will cause errors and failures. It's whole design was
to try to eliminate the things most cnc hobbiests dont use and add things that others couldnt do. Cutter comp
is large enough a ball of worms it was left  out purposely.

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I can't even declare the  global MyProbeX = 0 at the start of the probing lib I get the same error as the table, I will try it in a different lib and see if I can change it in the probe function...

I changed the post processor not to use g40 41 42 and 43...

but I get strange errors the gcode loads ok and look right in the display, but I will get an error script fails compilation same message will display 4 or 5 time
log shows
27:46:292  Script fails compilation.
27:46:292  See log for errors.
27:46:308  error (1) parse error, expecting `';''

it doesn't happen with all gcode files...
also still seems to get stuck on the second t4 m6 call seems like every thing gets lost there and if I hit run it will jog and when finished jogging then jogs back and stops for a tool change again its back on the same line, will not continue past the second m6 line..

I setup a global var in another lib it compiles ok
now I put this in the Zprobe function  and get the compilation error still
ZprobeReturnPos = GlobalGet("ProbePos2");
almost seems like I cant call any global var form that function..

Update may have fixed using global in the probing lib, haven't seen this one yet but first time for everything  it may have been a bad keyboard noticed some strange things happening when hitting keys swapped out the key board and now I can add global's to the probe lib...

thanks gary
Last edited by gburk on Tue Apr 16, 2019 11:01 am, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Code: Select all

Hi art

Have a macro question I assume auggie doesn't use g83 peck drilling....

so I created a macro G888 to do peck drilling it works but when I am done and exit the G888 function the go code stops and doesn't continue to next line
I put a Engine.StopProgram and it will return to the next line in the g code but it sits and waits for the run to be pressed is there a way around that..

Also is there a way to stop the dialog that pops up at tool changes and seem to popup at other times I hit the run.. it must be built into auggie it show the work and mach cords and ask line # to run from..

Here is the code

[codeglobal DrillPeck = function(x,y,z,s,r,d)
{ 
&nbsp; for( pecking = 0; pecking <= d; pecking+=s)
&nbsp; {
&nbsp;  print("Peck Drilling X "+x+" Y "+y+" Z "+z+ " R "+r+" S "+s+" D "+d+" Pecking = "+pecking); 
&nbsp;  Engine.GCode("G90 G01 Z-"+pecking);
&nbsp;  block("MotionStill");
&nbsp;  Engine.GCode("G91 G01 Z"+r);
&nbsp;  block("MotionStill");
&nbsp; };
&nbsp; yield();
 Engine.StopProgram();
};
 
global GCode888 = function()
{
&nbsp;  print( "GCode peck drill is being executed. ");
&nbsp;  print( "The following paameters were on the line.");
&nbsp;  print( "-999999 means the parameter was not used.");
&nbsp;  print("X:" + ParmsXYZ[0] + " Y:" + ParmsXYZ[1] + " Z:"+ ParmsXYZ[2]);
&nbsp;  print("AQL is :" + ParmsAQL);
&nbsp;  print("PRI is :" + ParmsPRI); //P Step distance // R Retract Hight
&nbsp;  print("JKD is :" + ParmsJKD);
&nbsp;  print("UVW is :" + ParmsUVW[0] + ", " + ParmsUVW[1] + ", " + ParmsUVW[2]);
&nbsp;  print("H is :" + ParmsH[0]);&nbsp; //H max Z distance down
&nbsp; DrillPeck(ParmsXYZ[0],ParmsXYZ[1],ParmsXYZ[2],ParmsPRI[0],ParmsPRI[1],ParmsH[0]);
};

And in the gcode call like this

T7 M6
( Drill1 )
G17
M8
M3
G888 X-0.4456Y-0.5138Z0.4456P0.03R0.250H.125 (P = peck distance R = Retract Distance H = Distance to Drill)
G888 X0.4384Y-0.5138Z0.4456P0.03R0.250H.125
F10.0
M9
( Drill2 )
G0 Z0.125
( T6 : 0.25 )
T6 M6
M8
M3
G888 X0.4384Y-0.5138Z0.4456P0.03R0.250H1.0
G888 X-0.4456Y-0.5138Z0.4456P0.03R0.250H1.0
M9]


Also is there a way to have auggie invert the estop so pokeys config doesn't have to be run switches get changed from no or nc,
and also with the probe if the probe pin 19 get inverted to also change the GlobalSet("ProbeInvert",0); so now ProbeInvert 0 would be inverted so if using probe that n/closed and then switch to a touch plate that may be n/open you wouldn't have to go into the script every time and change ProbeInvert 0 to 1 or 1 to 0..
make any sense sometimes my expiations are a little cloudy, maybe all the time..

Thanks gary&nbsp;
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Hi Art

I modified the post processor in sheetcam and that seems to be working ok in auggie the only time I seem have trouble is during a tool change m6 call and I think it has something to do with the dialog that auggie displays and it looks like it has saved&nbsp; x y z positions not current positions and when you hit ok to continue it is jogging to those positions sometimes the z would be to low so on the next move the tool could break off..

But it looks like I don't need the peck drill script with sheetcam , I will need it with cambam?

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

Sorry for the delay, my development computer blew its OS drive this week. Ive just now
come back up to snuff..

Ill take these one at a time..

>>27:46:292&nbsp; Script fails compilati on.
>>27:46:292&nbsp; See log for errors.
>>27:46:308&nbsp; error (1) parse error, expecting `';''
>>it doesn't happen with all gcode files...

&nbsp; This does sound like a script error in syntax somewhere. Id advise trying single line Gcodes
until you knbow what causes it. If the M6 causes it for example, look to all scripts called
by M6 and call them in the script window till we know which one exactly is missing the ";"


>>I setup a global var in another lib it compiles ok
>>now I put this in the Zprobe function&nbsp; and get the compilati on error still
>>ZprobeReturnPos = GlobalGet("ProbePos2");
>>almost seems like I cant call any global var from that function. .

&nbsp; and ZprobeReturnPos&nbsp; is defined as a global in an earlier file? Ill do some checking on the order
of execution.. But finding the ";" syntax may solve it, if the syntax error is found in the file, it may
have stopped the global from being defined. A syntax error is a non recoverable fault for that file.
This may be a clue the bad script is in the same file as the global?


Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>>Also is there a way to stop the dialog that pops up at tool changes and seem to popup at other times I hit the run..

&nbsp; That would be the "continue" dialog. It doesnt pop up unless it senses the current position
is not properly registered as a start position. Let me check to see why it pops up on you,
I never see it unless I stop a program and tell it to restart. I think the M0 may be stopping
the program without regard to continuing, it may instead need an M1 which&nbsp; should tell
it to stop temporarily ( pause) till its told to run. Running from stop will open
a continue dialog as its not sure where your starting from.

>>Also is there a way to have auggie invert the estop so pokeys config doesn't have to be run switches get changed from no or nc,

&nbsp; The polarity of the Estop switches are set by the Pokeys. I use whatever it is set to. If the pokeys software is expecting a no, thats what Auggie uses. If its mismatched with Mach3, I suspect Mach3
must override the settings of the Pokeys engine, or the engine setting is ignored in Mach3. To fix this
you should only have to open the Pokeys software, chck the setting of "Invert Estop" on that page so
that the estop works and resets properly. At that point Auggie should see the same thing.


>>and also with the probe if the probe pin 19 get inverted to also change the
GlobalSet("ProbeInvert",0); so now ProbeInve rt 0 would be inverted so if using probe that n/closed and then switch to a touch plate that may be n/open you wouldn't have to go into the script every time and change ProbeInve rt 0 to 1 or 1 to 0..make any sense sometimes my expiation s are a little cloudy, maybe all the time..

&nbsp; In Auggie, you set the probe to whether its normally Open or closed with the planner setting of "ProbeInvert", this isnt the same as the script setting. The planner setting in the config basically
tells Auggie if you want "normal" out of the box behaviour to be be a contact of normally open
or normally closed.

&nbsp; The Script Call to GlobalSet("ProbeInvert",true) is a different setting, it means to now
use the opposite of the planner setting. In other words you use it to temporarily swap
the pins so that you can probe off a plate instead of probing to it. After that move youd
then tell it GlobalSet("ProbeInvert",false) to set it back to "normal" which is whatever the
config planner setting is. So setting the planners config of "ProbeInvert" is the way to
set the normal condition. The last script call setting is forgotten upon restart.

&nbsp; Ill check the code this week to find out how to properly pause a program instead instead
of stopping it. I think the continue dialog occurs if the postion at last stop changed
prior to hitting run, but Ill check to be sure.

Art



User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; In looking into why the "Continue" dialog opens after your scripts I figured Id explain how it work.

When you press run there are quite a few different things that will happen depending on context. IF the Tab window is on scripts for example it runs the script, if on MDI, it runs depending on the tab as to if its
single line or multiple line MDI . In Gcode though, it does a few checks. If your last end point is the same as the current start point, then it wont open the "continue" window. If it senses though, that you are in
a different coordinate that when you last ended a move, it will bring up the "continue" dialog to ensure
a smooth motion to the start of the move. This is in case you have jogged or something.

&nbsp; This is why in a default M6 call, the tool changes, the system waits for a run to be pressed in
order to start up on the next gcode line when RUN is pressed, and when you press RUN, the
dialog doesnt open, it just runs.

&nbsp; In your case, your moving the coordintes , so the system thinks your starting from a new
location. Try adding a Gcode("g1...") call to your new coordinates (( in essense a non move)
which will set the system so it thinks the last end was your new coordinates. When you next press
run the dialog shouldnt open.

&nbsp; I will add a command I think to disable the "continue dialog", or find soem way to properly
sync the last move so you wont have it open. I call to the planners sync() routine would stop
it from happening so it may be I only need to add a Sync Command after coordinates
have been changed.&nbsp;

Thx
Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Hi Art

Glad to here you are up and running again...

I will try one thing at a time I think I keep getting ahead of my self OCD!

As for the Continue dialog it only pops up during a M6 Tool change, and right now I have removed any scripts I was working on for M6 calls and I am using only the ones you had in the scripts.. maybe be easier to trace down..

hers an example of what continue dialog displays on the very first M6
Mach cord X -0.4450 Y -0.6963 Z -0.3312 A 0.0000
Work cord X 0.0000 Y 0.0000 Z 0.0000 A 0.0000

auggies DRO's show X = 0.0000 Y = 0.0000 Z = 0.5000

I sent the Z axis to .5 before the M6....

As far as what's script is causing the ; error I don't know here is a clip from the error file. it error as soon as the g code is loaded seems like its in the screen regen
The image looks correct on the screen not messed up, looks like the correct tool path I guess is what I meant to say..

15:56:507&nbsp; --System -- User has Regened the toolpath.&nbsp;
15:56:585&nbsp; Script fails compilation.
15:56:585&nbsp; See log for errors.
15:56:600&nbsp; error (3) parse error
15:56:600&nbsp; error (3) parse error
15:56:600&nbsp; Script OnRegen() Called
15:56:600&nbsp; error (1) parse error, expecting `';''
15:56:600&nbsp; Script fails compilation.
15:56:616&nbsp; See log for errors.
15:56:632&nbsp; error (1) parse error, expecting `';''
15:56:632&nbsp; Script fails compilation.
15:56:632&nbsp; See log for errors.
15:56:647&nbsp; error (1) parse error, expecting `';''
15:56:647&nbsp; Script fails compilation.
15:56:663&nbsp; See log for errors.
15:56:679&nbsp; error (1) parse error, expecting `';''
15:56:741&nbsp; Script fails compilation.
15:56:741&nbsp; See log for errors.
15:56:757&nbsp; error (1) parse error, expecting `';''
15:56:772&nbsp; Script fails compilation.
15:56:772&nbsp; See log for errors.
15:56:804&nbsp; error (1) parse error, expecting `';''
15:56:819&nbsp; Script fails compilation.
15:56:819&nbsp; See log for errors.
15:56:835&nbsp; error (1) parse error, expecting `';''
15:56:866&nbsp; Script fails compilation.
15:56:866&nbsp; See log for errors.
15:56:897&nbsp; error (1) parse error, expecting `';''
15:56:929&nbsp; --System -- User has Regened the toolpath.&nbsp;
15:56:929&nbsp; GCode file loaded.
15:56:929&nbsp; Processing Paths

do you think not having a space between line number and g code could be a problem example
N220G00G43Z0.8000H2
or space
N230 S2500M03

Thanks gary
Last edited by gburk on Mon Apr 29, 2019 3:51 am, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

hi art

Have a thought on what maybe part of the problem with having to run the LIB script first before it works...

I have the tool script with 16 buttons only testing on button one right now..

If I boot auggie and press tool button 1 the only thing in the script that runs are the freeaxis's I have a Engine.FreeRapit(null,4,4,null); and also a Engine.RapitTo(2,2,2,null); the free axix's dro's run up to 4 4 the X Y Z axis's show no movement... no dro's moving...

Now if I run the script in the edit run all axis's move... Not sure if this helps at all but just something I am seeing going on... and it looks like the script was compiled on boot up..

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>>N220G00G43Z0.8000H2

&nbsp; Spaces shouldnt matter. But the G43 could trip an error.&nbsp; G43 is not yet implemented for use, its there and will take the H2 to mean 2mm offset to the Z height, not add the tool#2 height. As there is no tool table,
G43 wont work the way it will in Mach3 for example.

&nbsp; Do the script ";" errors only happen in certain gcode programs? If so, post the Gcode
so I can test that to see why the error.&nbsp; It does look as if that error is related to some script
that is failing.

>>g to run the LIB script first before it works...

&nbsp; It sounds as if the script is fine, but for some reason your motion is inhibited after you
start up. Since the freeaxis are running, the script must be. SO we need to figure out
why the main axis are ignoring your calls, and not tripping an error.

Are your tool buttons in one library file folder of their own? Can you zip it up so
I can simply unzip that folder to add it to my own? If so perhaps I can test
it that way to find why that weird stoppage at first.
&nbsp; Have you found doing anything else fixes it? Does , for example, loading and
running a Gcode program that doesnt use any of your scripts first, then allow
the scripts to run right away?

Art


gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Ok at I attached more than you asked for but what the heck

my panels and scripts also the gcode I have been having a problem with..
you are right not having a space between the line numbers didn't matter I have them spaced in the copy of the gcode.

yes they are in a library of there own..

I don't think any of the gcode use's any of my scripts except m6 and I have shut that lib off and was just using the you library calls...

I don't think I will be able to use any m6 call from my library endless&nbsp; I can turn off your dialog that pops up on most of the m6 calls so if I use the dialog I created and it pops up so does yours and that makes things not react as I would like not sure but your dialog is sending the axis's other that were I would like to go with mine..

also when the auggie first boots should it display the message system reset scripting two times?.

also one thing I just realized is when I call the tool button script and the free axis starts running the e stop is off that doesn't seem right to be runing the free axis without turning on the estop this could be a disaster...

did a little more testing and the free axis only runs in simulator mode but not the x y z with the rapid moves with the button press - endless the script is run first
now in motion mode only the x y z run and not the free axis's with the same button press script and doesn't matter if you run script first still no free axis move..
still get buffer under run error


Thanks gary
Attachments
XballscrewmountFinal.zip
(1.84 KiB) Downloaded 322 times
Panels.zip
(272.79 KiB) Downloaded 305 times
Scripts.zip
(15.23 KiB) Downloaded 311 times
Last edited by gburk on Sun May 05, 2019 11:10 am, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

Thx, just got the files, Ill see whats up tomorrow. Just had my floors sanded so I was kicked out of home
for a few days till they dried.

>>also when the auggie first boots should it display the message system reset scripting two times?.

&nbsp; Yes, its a bit of a trick. The first time its finding globals and such used by other files, it allows globals
to be seen by files that use them before they are declared.

>>still get buffer under run error

&nbsp; Thats usually when you exceed 125Khz the Pokeys is maxed for.. but give me a couple days
and Ill know more about your scripts.

Art
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest