Recording coordinates

More
13 Jun 2011 13:49 #10466 by martig
Recording coordinates was created by martig
Hi

I have a 4 axis router setup. What I would like it to is following:
the tool should move according to the G-Codes like a router would otherwise, but upon receiving an input it should record it's current position to a log (file) and just continue moving along the path.

Reading through the manuals I didn't find an easy way to log the coordinates. Does anyone have an idea on how to achieve this?

Please Log in or Create an account to join the conversation.

More
13 Jun 2011 18:20 #10467 by PCW
Replied by PCW on topic Re:Recording coordinates
I think HAL sampler is the way to record a trace file, but beyond that you need a HAL guru...

Please Log in or Create an account to join the conversation.

More
14 Jun 2011 12:11 - 14 Jun 2011 12:13 #10486 by andypugh
Replied by andypugh on topic Re:Recording coordinates
martig wrote:

Hi I have a 4 axis router setup. What I would like it to is following:
the tool should move according to the G-Codes like a router would otherwise, but upon receiving an input it should record it's current position to a log (file) and just continue moving along the path.


Is the input going to happen during auto-operation? If so, then it is annoyingly difficult to do what you want.

The following will only work if the machine is _not_ in AUTO mode:

Inside G-code you can use (LOG, xxxxxx) to output to a file:
www.linuxcnc.org/docview/html/gcode_main.html#sub:Messages

In theory you could call that code on a pin going high with an MDI_COMMAND
linuxcnc.org/docs/html/gui_halui.html#sub:MDI

Depending on the version of emc2 you are using the current coordinates might be available in #5420 to #5428 (and, in the latest development they are likely to be available as #<_X> etc).
www.linuxcnc.org/docview/devel/html/gcod....html#sec:Parameters

So, you might be able to add the following in the indicated parts of the INI file
[HAL]
{existing stuff}
HALUI=halui

[HALUI]
MDI_COMMAND = (LOG, #5420, #5421, #5422)

and then in the HAL file something like:
net log-now halui.mdi-command-00 <= parport.0.pin-04-in

However, that won't work with older versions, in those you have to use a trick to get the current coordinates:

[HALUI]
MDI_COMMAND = O<lognow>CALL

Then create a file called lognow.ngc, put it in the directory pointed to by PROGRAM_PREFIX (in the INI file) and put the following in it
O<lognow> SUB
G92 X0 Y0 Z0 ;store current XYZ in G(2 offset parameters
(LOG, #5211, #5212. #5213)
G92.1 ;clear and cancel the G92 offsets
O<lognow> ENDSUB
M2

(Though, I am not sure which version of EMC2 introduced O-sub call from MDI_COMMAND)

It sounds like you might actually be wanting to do probing, though, and you can get G38 probing to automatically log to file.
Last edit: 14 Jun 2011 12:13 by andypugh.

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum