PDA

View Full Version : Touch-off plate for CNC router?



CanSir
08-06-2008, 12:51 AM
I've been playing with EMC2 while waiting for my CNC parts to arrive so I'm very new to EMC2, but from the sounds of it, it is very customizable. One of the cool add-ons I've come across for a CNC router is a touch off plate to accurately adjust the z height for the current tool bit.

I can find information on using a touch-off plate with Mach3 and how to add a custom screen for that application, but I haven't seen anything specific on how to accomplish the same thing using EMC2. The closest I've come across is adding probe functionality to EMC2.

Has anyone configured/customized EMC2 to use a touch-off plate? Care to share how it's done?

Regards,

Dean.

samco
08-06-2008, 09:20 AM
The probe is what you want..

There is a sample g-code program showing how to set tool lengths.

http://cvs.linuxcnc.org/cvs/emc2/nc_files/tool-length-probe.ngc

I have used this for making circuit boards. Once the first tool length is known - the rest are referenced from that.

(I use a microswitch)

sam

CanSir
08-07-2008, 01:16 PM
Thanks for the link! It's going to take me a little while to wrap my head around the g-codes and whatnot, but it does look like it'll do what I was asking.

CanSir
08-08-2008, 05:49 AM
I've been looking over that code and I'm starting to understand it, but the implementation of it still leaves me puzzled. I use the AXIS interface and I can only see two ways to implement that touch-off gcode. One way would be to type in those gcodes line by line on the MDI interface and the other would be, even before launching EMC2, to do a search on the G-code file and insert that code snippet after every toolchange command. Is there a cleaner way?

I was envisioning the following:
I secure my workpiece to the table
I lay my touch-pad (the thickness of which is already known to EMC) on top of the material
I jog the router to be above the touch-pad
I hit a button in AXIS and it magically lowers the router until the bit touches the pad
Viola! EMC is configured to cut to the exact depth specified in my job

When prompted to do a tool change, it would be nice if I could repeat the above steps and afterwards have the router return to it's last XYZ position before signaling that the bit change is complete.

I see lots of examples on interfacing with hardware, but nothing showing how I can add a button onscreen that executes some G-Code commands. Does anybody have some examples of using python scripts within EMC?

BillTodd
08-26-2008, 08:53 PM
Hi Cansir,

I found this thread after looking to do the exactly the same thing. :)

You might be able to get the G-code post processor of your CAM package to insert the measuring code automatically after each tool change (I'm using SheetCAM which has this type of option in the post processor).

All you'd have to do then is set the probe switch height to match the surface of your material at the start of the job. The machine could probe the tools after they're changed. (At least this is how I think it should work :))

Bill

CanSir
08-27-2008, 03:05 PM
I've made some progress by using bit's and pieces out of several how-to articles on the emc wiki site:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?EmcKnowledgeBase

I've managed to create a virtual control panel in AXIS and re-configure HAL to use my tool change code instead of the supplied manual tool change code. Unlike some other people, I discovered that I really do need to connect my cutter to ground in order to get a reliable "touch" signal. I believe I am 90% of the way there and just need to put it all together for a real test.

When I get it all working, I will create a knowledge base article on that linux wiki site to share what I've come up with.

I never considered looking into my CAM program to see how it could help. Probably just need to add code to the post-processor file for the Tx command?

- Dean

Big John T
08-27-2008, 04:03 PM
As I understand it you have the tool probe in a certain spot and in your G code you move over and do a probe move to find the length of the tool. You can then do an offset from that. You have to hook up the probe to the probe input and define that. If you used stepconf to set up then in the parallel port page you can define which pin is Probe In.

If you need more help just holler.

John

Zig
09-07-2008, 06:14 PM
I too am looking at tool changer for my gantry router.

I envisage a linar tool changer rack along an adge of the table.

The g code file ( job file) is to incorporate some code to controll the action of the spindle and to instruct it to go over to the rack and pick up tools from the rack.

The tools are 1/8" shank bits with distance rings held in cups.

I am yet to build up the tool rack and position it in its place, however the code seems to be working.

More as it becomes available.

chazmtu
10-27-2008, 03:39 PM
I know this thread has been silent for a while, but I've been trying to do the same thing as cansir using this tutorial (http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Adding_Custom_MDI_Buttons). I'm new to EMC and just starting to learn about the interactions between files.
Can someone help me figure out how to get a VCP button to run multiple lines of gcode? So far I have a button controlling a probe move for my touch off plate but can only run one line of code. I followed the tutorial then renamed the button and changed the gcode line. I'm pretty sure that I have to change my postgui.hal file line for that button. Right now it reads:

net remote-z-axis-touchoff halui.mdi-command-00 <= pyvcp.z-axis-touchoff

Here's what I know. z-axis-touchoff is my button variable. This "<= pyvcp.z-axis-touchoff" connects my button to the preceding command. and "mdi-command-00" lets me run one mdi command from my .ini file. What do the net and remote commands do? What do I replace "mdi-command-00" so that I can call a file or sub section in my .ini file with the code? :confused: Any help would be greatly appreciated.

Chuck

chester88
10-27-2008, 11:21 PM
I was thinking about this. HAL-UI allows you to have MDI commands that are invoked by HAL pins. If you set up a few MDI commands on pins then had classicladder run these pins in order (you would have a button to start the process) , you may be able to do what you want. All theory of course I have not tried this. Food for thought.

Big John T
10-28-2008, 11:27 AM
I know this thread has been silent for a while, but I've been trying to do the same thing as cansir using this tutorial (http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Adding_Custom_MDI_Buttons). I'm new to EMC and just starting to learn about the interactions between files.
Can someone help me figure out how to get a VCP button to run multiple lines of gcode? So far I have a button controlling a probe move for my touch off plate but can only run one line of code. I followed the tutorial then renamed the button and changed the gcode line. I'm pretty sure that I have to change my postgui.hal file line for that button. Right now it reads:

net remote-z-axis-touchoff halui.mdi-command-00 <= pyvcp.z-axis-touchoff

Here's what I know. z-axis-touchoff is my button variable. This "<= pyvcp.z-axis-touchoff" connects my button to the preceding command. and "mdi-command-00" lets me run one mdi command from my .ini file. What do the net and remote commands do? What do I replace "mdi-command-00" so that I can call a file or sub section in my .ini file with the code? :confused: Any help would be greatly appreciated.

Chuck

Chuck the net part creates the connection, the signal name is remote-z-axis-touchoff, the <= are only to make it more readable. I'm not sure if you can call files from the mdi. Only valid mdi commands work. If your really wanting to call a subroutine look a the "O" codes.

John

chazmtu
10-28-2008, 01:47 PM
Hi John,

Thanks for the clarification. I have looked into using the O codes for the mdi command but I got errors because they were not recognized as a valid command. Maybe because it doesn't know where to look for a subroutine? What I don't understand is, the integrator manual states that the mdi command function is for more "complicated tasks", but running one line of gcode doesn't seem all that complicated or terribly useful. Unfortunately, I only found the one example. Chester88 might be onto something though. I'll have to look into ladder commands. I'm not much of a programmer.

chester88
10-28-2008, 03:05 PM
If you need help with classicladder, I might be able to help.
I would think something like:
check for MDI mode, and start touch off button are true
if true sent bit pin true for MDI comand - rapid to touch off position
wait for emc idle pin true then set pin for MDI command probe
I'm not sure how the probe command works, if it sets an offset or changes home or if it just triggers and you have to do the rest. But you get the idea.
John programs ladder too and maintains the EMC docs so he may comment here.

Chris

Big John T
10-29-2008, 10:07 AM
The O codes are for in your g code file. Are you sure the quote from the Integrators manual is correct? It should say for less complicated tasks....

John

chazmtu
10-29-2008, 02:17 PM
I'll have to install classic ladder to try it out. It sounds a little over my head though. I might save it for my last resort. All the probe move does is move til it hits something and record its position. What I want to do is, jog to where I want my x,y origin to be > set up my touch off plate > press a button > and whalla! my coordinates are set and all I have to do is start my program.

I double checked the integrators manual and it says, "Sometimes the user wants to add more complicated tasks to be performed by the activation of a
HAL pin. This is possible using the following MDI commands scheme"
That's why I expected something more customizable like running a few lines of g code or logic functions.

As for the O codes, I thought they were used on a line by themselves. So they're used in place of a value in a G code line instead? How do you think I could use that to squeeze two lines of g code from one MDI command? Calling a file seems like my best bet. I'll try running a simple o code statement tonight just to see if I can get one to work.

As an alternative, would the hal file accept if then statements? I'm a little fuzzy on weather or not it flows like a regular programming language, or does it just keep track of pin connections? whew.. My laptop battery just died and this is still here. Thank you vista. On a second glance, is that what ladder logic is for, to add logic flow to a list of connections?

Thanks for being patient with me, this is a lot to take in. :) And to think, all I want to do is get one button to run two lines of g code so I don't have to press two buttons.

chester88
10-29-2008, 03:25 PM
your touch off plate is like a probe is it not? When the tool touches it it makes a connection/sends a signal? Then you could position manually X and Y and put Z just above your touch off plate. press the button to probe down in Z it records the trigger (and stops) then use that number to set Z (plus the plate thickness). Am I on the right track? You could try this manually in MDI right now to make sure it works id it does then we can make it work with a button for sure. It's the command to set Z by the recorded numbers that I am not sure of - I will have to look it up....

chazmtu
10-29-2008, 03:58 PM
Yeah, you got it. I'm not using the recorded value (parameters 5061-5069 save the position)from the touch probe though because I want to set the Z height to .25in every time. It takes 2 lines of code to run. The first one is the probe move (G38.2) and the second should reset any coordinates I like using (G10). The probe move works just fine but the second one resets my Z coordinate different than my given value. I probably missed something simple like an offset on the second one. Here's my code:

G38.2 Z-3 F16
G10 L2 P1 Z0.25

It would be nice to be able to run more in case I wanted to add on later.

Big John T
10-29-2008, 04:02 PM
When you jog to where you want the XY origin to be you do a touch off at that point. I'm not an expert but when you move over to your touch off plate you are setting the tool length offset based on the probe input... These sound like two different things to me.

John

chester88
10-29-2008, 04:02 PM
seems to me G92 z(plate thickness) would set the z cord. to zero for the bottom of the plate that the probe was stopped at. You would have to move the probe very slowly so it does not move much after triggering. If you use cutter compensation you could change the tool offset similarity. There is a sample for probing tool offsets under nc_file .
Again food for thought I have not tried this...

chester88
10-29-2008, 04:23 PM
Yes (if I understand this right) G10 sets an offset (the .25) on top of the existing offset of coordinate system(g54 in your case), Whatever that maybe.
G92 sets the the physical position you in now, of the current coordinate system (g54? for you) to whatever you specify on the line.
so G92 z .250 should do it.
John he is using the probe command just to stop at the top of his plate not to measure anything.

chazmtu
10-29-2008, 04:44 PM
Yes my probe is part of the tool. I am using G54. I'll give G92 a go let you know in a few if that's right. Here's a picture of my probe setup for clairification:

chazmtu
10-29-2008, 04:48 PM
Yep, The G92 command does the trick. Now I just need a way of issuing both lines of code using my z touch off button. :D

chester88
10-29-2008, 05:13 PM
well for a quick fix make two buttons one for 'probe', one for 'set Z origin' each connected to an MDI command thru HAL-UI. If you want the one button deal then set up classicladder to load with EMC and I'll help with the program- It should be trivial (the program).

Chris

chazmtu
10-29-2008, 05:20 PM
Sounds like a plan. I'll get some buttons setup. As for installing classic ladder I should be able to do an upgrade installation from the emc install disk right?

chester88
10-29-2008, 05:27 PM
No. Classicladder is included with EMC. You need to add loadrt classicladder_rt and loadusr classicladder myfile.clp to your HAL file and add classicladder to the servo thread. Then when you make a program save it with the same name as myfile.clp and it will load when classicladder loads. What version of EMC are you using?
there are some online docs for classicladder 7.10 (comes with EMC 2.2.x to 2.3.x) here:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadder

chazmtu
10-29-2008, 06:28 PM
I'm running version 2.2.6. I'll try the command line way. I thought it wasn't installed because the gui option was shaded out with emc running. But thats for after classic ladder commands are in my hal file? So my code should look something like this:

loadrt classicladder_rt
loadusr -w classicladder --myfile.clp
loadrt classicladder_rt servo

Not sure about that last line.

chester88
10-29-2008, 06:42 PM
No last two not quite right.
no '--' before 'myfile.clp'
last line should be
addf classicladder.0.refresh servo-thread
here is HTML docs for the loading the new version of classicladder most things are the same:
http://www.linuxcnc.org/docs/devel/html/ladder_classic_ladder.html#r1_11

chester88
10-29-2008, 06:47 PM
oh sorry the first line should be loadusr -w classicladder --nogui myfile.clp
then you use axis to open the GUI like you said.
There is a bug that when you go to save your ladder program you will have to use save-as not save.

chazmtu
10-29-2008, 06:55 PM
OK I'll give it a try tonight. I should be able to get most of it going. Thanks

chester88
10-29-2008, 06:57 PM
You bet . When you finish and prove the concept I'll add it to the EMC wiki . I gotta say thats pretty damn cool!

Big John T
10-30-2008, 10:13 AM
I should have read page 3 :) before replying

John

chazmtu
10-30-2008, 06:06 PM
Well I have two working buttons so far and have classic ladder load in my hal file. My only problem was I couldn't get into the ladder editor from the file menu. I did get in through the hal configuration screen and It looks like that will work. All I need is a ladder program and I should be all set. Do I have to make a file before I can open the editor from the file menu?

Big John T
10-31-2008, 10:39 AM
What did you put in your hal file exactly? There should be three lines related to classicladder.

The editor should be enabled in your menu.

I see a mistake in the classicladder section that I will correct tonight.

I assume your using 2.2.6???

John

chester88
10-31-2008, 09:41 PM
Classicladder should open regardless if there is a file or not. If you run EMC from a terminal
screen, you may see an error message to let you know whats wrong. The realtime module has to be loaded before the user program. (i'm not sure where you added those comands to)

On another note: I think you'll need to connect 5 signals to classicladder:
1 for each MDI command (out)
1 to motion.motion-inpos (in) to let you know when the probing is done
1 to the your pyvcp button (in)
1 to halui.mode.is_mdi (in) to let you know when in MDI mode

In my head the ladder program should work like this:
when the button is pushed AND EMC is in MDI mode send command 1
after the command 1 has been sent wait for motion to stop then send command 2
You may want to get fancy and send a third command to rapid away from the plate

Did you added HALUI=halui to the [HAL] section of your ini file?

chazmtu
11-01-2008, 12:57 AM
I put this exactly in the top of my custom.hal file:

loadrt classicladder_rt
addf classicladder.0.refresh servo-thread
loadusr -w classicladder --nogui mybuttons.clp

I have version 2.2.2 but I'm upgrading to 2.2.6 right now. I ran the command from a field inside emc so I assumed classic ladder was loaded from my .hal file. I did add HALUI = halui into my .ini file. I'll let you know if the upgrade makes a difference.

As for the program, are the 5 signals added as n.o. switches and outputs like in the link you sent? If so, how do the %I0 type variables trace back to hal pins? I like the idea of having the tool back off after the offset. Last time I ran a program the tool lightly scratched the touch off plate.

chester88
11-01-2008, 01:52 PM
Look here for an idea for the ladder program:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadderExamples
It roughly explains it. I tried the ladder program by just clicking buttons did not try it with MDI commands so test carefully!
%I variables are connected to HAL pins named classicladder.0.in-xx
%Q variables are connected to HAL pins named classicladder.0.out-xx
The variable number and the XX corespond eg %I0 is classicladder.0.in-00

Big John T
11-03-2008, 11:53 AM
You have the hal correct. I suspect that upgrading to 2.2.6 will "fix" things with the menu...

Some examples that explain classicladder are here. This is 2.3 unreleased docs but this part is similar enough to get the gist of it...

http://www.linuxcnc.org/docs/devel/html/ladder_ladder_examples.html

chester88 are you on the irc?

John

chester88
11-04-2008, 12:59 PM
Hey John not usually though I sometimes read the logs.
I am on Vacation for a week in mexico.....
but you have my email

Chris
I wonder if he got this to work...

chazmtu
11-05-2008, 10:04 PM
Sorry for the silence. It's exam week for me. I'll have some time tomorrow and friday to figure this out. The update didn't fix my problem but I can still get into the editor.

Chester88, in the link you sent me with program examples how did you get the extra room near the bottom (the part with the black bar)? I though there was a window for setting the number of variables was that it? I'll have to look tomorrow evening. Also, once I saved what I had I couldn't load that file back into the editor. It did save the file though. Think there was some problem with my emc install? There wasn't any errors when I installed. It is an old system though running the minimum hardware requirements. It's a bit hard to catch on to classic ladder with so many problems but I'm getting there.

Big John T
11-06-2008, 09:54 AM
After talking to the programmers of EMC I learned that the gui menu will not come on if you load classicladder in the postgui.hal... as the menu is already created... I'll fix the manual this evening. So you need to move the three classicladder lines to the main hal file and the menu will work.

John

chazmtu
11-07-2008, 02:13 PM
Thanks John, I've got classic ladder in the gui working now.

chazmtu
11-08-2008, 02:59 PM
OK, I'm almosts finished but I'm getting an error that I can't figure out. My postgui.hal file looks like this:

#set up the z-axis touchoff button
net remote-z-axis-touchoff classicladder.0.in-00 <= pyvcp.z-axis-touchoff
#set to mdi mode
net halui.mode.is_mdi => classicladder.0.in-01
#wait for motion to finish
net motion.motion-inpos => classicladder.0.in-02
#mdi command 1
net z-touchoff classicladder.0.out-00 => halui.mdi-command-00
#mdi command 2
net z-zero classicladder.0.out-01 => halui.mdi-command-01
#mdi command 3
net rapid-away classicladder.0.out-02 => halui.mdi-command-02

my ladder program is set up just like chester88's example. I get an error like "signal name 'motion.motion-inpos' must not be same as a pin." when trying to start emc. Any suggestions? I'm moderately sure the rest of my postgui code is right.

chester88
11-08-2008, 08:07 PM
ok try:
net in_pos motion.motion-inpos => classicladder.0.in-02
bet you got an error for:
net halui.mode.is_mdi => classicladder.0.in-01
try:
net mode halui.mode.is_mdi => classicladder.0.in-01

these two lines you did not specify signal names

chazmtu
11-08-2008, 11:22 PM
Yep you were right but now I get a new error," 'halui.mode.is_mdi' does not exist". If I understand correctly it controls a bit that is true when I'm in the mdi window in axis? I was using the mdi command buttons in auto mode too, any reason why we can't do without it?

chester88
11-09-2008, 01:05 AM
You added HALUI=halui to the ini file? I would bet this is the first line that tries to connect to halui pins? yes?
can you show the pins to if halui has been loaded? (add 'show pin' to your HAL file)
I see another way to load halui is to add:
loadusr halui -ini /path/to/inifile.ini
to your custom HAL file (change the path to whats apropriate)

chazmtu
11-09-2008, 01:57 AM
Yeah I added HALUI=halui in my .ini file, and it looks like the first to try to connect to halui pins. I tried your alternate way to load halui with the same results. I don't understand the show pin thing though. I put that alone in my hal file? I still get the error when I do that. Does "halui.mode.is_mdi" refer to a line the halui section of my ini file because all I have is HALUI=halui and my three mdi commands.

chester88
11-09-2008, 11:08 AM
sorry I should have been more specific:
add the show pin line before the line that errors.
run emc in a terminal window (open a terminal window and type emc)
then when it gets to that line it should print out all the pin names.
then check to see if the halui pins are present.
If not then that is the problem.
I am not home for a few more days so i don't have a linux box available to help you
much. maybe John will see this thread and join in again....

chazmtu
11-09-2008, 02:19 PM
Neat trick. It lists the pin as halui.mode.is-mdi instead of is_mdi so I changed it and emc will boot now but the button still does nothing in manual or mdi mode. The console does show an error though:

ULAPI: WARNING: module 'HAL_classicladder' failed to delete shmem03

chester88
11-09-2008, 02:41 PM
The error is prob not a problem, pretty sure it about when the GUI closes that it didn't
erase the shared memory and we don't want it to.
can you open the classicladder gui and see that your program is loaded and that the pyvcp button registers on and off in classicladder?

chester88
11-09-2008, 02:59 PM
sorry about the pin name error - the wiki is wrong-I will fix it later the manual is right though.

chazmtu
11-09-2008, 02:59 PM
Actually I just checked that using halmeter. The pyvcp button registers as well as the two classic ladder inputs. The mdi command pins don't when I press the button. I can't find a way to measure the %B0 and %B1. Do they always start false?

chester88
11-09-2008, 03:03 PM
you need to open the classicladder gui and click vars button then you can see the %B0 and %B1 variables plus watch the ladder logic work

chazmtu
11-09-2008, 04:08 PM
All I get is a blank window. My machine is having trouble updating buttons on so many windows. I think its locking up when I load my ladder program. I'm gonna give it another couple tries though.

chazmtu
11-09-2008, 04:25 PM
OK here's what I get. %I1 and %I2 are on when I start and %I0 is on when my button is pressed but I cant see any change in %B0 or %B1. There's no change in any of the outputs either.

chester88
11-09-2008, 04:47 PM
ok but you haven't told me if the ladder program is present-the last post said it was blank. I need clear info. If you dont see the program then it is not loaded and nothing will work :) If that is true you could try to load it from the classicladder window. I would bet the ladder program is not in the right directory or else the name is different from what you added to your HAL file. You remebered to add the .clp to the end of file name?

chazmtu
11-09-2008, 05:20 PM
My ladder program is in the same directory as my .hal and .ini files and I double checked the spelling in my hal file. What I meant was when I load my ladder file into the Classicladder gui, the buttons and fields in the classicladder windows don't appear. I can still hit them and bring up whatever the button in that place would do but I cant see the checkmarks in the vars window. Is there another way to check if my classicladder program is running?

chester88
11-10-2008, 02:14 AM
ok i understand u are getting to the limit of computer power....can you put Hal meter on classicladder.0.out-00 and see if it changes to true. It will not change for long and that may be the problem...Sorry when I get home i can try a few more things.

chazmtu
11-10-2008, 09:48 PM
I didn't see it change. I tried it with hal scope also with classicladder.0.in-00 and classicladder.0.out-00 as my signals so I could see better but no change in output when the button was pressed.

Big John T
11-11-2008, 09:53 AM
chazmtu, can you zip or tar up all of your config files and post it online somewhere like http://filebin.ca/ this way I can see exactly what you see... sometimes six eyes are better than two :)

John

chazmtu
11-11-2008, 02:26 PM
Here you go. my-mill.zip (http://www.mediafire.com/?sharekey=45cf528f02ad8e56d2db6fb9a8902bda)

acondit
11-11-2008, 02:37 PM
I don't know what you zipped but all of the files appear to be zero length.

Alan

chazmtu
11-11-2008, 03:03 PM
Thanks! Here are the new configuration files (http://www.mediafire.com/?sharekey=45cf528f02ad8e56d2db6fb9a8902bda)

Big John T
11-12-2008, 09:59 AM
chazmtu, I didn't get a chance to download the file this morning... I have it now and will look at it this evening when I get home unless someone else spots it first...

John

chester88
11-12-2008, 12:03 PM
After a quick look I see that Classicladder will not (from the comand line) load a filename with a space in it. Your ladder program is called 'touch_off Button' rename it 'touch_off_button' and the ladder program will load and then you will see the ladder program when you bring up the GUI from AXIS. after that the pyvcp button did register in classicladder but I don't have any hardware hooked up so not sure if the probe comand was given. I will keep working on it.
P.S. using filenames with spaces is never a good idea when using Linux.

Big John T
11-12-2008, 12:49 PM
YEA! chester88 to the rescue...

John

chester88
11-12-2008, 01:47 PM
Ok I did a little more testing and the commands are not getting called because Classicladder doesn't hold the outputs on long enough. We need to add a MONOSTABLE object for a couple of the output lines. I set them at 500ms. I uploaded a new ladder drawing here:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadderExamples
We are real close now- axis shows my tool probing down looking for the probe signal.Of course I don't have one so I don't know if the rest of the program works.
I suggest that you test this by touching the ground wire on the tool instead of letting the tool touch the plate-just to make sure if it doesn't stop the tool won't be broken.
When you know it works then test with the plate as usual. I'm sure you are doing something like this I just want it recorded so other people read the warning :)

Cheers Chris

chazmtu
11-12-2008, 02:11 PM
Awesome!! Thanks, I'll give it a try right now. :)

Big John T
11-13-2008, 07:22 AM
chazmtu,

I took a look at your confg and noticed that you have multiple circuts in one rung. I don't think that is good form and am not sure how classicladder likes it. Most PLC's won't accept that. http://filebin.ca/gadzzw/zone.zip is the files I modified to make it do two steps so you can see how it can be done. The second step is based on a timer as I could not find anything to trigger the completion.

The thing you need to remember when doing ladder is how a PLC works...
1 Read Inputs
2 Solve Logic
3 Updates Outputs

and the golden rule of PLC's "the last output wins" which means you can only have one coil per address with the exception of set and reset.

John

chazmtu
11-13-2008, 02:58 PM
I see. I didn't know you can't have more than one circuit per rung. Some classic ladder examples in the wiki have multiple circuits and coils, that was the example file there.
I can't get these files to run either though. HAL meter shows %I0 true when my button is pressed. The MDI mode switch was true also but no output on the first coil. Chester88 mentioned the values not being held high long enough. He added a timer to the example he posted here (http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadderExamples). I'll give it a try, might take a while though, my machine has trouble running the ladder editor.

chester88
11-13-2008, 06:09 PM
You could run Classicladder without EMC to rewrite the ladder program- It would use less computer power.
in a terminal type 'halrun'
then type 'loadrt classicladder_rt'
then 'loadusr -w classicladder'
then use classicladder's load button to load the program to modify
and then save it after you modified it.
You can't run the program this way cause you haven't hooked up signals or added a thread but you can edit the ladder program.
Or I can send you the file.

chazmtu
11-13-2008, 08:37 PM
If you don't mind sending me a copy. I'm getting tired of this fossil. :tired: I think its time to start looking for some better hardware. Other than that classic ladder file I should be all set.

chester88
11-13-2008, 11:58 PM
ok try this:
http://filebin.ca/ngshze/Touch_OFF.clp
rename it to your ladder program name.

Big John T
11-14-2008, 10:22 AM
I see. I didn't know you can't have more than one circuit per rung. Some classic ladder examples in the wiki have multiple circuits and coils, that was the example file there.
I can't get these files to run either though. HAL meter shows %I0 true when my button is pressed. The MDI mode switch was true also but no output on the first coil. Chester88 mentioned the values not being held high long enough. He added a timer to the example he posted here (http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadderExamples). I'll give it a try, might take a while though, my machine has trouble running the ladder editor.

I see that the examples have more than one circuit, I guess ClassicLadder does not care...

The reason your computer is having trouble running the ladder editor is your base period is too small. The computer spends all it's time cycling the base period and has no time left for other things. In the example you sent me I had to change the base period so I could run it on my computer. Create a new directory and put all the files I sent you in there plus any I didn't send from your original directory and up the base period until your computer quits choking and run it again...

If you want to do it through the stepconf wizard then up the latency test number then save it and test. Try a number that will give you 30000 to start.

John

chazmtu
11-14-2008, 12:11 PM
Thanks for the files and for mentioning my base period, I forgot all about it. I knew it need some serious tweaking but It got pushed aside when we started this. Hopefully that will get me a little performance boost. I'll let you know pretty soon what I come up with. I think I'm starting to get a feel for how the config files work now.

chazmtu
11-14-2008, 01:18 PM
OK, here's where we stand. The first two mdi commands run flawlessly every time. The third ran once out of 10-15 tries. Since its the only output without a monostable output I'm gonna add one after the timer and I think we should be all set.

As for my base period, I took your advice and set it up to 30000 and It does run better but classic ladder still too slow to use with axis running but the manual method is tolerable. I'll have to do some testing for that later.

I also bought a laser crosshair module off e-bay for zeroing the x and y axis. Luckily that button will be easy to set up. After that I think I owe you guys a youtube video of our work in action for all your excellent help. Looks like I might be done before the day is through.

Big John T
11-14-2008, 02:09 PM
chazmtu, as they say down in Arkansas... SWEET!

John

chester88
11-14-2008, 07:26 PM
Yes of course the last output needs a monostable - LOL - sorry I should have caught that! Glad to hear this works. I am wondering how accurate/repeatable the touch off is- I imagine for routing +- .005 would be fine.
John Thanks for mentioning the one circuit one rung deal. I have come across this problem on another project with out knowing what the trouble was!
Chazmtu congrats you are the first person to have this feature on a machine!
I am glad you kept at it and got it to work - I will add it to the wiki and I would bet John will add it to the manual.
Will love to see the video.
Chris

chazmtu
11-14-2008, 08:46 PM
IT WORKS!!! :cheers: I attached a copy of my config files. USE AT YOUR OWN RISK! IT HAS A FEW BUGS. Some of the statements below are for anyone who wanders in later on. Any idea's on how to get rid of the bugs? They're a little strange and potentially destructive. I was thinking the in_pos pin changing states from jogging might start the center of the program on the third circuit down, though it shouldn't with %B0 being open.

Known Bugs:


If I jog the Z axis up and switch to MDI mode, it automatically runs the program. This was repeatable in that session but when I restarted EMC , it stopped. I haven't been able to repeat it since.
If I jog the Z axis up after pressing the button in MDI mode, it either runs one or several very short probe moves and returns the error 'G38.2 Probe move finished without tripping probe' (probe move is mdi command 1) for each move, or it will run the last two commands which set my Z height to 0.25in then rapid up 0.75in. The choice appears to be random.


Tips:

The button won't work if your not in MDI mode.
Don't use large rapid values for the third MDI command because of the bugs mentioned above.
Use small distances for the probe move. If the probe extends beyond your machines soft limits the button won't work.
NEVER jog the Z axis after pressing the button. You don't want to damage your machine.
See the HALUI section of my-mill.ini for the code ran by the button.

chazmtu
11-14-2008, 08:55 PM
Thanks very much for the help! I learned way more from this than I would have thought. I didn't expect it to take so long. I don't suppose you would have any problem with me linking my site the wiki? I might keep working on this.

I don't really have a way to test the repeatability, though +/-.005 is probably better that my machine can get right now. Make sure to add a warning to the wiki, someone could probably do some real damage it they're not careful.

Chuck :)

chester88
11-15-2008, 12:38 PM
Hmm the program should never run unless you are in MDI and you have pushed the pyvcp button. Can you put a Halmeter on the pyvcp signal and see if it is ever on when it shouldn't be on? Feel free to link the sites
Also when you say you jog z after pressing the button do you mean that after pressing the button and letting it finish probing if then you jog (by switching to manual or by using a MDI command) it starts to probe again?

chazmtu
11-15-2008, 03:08 PM
Yeah I'll take a look with halmeter and see whats going on. If I press the button in MDI mode then switch to manual and jog the z axis then I get some trouble. It'll either probe again or run the last two commands.

chazmtu
11-15-2008, 04:06 PM
I couldn't see halmeter change i think the pins change too fast. I'm gonna try a few more times. I had a different problem this time though. I was in manual mode with the x axis selected and pressed the button. Nothing should happen but My machine jogged to x= -2.635 as a result. :confused: That's not even in the program.

Big John T
11-17-2008, 10:12 AM
chaxmtu,

I'll take a look at your config this evening and see if I see anything. I might hook up my other BOB so I can simulate the input of the probe...

John

chazmtu
11-17-2008, 01:47 PM
It might be easier to just substitute a different g-code for the probe move like G0 Z-1. That way you won't need a probe and the in_pos function will wait for that movement to stop instead.

I was thinking maybe it's variable I used in my postgui.hal file. Once in class I made a mathcad file called length, and it screwed up mathcad because it also has a hidden file named length in my home directory. Just a thought, I don't know if that's possible here or not.

chazmtu
11-17-2008, 02:24 PM
I fixed it!! I have no idea how though. The only thing I did between now and when I had problems was add another MDI comand button.

acondit
11-17-2008, 06:11 PM
OK, now zip it all up so we can copy :)

Alan

chazmtu
11-17-2008, 10:43 PM
Here you go. The z-touchoff button works the same as before. I added a second button to reset the X and Y coordinates in relation to a laser crosshair. You can adjust the g code to fit your machine in the halui section of your .ini file.

I should have my laser set up tomorrow. Then I can make a short video of the whole setup in action. Enjoy.

acondit
11-18-2008, 11:08 AM
Chuck,

Thanks, I'll take a look at it and see if I can figure out how to make it work for me.

Alan

chazmtu
11-18-2008, 05:08 PM
Glad it can be of use. :) I've got mine running now with laser and all. Works pretty good but the gcode used to set the coordinate system offsets will add every time you press the button. For now there's an easy fix. My cam program has a setting to add code to the beginning or end of my gcode files (I use cambam). Just add G92.2 to the end of your gcode files and it will erase the offsets when its done running. OR we can add a 'clear offsets' button? In the meantime I'm looking for a way to change the machine position without using offsets. A futile endeavor I think.

Let me know if you experience any bugs like I listed before. I think they're happening when my base period is too low. Its probably just my computer, It has some realtime performance issues. It will soon be retired though.

I'll see if I can get a video posted tonight.

chester88
11-20-2008, 12:37 PM
Do we get a video soon ? :)
What kind of laser system are u using?

chazmtu
11-20-2008, 12:48 PM
Yeah I'm working on the video today. I was thinking of working on tool changes using my touch off plate. That would be a different video though.

I'm using a $3 laser crosshair from ebay. The lines it makes are a little thick but they'll do for a machine like mine. Right now I just have 3AA batteries and a switch attached but I'd like to power it from my parallel port. It only takes 5V and ~35mA

chazmtu
11-20-2008, 07:22 PM
Here it is. A VIDEO!! Sorry it took so long. I think it covers the basics. Hope you find it interesting. In all, I think this is pretty much what I wanted when we started. I've seen similar setups with mach and now we have it for EMC. Thanks guys for being patient with me.

chester88
11-20-2008, 11:02 PM
Hey chazmtu

That is really cool. way to keep on it! I added a link to the video on the wiki.
Hey could you add a cancel offset MDI comand to the beginning the ladder program ?
This was fun!

Chris

chester88
11-21-2008, 02:32 AM
I pretty sure I know why you had trouble before with the MDI commands running multiple
times. I updated the ladder program here:
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?ClassicLadderExamples
#Single_button_probe_touchoff
You should update your ladder program.
cheers

chazmtu
11-21-2008, 03:01 PM
Thanks chris,

I'll add a new button today. I'm starting a small run of signs this weekend so I'll get to see how this works out several times in a day. I'll be sure to update my ladder program first though. Thanks again for all the help, I think we have a useful function here. I wonder If anyone else has this working yet? I'd like to see some other uses people come up with.

I'm gonna start just posting the new version on my website until I'm sure there's no more changes to be made, then I only have to worry about one link. Once it's all worked out I'll post it in the downloads section here on the forums. I think we're pretty close to that now anyways. :)

Chuck

chazmtu
11-25-2008, 05:45 PM
Ok, I almost have it worked out but having some trouble with the last bit. I updated my ladder file and added a clear offsets button that runs g92.2 so the offset is canceled but the variables remain. Then I added another button that restores the previous x and y offsets by running "G92 X[#5211] Y[#5212]" (number variables are the stored x and y offsets from my .var file). My problem is when I press the Restore button it sets my coordinates the same as the X-Y Zero button. Two presses gets me the previous position like I wanted. Is there a variable for the current position in G54? I already tried "G92 X[X+#5211] Y[Y+#5212]", I thought maybe there's a current location variable I can add to the offset to get the previous position, but haven't found it. If not I'll just make classicladder run it twice but I'd like to minimize the number of offsets I stack.

Here's what I was doing. So far If I wanted to use more than one tool I had my g code footers move the tool to the position it was before I initially hit the X-Y Zero button. That way I can clear the offsets, change the tool, do another touch off, and when I press the X-Y Zero button again, I don't lose my position. Then I can load the file for the next tool and proceed. I tried using an automatic probe move so I can get everything in one file but EMC didn't like that. I don't recommend trying that again. The point is to use as many tools as I like without worrying about my offsets adding up. It worked but wasn't very user friendly.

Here's how I want it to work. The parameters for the offsets are never erased unless I run G92.1. My clear offset button only turns the offsets off but doesn't erase the variables. When EMC is started the previous values still exist unless your last file runs G92.1 which is my intention. Otherwise you can hit "Clear Offsets" before you start. Now Jog the laser to where the origin should be, and hit "X-Y Zero". This replaces the offset variables with new ones. Next comes the "Touchoff" button to get the tool height. So far everything is as before and we run the program for the first tool. The last button comes when you want to use a second/third tool. Hit clear Offsets and It does so. When you hit "Restore X-Y", it does exactly that. Your coordinates are right where they were for your next file only we got rid of the Z offset. This is just like a selective G92.3. Now do another Touchoff to get the height for the new tool and start it's file. Then we should be able to use as many tools in a row without any problems.

Once I get that button working right I'll upload it for everyone.

Chuck

DeanP
03-31-2009, 09:03 PM
Chris/Chuck:
Are you guys still around? I've been trying to implement your one button touch-off and can't seem to make it work. Here's my progression to this point:

I've updated to 2.3Beta and ran the stepper wizard at which time I added the ladder app for E-stop using both the hardware and EMC soft e-stops. When I ran EMC (AXIS) everything worked great. Getting a little cocky at this stage, I decided to learn something about classic ladder and tried to add ladder programming to the existing e-stop ladder to implement the one button touch-off shown in the Wiki example. Well, since my lame attempt at adding the programming I found in this thread, I can't get EMC2 to load. I even started from scratch and used just the files listed in the thread without any contamination by the e-stop ladder program. That doesn't work either. The closest I can get to start-up is an EMC debug error stating: custom_postgui.hal:13: pin ‘motion.motion-inpos’ does not exist. There is a line in the custom_postgui.hal file: “net in_pos motion.motion-inpos => classicladder.o.in-02” but that is the only reference to that signal/pin that I can find anywhere including the .hal and .ini files. I’m a rank beginner here and don’t know where to go next. I can’t seem to find anything to help me in the Hal docs either.

Any ideas?

Thanks.
Dean

chester88
03-31-2009, 09:38 PM
I'm checking on it... that pin should be there....
Chris

chester88
03-31-2009, 10:13 PM
The pin is missing/removed.
try changing motion.motion-inpos
to motion.in-position

Tinkers
08-25-2010, 10:47 PM
Hi,
I and attempting to install this aoto Z program following this thread & followed as close to the instructions as with my limited understanding...
After some debugging & loss slept for a whole week, I finally manged to get it work partially.

I understand the correct behavior of the Z-axis is
1) z-axis move down upon clicking the Z-touch off button
2) Z-axis stop upon tool bit contact with the probe
3) retract to predetermined position (I set mine at 25mm)

But this ia what I got
1) The Z-axis move downward
2) Touches the probe plate (a blank PCB soldered a hook up wire which connected to the Probe pin in my BOB)
3) 3 thing happened simultanously,
a)the Z-axis Stop
b) Z coordinate reset to 1.5 (which is the thickness of my touch off plate.)
d) error massage display on AXIS screen "Probe tripped during non-MDI command."
4) then nothing happened

& from here on, nothing will happen when I click on the Auto Z touch-off button.

I'm totally stucked... Any help is highly appriciated.

Thanks in advance

Ken

chester88
08-26-2010, 01:03 AM
What have you done to make it work?
There are two fixes mentioned in the ladder example.
please post your ini hal and ladder files (or just post the whole config)

Chris

Tinkers
08-26-2010, 02:34 AM
Hi,
Initially, I tried to set up from scratch & after loosing half my hair, I realised I know nuts about ladder & barely enough of integrating classicladder... so I shamelessly put on my copycat hat & re-engineered what chuck did...
Attached are 113451.
I did corrected the motio.in-position

Tinkers
08-26-2010, 02:53 AM
SOLVED!!!

I rechecked & realised I did not connect the C & E pin...
Connected the 2 pins togeter & everything worked seamlessly EVERYTIME!!

Thanks for the head up!

chester88
08-27-2010, 03:19 AM
My pleasure. Thanks for sticking to it!

Tinkers
08-27-2010, 04:52 AM
Don't know how I had live without this auto touch off feature for so long...

I can' thank chuck & the gang for generously contributing to this fantastic thread, I had learnt so much about pyVCP & classicladder, well.. not enough to create my own program but at least just enough to copycat what you had done here.

Cheers! Keep up the great work!.

spokes
12-13-2010, 07:46 PM
I've been following this thread and decided to implement this into my build. However, I cannot get the button to do anything. Right now I just want to program a custom button in pyvcp to run the Gcode G38.2 Z-3 F16. I have the button and have edited the ini adding MDI_COMMAND = G38.2 Z-3 F1 to the appropriate location. I can start EMC2 with no errors and the button is present. However, when I press the button in MDI mode nothing happens. I can add the GCode into the MDI panel and select go and it will start the touch off ok. Once I get the button to work I will add others to touch off to .25 and raise Z. After this all works I will start working on the Customladder but just want to see the buttons do something first.
What am I missing?
Dan

chester88
12-13-2010, 08:27 PM
you don't give enough info. please post your HAL and INI and classicladder file
Chris M

spokes
12-13-2010, 08:46 PM
Never mind, I got it. I missed the <= command in the custom_postgui.hal
I now have three buttons working. One to do the touch off, one to set the offset, and the third to rapid z to 1". I'll leave it at this for awhile, I want to study up on the Classicladder.
Dan

spokes
12-14-2010, 05:52 PM
Now I'm trying to configure the three actions into one button. I'm using the copy and paste method from the known good config.zip near the end of this thread to edit the files but get an error and EMC aborts launch. The error message is in the my-mill folder. I have put the stepconf file in there as well.
I removed the following line from the custom_postgui.hal and the EMC starts. It also appears that the functions are working but I don't have it connected to my table right now and can't test this. I will hook it up tomorrow.

line removed .... net in_pos motion.motion-inpos => classicladder.0.in-02 There must be a syntax error or something else causing this line to fail. Any ideas?

Thanks,
Dan

chester88
12-14-2010, 08:53 PM
Yes read the whole thread! :)
try changing motion.motion-inpos
to motion.in-position
it was changed in EMC quite awhile ago.
I guess the wiki needs updating....
glad your getting it working.
upload a video when your done.

Chris M

spokes
12-14-2010, 08:56 PM
Chris,
Thanks for the quick reply.
The thread said to change it to motion.motion-inposition and I tried that it failed. I will try changing it to just motion.in-position
I've read this whole thread about 6 times now by the way.
I tried motion-in.position, motion.motion.in-position, and several other variations of this but still get the error.

chester88
12-14-2010, 09:17 PM
I was just teasing you a bit. You must have missed it on page 9.
Actually I am assuming your using a current version of EMC.
pre EMC 2.3 the pin is call motion.motion-inpos
EMC 2.3 and beyond the pin is call motion.in_position

Chris M

spokes
12-14-2010, 09:23 PM
I'm still getting the error motion.in_position pin does not exist.
I'm using the latest Ubuntu 10.4 and EMC 2.4.6
Sorry to be such a pain but I'm very close and if I can get this last thing fixed I should be ready to go.

Ok, I deleted the whole line and retyped it after looking up the correct syntax (motion.in-position) and it started. Maybe I have it now. I'll try it on the machine tomorrow and see if it works as planned. If so I will create a video and post it here along with my config files for the 2.4.6 users. I will wait on the video until I get my laser cross hair and configure that offset.
Thanks for the help, I must have added a space somewhere or something.
Dan

chester88
12-14-2010, 09:43 PM
not a pain.
sorry I typoed the second time.
motion.motion.in-position

in-position not in_position

you can use halmeter to look for the pin name on a running config.

Chris M

spokes
12-14-2010, 09:47 PM
not a pain.
sorry I typoed the second time.
motion.motion.in-position

in-position not in_position

you can use halmeter to look for the pin name on a running config.

Chris M

Yes I saw it was correct in the page 9 post and in your first reply but different in the second reply so I went directly to the WIKI page to get it. I decided to delete the entire line and retype it and it worked. As I said, I think I had an extra space somewhere.
Thanks again Chris,
Dan

spokes
12-15-2010, 04:27 PM
Well I put it to the test today and the first two functions worked once but the third (Z retreat) didn't run. When attempting to run it again nothing worked until after restarting the program.
For now, I am just going back to three buttons. I'll tackle this again when it is warmer, the shop is cold.

spokes
12-15-2010, 09:34 PM
I put together a parallel port switch on a test PC in the warm house and can now test where it is comfortable. When I hit the home button it will run once and stop when I push the button (same as probe touch). The offset goes to .250 as it should but I don't get the z up to 1" I have set. Also the button will not do anything else until you turn the program off and back on again.
I have no idea how to trouble shoot this, I'm not getting any errors.
Any ideas?
Dan

chester88
12-16-2010, 08:30 PM
Please post your file, including the ladder file.

spokes
12-16-2010, 08:42 PM
Here is the zip of my files. I put the config file in there too. I've been reading up on HAL and the ladder all day but haven't quite been able to get it to sink in.
dan

chester88
12-16-2010, 11:36 PM
In the ladder program , The timer T0 (second rung) needs to have the E and C pins connected.

Chris M

spokes
12-17-2010, 08:45 AM
Ah, this was mentioned before by Chuck. I figured since he got it fixed his config files would be correct. I just copied his files. Now since I haven't figured out the ladder program the challenge will be figuring out how to connect the pins.
Thanks for the help.

spokes
12-17-2010, 10:45 AM
I managed to muddle my way through the editor and have successfully connected the pins C and E. The program runs perfectly on my test unit and I will modify the computer that does the actual CNC control this afternoon. Thanks so much for the help Chris. Thanks to Chuck too for all the work he put into getting it figured out in the first place. Once I get my laser cross hair I will take a video and link to it here. Also, I will create a step by step instruction sheet for others so they can do this even if they have no experience with programming (like me).

chester88
12-17-2010, 05:23 PM
Hey no problem glad you stuck with it.
I should update the ladder example in the wiki.

the latest thing about this is i am trying to make it possible not to have to use g92 offsets
G92 offsets kinda suck as it changes ALL the coordinate system offsets.
It can be confusing some times with all the different types of offsets.

Anyways another command G10 L20 P1 would work better - it will change the offsets on one coordinate system only.
The problem with it is you have to tell it what coordinate system you are currently using, (thats what the P is for 1= g54 coordinate system) which in our example would have to be 'hard coded" to one system. If in the gcode you changed the coordinate system from the one you hard coded in the INI file then touchoff won't offset the right system.

If you only ever use one offset system (probably G54) I would switch to the G10 L20 P1 command.

I think eventually in the development version will will have a P number that represents 'current coordinate system'

Chris M

spokes
12-17-2010, 06:21 PM
I'll go ahead and change the offsets as you suggest. I never use the other offsets at least at this time.
I edited the CNC table machine today and the program ran perfectly. Sure makes it easier to hit 0 with the plasma torch. Makes your Gcode cut height much more accurate.
Once I get the cross hairs I will get a video out on how it works.
Thanks again Chris,
Dan

spokes
12-18-2010, 10:54 AM
I've created a document on the steps needed to get the buttons setup and working including options for the older versions (EMC 2.2.x and older) and the newer versions. The document is in the configfiles.zip file.
Chris, if you have time could you check this over to insure I haven't missed anything?
Hope this helps anyone else attempting to do this.
Dan

ecurb5
02-09-2011, 04:39 PM
I've created a document on the steps needed to get the buttons setup and working including options for the older versions (EMC 2.2.x and older) and the newer versions. The document is in the configfiles.zip file.
Chris, if you have time could you check this over to insure I haven't missed anything?
Hope this helps anyone else attempting to do this.
Dan

First, big thank you Chris and Chuck for their work on this.

Second, thank you Dan for the how-to doc included in your zip file. This is exactly what I was looking for, being a newbie and all... ;)

Now it's my turn to get this auto touch probe thingy to work... :D

spokes
02-09-2011, 05:02 PM
Good luck, it's been working well for me.
Dan

ecurb5
02-15-2011, 02:46 AM
Good luck, it's been working well for me.
Dan

Ok, finally got around to adding this to my setup, and was presented with an error that I'm not understanding. Here's the debug info from the EMC2 errors window that pops up. Is this enough info to figure out what I'm doing wrong? :o

Debug file information:
insmod: error inserting '/usr/realtime-2.6.32-122-rtai/modules/emc2/classicladder_rt.ko': -1 File exists
custom.hal:8: exit value: 1
custom.hal:8: insmod failed, returned -1
See the output of 'dmesg' for more information.
28556
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

spokes
02-15-2011, 09:32 AM
Please post the entire error text, I can't tell what's going on from the info listed.

ecurb5
02-15-2011, 12:44 PM
Print file information:
RUN_IN_PLACE=no
EMC2_DIR=
EMC2_BIN_DIR=/usr/bin
EMC2_TCL_DIR=/usr/share/emc/tcl
EMC2_SCRIPT_DIR=
EMC2_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/emc2
EMC2_CONFIG_DIR=
EMC2_LANG_DIR=/usr/share/emc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
EMC2_EMCSH=/usr/bin/wish8.5
EMC2 - 2.4.6
Machine configuration directory is '/home/cnc/emc2/configs/my-mill'
Machine configuration file is 'my-mill.ini'
INIFILE=/home/cnc/emc2/configs/my-mill/my-mill.ini
PARAMETER_FILE=emc.var
EMCMOT=motmod
EMCIO=io
TASK=milltask
HALUI=halui
DISPLAY=axis
NML_FILE=
Starting EMC2...
Starting EMC2 server program: emcsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting EMC2 IO program: io
Starting HAL User Interface program: halui
INFO CLASSICLADDER- No ladder GUI requested-Realtime runs till HAL closes.
Shutting down and cleaning up EMC2...
Killing task emcsvr, PID=28556
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done

Debug file information:
insmod: error inserting '/usr/realtime-2.6.32-122-rtai/modules/emc2/classicladder_rt.ko': -1 File exists
custom.hal:8: exit value: 1
custom.hal:8: insmod failed, returned -1
See the output of 'dmesg' for more information.
28556
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

Kernel message information:
[268875.123578] I-pipe: Domain RTAI registered.
[268875.123592] RTAI[hal]: <3.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[268875.123597] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
[268875.123609] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[268875.123613] PIPELINE layers:
[268875.123618] fb904e20 9ac15d93 RTAI 200
[268875.123623] c085cb20 0 Linux 100
[268875.167574] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[268875.167815] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[268875.167825] RTAI[sched]: hard timer type/freq = APIC/6250069(Hz); default timing: periodic; linear timed lists.
[268875.167831] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1999835000 hz.
[268875.167835] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[268875.167997] RTAI[usi]: enabled.
[268875.322714] RTAI[math]: loaded.
[268875.465782] config string '0x378 out '
[268875.487755] creating ladder-state
[268876.378557] RTAI[math]: unloaded.
[268876.490988] SCHED releases registered named ALIEN RTGLBH
[268876.507416] RTAI[malloc]: unloaded.
[268876.604032] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[268876.612286] I-pipe: Domain RTAI unregistered.
[268876.612303] RTAI[hal]: unmounted.

spokes
02-15-2011, 03:05 PM
Did you load the following lines in your custom.hal file?

#load classic ladder
loadrt classicladder_rt
addf classicladder.0.refresh servo-thread
loadusr -w classicladder --nogui Touch_OFF_Button.clp

ecurb5
02-15-2011, 03:28 PM
Did you load the following lines in your custom.hal file?

#load classic ladder
loadrt classicladder_rt
addf classicladder.0.refresh servo-thread
loadusr -w classicladder --nogui Touch_OFF_Button.clp

Yep. Went through your how-to doc step by step. My 1st thought was that ladder was not installed, but isn't that installed as part of the package?

Btw, I installed emc2 on ubuntu 10.04 via the method:
http://linuxcnc.org/lucid/emc2-install.sh

as found here: EMC Documentation Wiki: Installing EMC2 (http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Installing_EMC2#On_Ubuntu_10_04_using_precompiled_EMC2_packages)

spokes
02-15-2011, 03:35 PM
I just used the 10.04 install that had EMC2 bundled with it.
I'm probably going to have to let Chris (chester88) work with you on this. He has been my savior when I had problems. Chris usually responds in a timely manner.
Try taking the lines out of your custom.hal and see if the error goes away. It sounds like it is trying to load classicladder twice. If you still get the error then you can look somewhere else. (put the lines back in in that case)

ecurb5
02-15-2011, 04:15 PM
Try taking the lines out of your custom.hal and see if the error goes away. It sounds like it is trying to load classicladder twice. If you still get the error then you can look somewhere else. (put the lines back in in that case)

Yep, commented them three lines out and emc2 came up with no problem. Even had the nice buttons on the right side of the screen. The zero x-y button worked flawlessly, but the z didn't work. I'll work on it a little tonight.

I used that manual install method because the iso wasn't available yet. Maybe I'll download the new iso and re-install it that way.

Thanks Dan.

spokes
02-15-2011, 04:17 PM
Keep in mind you have to use the Z button in MDI mode.
My guess is you have a different version of Classicladder due to the upgrade process. I think you're onto something with the idea of doing the complete 10.04 with EMC preconfigured. I seem to recall there is a different syntax for an older version of classic ladder. Look back in this thread to see if you can find it. That might do the trick without having to reload Ubuntu.

ecurb5
02-15-2011, 11:12 PM
Keep in mind you have to use the Z button in MDI mode.
:o A little egg on my face. I even read that a few times, and still forgot to switch to MDI mode.... DUH!!!!

Well, it works great once you put it in the right mode....

As for the classicladder thingy, I commented out the first 2 of the three lines added to custom.hal file and it loaded fine.

Thanks for putting up with me. :D

spokes
02-16-2011, 08:46 AM
:o A little egg on my face. I even read that a few times, and still forgot to switch to MDI mode.... DUH!!!!

Well, it works great once you put it in the right mode....

As for the classicladder thingy, I commented out the first 2 of the three lines added to custom.hal file and it loaded fine.

Thanks for putting up with me. :D

You're welcome, I got plenty of help getting my setup working and I'm just trying to pay it forward.

chester88
02-20-2011, 11:32 PM
looks like you guys figure it all out !
Nice job.

The old way of adding Classicladder was in the custom HAL file.
now stepconf can add it for you.
One must pick one of the two ways.

Chris Morley

epineh
02-22-2011, 02:57 AM
looks like you guys figure it all out !
Nice job.

The old way of adding Classicladder was in the custom HAL file.
now stepconf can add it for you.
One must pick one of the two ways.

Chris Morley

Cool, I haven't used my router for a while as the PC blew up (stupid free PC's) , sounds like I need to upgrade and check out the latest Stepconf !

Russell.

Connor
04-20-2011, 02:11 PM
I got this working.. But, I have a question.. How do you adjust the travel amount for Z ? My machine homes Z at the top and has 4.5" of travel..

Thanks, Connor

spokes
04-20-2011, 03:19 PM
In your ini file under HALUI change the value of Z for the MDI_COMMAND for that move

Connor
04-20-2011, 03:22 PM
In your ini file under HALUI change the value of Z for the MDI_COMMAND for that move

That's what I thought, I have it set for -4.5, but then.. I'm not sure if that's in mm or inch...

Thanks, Connor.

spokes
04-20-2011, 03:25 PM
That would depend on how you set EMC up initially.

Connor
04-20-2011, 03:38 PM
That would depend on how you set EMC up initially.

It's metric by default.. However, I always run it inches most of the time..

Also, I noticed once I use the touch off I can't use it again.. Not sure why.. it doesn't do anything ??

spokes
04-20-2011, 03:44 PM
Mine will work repeatedly unless the z exceeds the limit. This includes the offset done when performing the touch off. There is a command to clear the z offsets back to the homing values but I can't remember it offhand.

Connor
04-20-2011, 06:21 PM
Mine will work repeatedly unless the z exceeds the limit. This includes the offset done when performing the touch off. There is a command to clear the z offsets back to the homing values but I can't remember it offhand.

Okay, Changing to metric fixed the issue with it not reaching the plate.. However, it still won't allow me to touch off again after doing the first one. Is it suppose to retract the Z axis after the touch off ? If so, it's not.. it just sits on top of the plate.. and I have to jog it up manually.

Thanks, Billy

spokes
04-20-2011, 06:28 PM
Chester88 Chris will probably have to help you with debounce or possibly classicladder. I think if you go back through this thread you will see where the classicladder file has to be connected between two points. Can't remember them off hand.

spokes
04-20-2011, 06:30 PM
Here is the contents of the post. Sounds like your classicladder is hanging at the touch off.
In the ladder program , The timer T0 (second rung) needs to have the E and C pins connected.

chester88
04-20-2011, 07:32 PM
yes there were two changes needed from the original version

motion.motion-inpos to motion.in-position (in HAL file)

and the E and C pins need to be connected on the timer block (in classicladder)

I'm sure if you read the whole thread it mentions this.


Chris M

spokes
04-20-2011, 07:52 PM
Thanks Chris. I try to do what I can but I don't have the handle on things like you do.

Connor
04-20-2011, 09:16 PM
yes there were two changes needed from the original version

motion.motion-inpos to motion.in-position (in HAL file)

and the E and C pins need to be connected on the timer block (in classicladder)

I'm sure if you read the whole thread it mentions this.


Chris M

I missed that.. E and C are now connected.. however.. Sometimes end up with it reporting that that the MDI command is outside the Z's axis range now that I've converted it to metric.. What is a good rule of thumb to use for that value ? Oh.. and when it throws the MDI error, the only way to run the command again is to restart EMC unless there is a way to reset the ladder maybe?

Thanks, Billy

spokes
04-20-2011, 09:28 PM
When that happens to me I manually raise or lower z (jog) to put it in range, the z will then make a move which means the classicladder has completed. When that happens you can then run the touch off again.

Regnar
05-18-2011, 08:14 PM
Thanks for the great step by step instructions. Worked like a charm and took only a few minutes to set up.

I do have a question though. Is there a Keyboard Shortcut that I can assign these operations to. If not how would one go about giving a keyboard shortcut.

I ask because I can give my pendant any keyboard function. It will save me a lot of time walking around the machine to get to the mouse pad and hit the button.

spokes
05-18-2011, 08:18 PM
I'm sure there is a way but it's beyond my level of expertise. Maybe Chris (chester88) can assist you.

ab1
05-20-2011, 11:17 AM
Hi Folks,

I've been looking into extending the work that you guys have been doing to make it more flexible. What I'd like to do is add some spin boxes to allow adjustment of the z travel (both up and down) as well as travel speed and touch off plate thickness. I've been playing around with all of the different components of how I believe it should work and so far everything 'works' except when I try to tie it all together. The problem I am having is that only the first MDI command gets run. I've gone over all of the .hal and config files and can't see an issue there. I believe the problem is in the ladder logic but just can't seem to work out where I'm going wrong :/

I'll start by explaining what my thought process is:

// Get the Z down travel (I have a spinbox connected to motion.analog-in-00 so calling M66 E0 will then put the spinbox value into #5399 - this works fine)
M66 E0
// I then copy that result into #1 for later use
#1=#5399
// Get the Z down speed (Same as above except i get the value from E1 (analog-in-01)
M66 E1
// Here I use the previously saved slider values to touch off
G38.2 Z#1 F#5399
// Get the plate thickness (Same as above except from E2)
M66 E2
// Use the plate thickness variable to set the offset
G10 L20 P1 Z#5399
// Get the Z up travel (Same as above except from E3)
M66 E3
// Move up by the Z up travel distance
G0 Z#5399

I've attached the zip of the configs and clp i've created. I've done my best to read the manuals and learn how the ladder logic works but this has just got me stumped..

Any help would be appreciated.

Cheers,

Andrew

P.S. My end goal is to implement all of the 'common' touch off features through the PYVCP gui. That is Z down, X & Y left and right individual touch offs and X&Y 'circular' touch off methods.

chester88
05-21-2011, 03:17 PM
i think the problem is that the original classicladder program waits for the motion-in-position signal to change. This will only change if the MDI code has requested movement.
M66 does not so motion-in-position will not change and CL will continue to wait.

This was a problem for the second command in the original ladder program.
G92 does not command a axis move so no motion-in-position signal.
We get around this by using a timer to wait until the command is done.

i would suggest trying these two techniques. Use a timer for commands that do not move the axis and use motion-in-position signal to makes sure movement commands are finished.

It would be nice if we had a interpreter-is-idle pin ....

Chris M

ab1
05-22-2011, 10:33 AM
Thanks! I've got it going now. I'm going to get onto getting those other functions done some time this week.. I'll post again once I'm done.

For those that would like to use this version please see attached. It adds run-time customisation of Z travel, Z search speed, touch off thickness and retract distance.

Btw, is there any way to increase the number of timer components in a ladder? It seems to be fixed to 10 which was a little limiting. I found that I needed to have 100ms delay between MDI calls and 100ms one shots for each call. In the end I had to use a mix of the newer timers, older timers and monostables..

Edit: Ok this is a case of RTFM.. To answer my own question, you need to pass a parameter to the RT module when loading:

loadrt classicladder_rt numTimers=15

(from http://linuxcnc.org/docs/html/ladder_classic_ladder.html#r1_7 )

Cheers,

Andrew

chester88
12-31-2011, 08:42 PM
bump

xcayba
02-19-2012, 12:39 AM
I want to start by thanking everyone involved in making this happen. It works great!

Now, I want to see what I can do to extend this functionality to the X and Y axis as well. I have created a special tool probe that will do exactly the same thing the Z axis does with the probe interface. I just need to dig into the .clp and .hal files to figure out how to adapt this same process with buttons in the MDI menu for auto-zero-X and auto-zero-Y. Before I get in too deep, is there any reason to think that I won't be able to extend this same functionality to the X and Y axis?

Currently, I have the probe working pretty well with a manual jog at a slow speed. Once the probe interface is tripped when it runs into the side of the material (either X or Y), the jogging stops on its own. At this point, I would have to manually enter the offset to the center of the tool, but I'd like EMC to do that for me :-)

Thanks!

chester88
02-19-2012, 01:52 AM
It should work just fine with any axis.

Not sure what version of EMC you are using but if its 2.5 I suggest using g10 L20 P0
instead of g92.
The P0 mean use the current coordinate system.

Tinkers
02-19-2012, 02:39 AM
It should work just fine with any axis.

Not sure what version of EMC you are using but if its 2.5 I suggest using g10 L20 P0
instead of g92.
The P0 mean use the current coordinate system.

Will this G10 L20 P0 work on V2.4.3?

I replaced the G92 like you suggested. BUT I get display at the bottom right of AXIS screen. [Probe move in MDI would exceed joint 2's negative limit] . However, the Z-axis probes on nevertheless.
When it made contact, it displays [P value out of range with G10 L2 or G10 L20]

I further edited my Joint 2 negative limit & that got rid of the negative limit warning display.

It works as previously with the exception of the [P value out of range with G10 L2 or G10 L20] warning display...

I'm clueless of this P value thing... Any help is highly appreciated.

chester88
02-20-2012, 07:58 PM
P0 only works in emc 2.5 and better

the P represents the coordinate system:

P1 = g54
P2 = g55
etc

In emc 2.5 P0 represents 'currently active coordinate system'
so then you don't have to worry about what one your in.

If you usually only use one coordinate system then you could still use the G10 L20 option.

just use the P number that is right for the coordinate system you usually use.

You just have to remember that if you switch coordinate systems the touchoff won't seem to work.

Odie9
03-04-2012, 03:03 PM
I'm trying to set up a probe and running into an issue. I have the files loaded up and configured correctly I believe as I have the custom buttons displayed as described. When I hit the touch off button though nothing seems to happen. That is nothing at all. I'm running the second set of files that were posted with the customizable speed and plate thickness on end 2.3.5. Any suggestions? I'm sure it's something simple that I'm missing, I've never tried any custom stuff with and before.

TUA,

Odue9

spokes
03-04-2012, 03:47 PM
Did you switch to MDI mode?

chester88
03-04-2012, 04:06 PM
zip and post your config files (all of them )

and you are using EMC 2.3.x ?

Chris M

Odie9
03-05-2012, 01:49 AM
This us probably a dumb question but how do you change to mdi mode?. I'm running the Axis GUI.

racedirector
03-05-2012, 02:22 AM
Click on the MDI tab on the left. It is with the panel for jogging/homing that you see as default..... Main Control/MDI

racedirector
03-05-2012, 02:57 AM
Ok, I am at my wits end, I have been trying to get this working for 2 days now.

I am using LinuxCNC 2.4.7 with SLAmstepper controllers and the 4axis board that accompanies them.

I have followed and read this thread multiple times and have used the Plasma files attached in here. But I just cannot get this to work properly. I can get the Z axis going up and down but it doesn't set anything aside from some weird location. If I try and jog, say, to .25 off the table and I press Home, it jumps back to the weird number, in this case -1.4322. It doesn't matter where I put Z, pressing the Home button sets it to that number.

I changed one thing from the Plasma files, the 4th MDI command in my ini file. I did this because it was setting my X and Y from the MDI command in that file - no idea why.

So I am turning to those who know what they are doing. I am attaching all my files (aside from stepconf) just incase anyone can see any glaring errors. Any help resulting from the looksee would be greatly appreciated.

Cheers
Bruce

Odie9
03-05-2012, 03:04 AM
yes, I clicked on the mdi tab so I guess I'm in mdi mode. Nothing happens when I push the button. I'll attach my files tomorrow.

racedirector
03-05-2012, 03:06 AM
yes, I clicked on the mdi tab so I guess I'm in mdi mode. Nothing happens when I push the button. I'll attach my files tomorrow.
Yup, clicking on the MDI tab puts you in MDI mode automatically. Sound like you are having the same problems that I have been having. Good luck with yours, I'll be in the home for crazy CNC users real soon with it!

racedirector
03-05-2012, 03:29 AM
Been playing around, changed G92 for G10 L20 P1 and it seemed to work as far as the Z location was concerned. However, clicking the z axis button has EMC saying the probe is already active or something.

It certainly isn't easy doing anything in EMC!!!!!!!!!

Odie9
03-05-2012, 05:14 PM
Attached are my config files. If anyone can help sort this out it would be great. I just put together this sample machine config to try to get it to work before I alter the config that I actually run my machine from. The only thing I changed from the files I downloaded was the font size for the buttons as the way it was in the xml file when I downloaded it the buttons were too big for my screen. Basically when I push the button nothing happens at all. I would assume I should see the MDI commands pop up in the MDI window?

TIA,
Odie9

chester88
03-06-2012, 01:15 AM
Odie9

I can't unzip your file.

chester88
03-06-2012, 01:23 AM
racedirector

You probably have offsets left over from G92 that where the weird number is probably coming from.
One of the reasons I recommend not using G92. Look on the DRO page and see if G92 offsets are present.

Are you sure your probe actually works? If Linuxcnc says that the probe is already active that probably means that it didn't get a probe signal.
use halmeter to check if the signal 'probe-in' changes when the probe is toggled.

As for the 4th MDI command I'm not sure what you mean. It is supposed to set x and y to zero. looks like now you have it move ( G0) to x and y zero.

Linuxcnc is very flexible which makes it a little more difficult. You must be very logical and pay attention to small details when trouble shooting.

You think it's hard for you to figure it out - try being me trying to figure out whats wrong there!! :)

edit - I looked in your VAR file and there are no g92 offsets. there is only the Z offset 1.432184
So it does seem that the probe is not working.

Also I am a little confuse about your homing comment. homing and probing are two different ideas.
I am assuming you don't have home switches.
you must pick one spot on the machine to home to. homing sets the MACHINE coordinate system not the part coordinate system
( forgive me if you know all this)

Chris M

Odie9
03-06-2012, 02:11 AM
That's odd, does this one work?

Odie9

chester88
03-06-2012, 02:16 AM
I'll also add that in AXIS you can select ladder editor under the file heading.
then you should be able to see what is happenning.

click display symbols off

%I0 is start Z touch off sequence
%I1 is mdi mode on (you must be in MDI mode for it to work)
%I2 is in position (probe complete)

chester88
03-06-2012, 02:37 AM
Odie9

yep it worked.
You are using a fancier version that I can't confirm if it actually worked without testing it.
I don't have time to do this now. I need sleep :)

racedirectors version should work though...

this somewhat explains how it works in case your interested...
LinuxCNC Documentation Wiki: ClassicLadderExamples (http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ClassicLadderExamples#Single_button_probe_touchoff)

ecurb5
03-19-2012, 01:04 PM
Any updates on code for auto zeroing x and y using the likes of a copper tube type of probe? I know there is one working for mach3, was checking to see if anyone had it working for emc2. Or did I miss that post? :S

samco
03-19-2012, 01:14 PM
I use these probe routines....

Probing routines for LinuxCNC's Enhanced Machine Controller (http://timeguy.com/cradek/01262579508)

Probe and mill - YouTube (http://youtu.be/U61ub6mtpH4)

sam

ecurb5
03-19-2012, 01:41 PM
Thanks Sam, I was going to *attempt* to write the code if someone else hadn't. Don't see any need in duplicating what has been done, and appears to work as expected. :)

Pannie
05-15-2012, 02:56 PM
Hi All Ive Been trying to get the z zero working on my probotix comet for a few weeks now.
But Im stuck , the comet does not have a spetconfig file with the setup so I cant con fig the first 2 steps on Daves install list ;


1. Run stepconf.config and set a pin for probe in. Any changes to this later will erase some of the files needed in custom.hal and your .ini file.
2. Under Advanced options of stepconf check the boxes for Include HalUi user interface component, Include custom PyVCP GUI Panel, and Allow connections to HAL. Select the radio button Blank program then save your config normally.

Also because paraport 0 is full , im using paraport 1 pin 10.

ive added the following to my hal file

loadrt hal_paraport cfg="0x378 out 0xec00 in "

im i write in changing 0 to 1 below?

net probe-in <= paraport.1.pin-10-in

also do i have to change 0 to a 1 in the following lines of the custom_postgui.hal file ?

everywhere where there is classicladder.0. put 1?

Any help is very much apreciated

Pannie C

Pannie
05-15-2012, 03:52 PM
ok got emc2 to fire up and have got the new buttons showing

first i home the system

then i go to the mdi view

then i put the touch plate under the router

i connect the bit to the probe ip pin 10 of paraport 1

and the gnd to the plate

i press the z zero button

then the bit moves down touches the plate and stops , but dosent come up

any ideas?

Pannie
05-15-2012, 04:50 PM
ok i checked that e and c are connected on the ladder editor , they seem to be line is going from e to c .

Im having trouble finding the motion.motion-inpos command to check it is it supposed to be in the HAL file?

Pannie C:idea:

chester88
05-15-2012, 08:26 PM
if your using EMC past 2.2.9 (or around there) the pin is :
motion.in-position

chester88
05-15-2012, 08:35 PM
you should find it in the custom_postgui.hal file

Pannie
05-16-2012, 02:43 AM
Well after a good nights sleep I got up and tried again.

I found that I missed the rem hash in the ini file after i got rid of it everything works well.

Thanks to all for making this possible !!

Good Work

:cheers:

Pannie C

JeromePillot
11-13-2012, 04:41 AM
Hi everybody,

Just a question of a beginner in Hal & classic loader :
After I adapt the content of this pages, my Z axis zero is working well.
I try to adapt the script to add a X first and then a Y zero.
In my .ini file I have a section
[HALUI]
MDI_COMMAND = G38.2 Z-3 F16
MDI_COMMAND = G0 Z2
MDI_COMMAND = G10 L20 P0 Z1.5
MDI_COMMAND = G10 L20 P0 X0 Y0
MDI_COMMAND = G38.2 X3 F16
MDI_COMMAND = G0 X-2
MDI_COMMAND = G10 L20 P0 X1.5
MDI_COMMAND = G0 X0 Y0

And my Custom_postgui is as link.
In the HAL config windows,

The Z is working well :when classicladder.0.in-00 is triggeg by pyvcp.z-axis-touchoff, then classicladder.0.out-00 => halui.mdi-command-00 command is running OK.

For the X, if my classicladder.0.in-03 is trigged correctly by pyvcp.x-axis-touchoff classicladder.0.out-03 is not passing (wedge) On NOR the halui.mdi-command-04 (G38.2 X3 F16).

The (classicladder.0.in-01 classicladder.0.in-04) and (classicladder.0.in-02 classicladder.0.in-05) trigging are visually ok in the HAL configuration windows.

Any Idear why the X is not working ??? After a couple of nights I'm turning round !!!

JeromePillot
11-13-2012, 06:34 AM
With a single button directly connected to pyvcp.x-axis-touchoff it works(but does only the G38.2)
while inverting the classicladder.0.in-03 and classicladder.0.in-00, X work with the G38, the G0...

It looks like I can use this way only one time...

JeromePillot
11-22-2012, 02:34 AM
seems the problem is in the clp file. I've tryed to duplicate the original patterns and change the In / Out but there is something I miss somehow :stickpoke seems faster to do the zero manually :violin:

JeromePillot
11-25-2012, 12:19 PM
I found the solution (let say my X and Z probe are now working :o):tired:... I just needed to close properly halrun before starting linuxcnc. If I don't, I have the error message, and making some test I never closed it. (chair)

strokercrate
07-25-2013, 01:57 PM
.

strokercrate
07-26-2013, 01:06 PM
Ok after going back and reading I found I didn't have the .hal in right or well almost any at all. "Linux new to me I don't full understand the pin connecting"

So I went and put everything I can notice in to the files. Pretty much copied everything others have done. Now my ladder is connecting and working uptil step 1 then it stops, this giving no movement. I can go into vars and manual click it and get movement sometimes full, other times just a hair and then tells me it would exceed the limit. But still no action from the button although you can see it activate in the ladder.

Any thoughts on what im missing?

193520193522

strokercrate
07-26-2013, 04:17 PM
Ok I got it to activate with the button by changing %m0 to %m1, But it wont read the probe, says it was issued with out a mdi command. And after the first time it will skip straight to the rapid movement.

strokercrate
07-27-2013, 01:31 PM
man has this become a dead thread?

strokercrate
08-21-2013, 04:20 PM
Seeing how this seems to be a dead thread I might be wasting my time, but anyways I found out how to get the touchoff plate for the z position to work without classicladder Its much more simple using o codes and a button.

barrywood
08-28-2013, 10:56 AM
Well, it might be a dead thread, but your post sure caught my interest! I don't want to have to do ladder logic if I can help it. Would you mind sharing how you used the O codes to do touchoff?

strokercrate
09-06-2013, 10:13 AM
sorry I have been gone for awhile. Yea i'll upload the files, you need the input wire ran and the probe port turned on.

shoot me a email, seeing that I check it more regularly when you get this reply and i'll send the files.

jamesbalnks@ymail.com

ElectronExciter
09-29-2013, 08:18 AM
Threads are NEVER dead! Google has led me here and that makes it very much alive! I have to get this working on my machine (can't afford Mach3 right now so LinuxCNC is my go-to program!)

svenakela
09-29-2013, 04:14 PM
Threads are NEVER dead! Google has led me here and that makes it very much alive! I have to get this working on my machine (can't afford Mach3 right now so LinuxCNC is my go-to program!)

Don't start a fire here will ya? Some of us would never turn to the dark side. ;)

strokercrate
10-01-2013, 09:10 AM
i suggest O-codes instead of a logic ladder setup, it works flawlessly and takes half the time with almost no trouble shooting. Just getting the button called correctly.

Plus it works when in manual or mdi mode

Gururaj
11-04-2013, 09:19 PM
Hi All,

This thread was very helpful in putting my Z touch-off probe in place. Thought to share some small information to great minds here.
My Z-axis was moving down slowly towards the ground plate, touching it, and used to sit on the plate without rapidly moving away as programmed in the classicladder. After spending lot of time, I found that the third MDI command was commented out. Un-commenting the following line in custom_postgui.hal made my Z-probe to work as expected.
net rapid-away classicladder.0.out-02 => halui.mdi-command-02

Ho yeah, I also added debouncing for the probe to avoid noise/mdi errors, as many have suggested in the earlier thread. Following were the changes I did in my main.hal file.

#added for probe debouncing
loadrt debounce cfg=2
setp debounce.0.delay 200
addf debounce.0 base-thread
#end of probe debouncing

#Commented out the existing configuration
#net probe-in => motion.probe-input
#net probe-in <= parport.0.pin-13-in-not

#added for probe debounce
net debounce-probe-in debounce.0.0.in <= parport.0.pin-13-in-not
net probe-in debounce.0.0.out => motion.probe-input
#end of probe debounce

Hope this helps

-Regards,
Gururaj
ideaguru (http://gurugem.wix.com/ideaguru)

Paulnd
11-07-2013, 06:27 AM
sorry I have been gone for awhile. Yea i'll upload the files, you need the input wire ran and the probe port turned on.

shoot me a email, seeing that I check it more regularly when you get this reply and i'll send the files.

jamesbalnks@ymail.com

Hello,

Does anyone have the O code files please? I've sent an email to strokercrate but haven't received a reply. I'll be very grateful if someone could upload or send the files to me please.

thanks

Paulnd
11-07-2013, 07:37 AM
sorry I have been gone for awhile. Yea i'll upload the files, you need the input wire ran and the probe port turned on.

shoot me a email, seeing that I check it more regularly when you get this reply and i'll send the files.

jamesbalnks@ymail.com

Hello,

Do anyone have the O code files to share please? I have emailed strokercrate but have not received a reply yet.

thanks in advance

strokercrate
11-28-2013, 04:13 PM
Hello,

Do anyone have the O code files to share please? I have emailed strokercrate but have not received a reply yet.

thanks in advance

I haven't received a email about the O codes in a couple of months, and those I replied to.

Try again, jamesbalnks@ymail.com

Also, you could just post your email and I could fwd them.

Thanks

Paulnd
11-28-2013, 04:30 PM
Ah, just realised that I misspelled your email address! Sent you another one

Paulnd
11-28-2013, 04:38 PM
If it doesn't work, my email is pdumke at gmail dot com. Thanks

Paulnd
11-28-2013, 06:04 PM
I received your email, thanks. Unfortunately there was no zip file attached

WJHildreth
12-11-2013, 03:53 PM
After reading this thread several times, digging around and using the tutorial at For Science » LinuxCnc ? Touch plate ? Part 2 (http://forscience.nl/?p=197) I have managed to learn more about HAL, HALUI, and classic ladder than I ever thought I could. Just wanted to thank all of you for your hard work. But I do have one question and don't know if it is even possible.

If I do a manual touch off the display of the plot of my gcode will move to the new location. This is a great visual indicator of the touch off happening. When I use the touch off button from this thread, the offsets are set but the plot stays in it's original location. Is it possible to get the plot to move when the touch off is set like in manual mode? I just think it would be a great visual indication that all is working as expected.

Thanks,

Joe Hildreth

pippin88
12-19-2013, 06:11 AM
strokercrate kindly provided the code for me to get my touch plate going. It's great.

I've written an article: 7xCNC - Minilathe CNC :: LinuxCNC Probing / Touch Off (http://7xcnc.com/software/probing/)
I think O codes are the easiest way to get it going.

WJHildreth
12-19-2013, 10:09 AM
Pippin,

Just looked at your article. So, this method removed the ladder program and replaces it with a sub-routine. Nice and clean!! Thanks for sharing it. One question. If the probe does not make contact, what happens after you get the error message? Does it just return from the sub-routine without running any more G-Code, Or does it continue to set the offset reguardless?

Many thanks again for sharing!

Joe

strokercrate
03-03-2014, 12:30 AM
Pippin,

Just looked at your article. So, this method removed the ladder program and replaces it with a sub-routine. Nice and clean!! Thanks for sharing it. One question. If the probe does not make contact, what happens after you get the error message? Does it just return from the sub-routine without running any more G-Code, Or does it continue to set the offset reguardless?

Many thanks again for sharing!

Joe

You have to set the search distance in the 100.ngc file, if your Z travel is say 6 inches that should be your search distance, or if you go in mm and your Z travel is say 15mm the search should be set about the same, of course it doesn't have to be exactly that much accounting for a bit, but close enough.

rotccapt
04-27-2014, 07:46 PM
hi all i was wondering if you could help me get my machine going with a touch off plate. i fallowed the instructions on the web sit listed and i though i did everything right but now linuxcnc will not start i got the error message

Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
custom_postgui.hal:4: Pin 'pyvcp.o100' does not exist
6098
PID TTY STAT TIME COMMAND
6149
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

can anyone help me resolve this issue attatched are all the files that were modified except the 100.ngc

thank you for your time

pippin88
06-21-2014, 10:06 AM
rotccapt. Slow reply, sorry.

The problem is your custompanel.xml
You've commented out (<!-- and -->) all the actual code, and you've doubled up on the xml and <pyvcp> tags.
The whole file should be:

<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<button>
<halpin>"o100"</halpin>
<text>"Touch Off Z"</text>
<font>('fixed',10)</font>
</button>
</pyvcp>

If you have other functions on your pyvcp you just need:

<button>
<halpin>"o100"</halpin>
<text>"Touch Off Z"</text>
<font>('fixed',10)</font>
</button>
in there somewhere.



In other news I've got a guide on finding a corner with LinuxCNC and NGCGU (http://7xcnc.com/software/probing/probe-corner-ngcgui/)

rotccapt
06-21-2014, 09:12 PM
thank you for the reply i did get linux cnc back up and running with the new button but the function still does not work when i click the button i get another error saying that "can not open file <100> im not sure if it might have something to do with creating the file in windows or what not. i opened hal monitor and i do see that the pin is active but it still does not work. i have not played with it in a while though. my problem was in the custom panel and i ended up deleting everything in the file and starting over but thanks for the help.