Setting work offsets with pendant

More
17 Dec 2010 22:17 #6108 by etgoodacre
Hi,
Not sure where this question should go, sorry if i'm in the wrong section.

I'm setting up a 3 axis CNC machine and have found a problem that I havn't been able to solve.

I have a pendant that is connected through the modbus. I am writing a component to parse all of the data coming from the pendant (which buttons are pressed, jog wheel position etc.) and interact with emc2 via halui.

I want to be able to set the work offsets g54-g59.3 by pushing a button on the pendant. What I would like to happen is I select the work offset I want to set using pyvcp buttons on the axis gui, and then when I push the button on the pendant it sets the offset of whatever axis is selected to the current position.

eg. if my machine position is x3 y4 z5, and I have g54 and the x axis selected, when I push the button sends the equivilent of the mdi command G10 L2 P1 X3.

My appologies if this question has already been answered somewhere, but I could not find it.

Thannks for your time.

-Evan

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

More
17 Dec 2010 23:27 #6111 by Rick G
You can use a button to issue a MDI command with Hal. An example can be found here...

wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Add...imple_Remote_Pendant

Rick G

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

More
17 Dec 2010 23:55 - 18 Dec 2010 00:07 #6112 by cmorley
currently there is no way to tell G10 L20 to use the current coordinate system - you must specify it.
(you want to use L20 it sets the axis to the number you supply - if you want X to b 0 set G10 L20 P[something] X0 )
This is being looked at in the development version.
there may be a hack to work around it for now....
hmm I can't find anyway for HAL to know what coordinate system is active.
so I can't think of a work around.

So the only thing you can do is to have your button always assume one particular coordinate system.
This is what Andy is doing one message below.
the problem is if you are not in that coordinate system the offsets will be applied to the wrong system.
i guess it depends on if you use more then one system regularly.

This same issue has come up with someone using a touch off plate.

Chris M
Last edit: 18 Dec 2010 00:07 by cmorley.

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

More
17 Dec 2010 23:57 #6113 by andypugh
etgoodacre wrote:

eg. if my machine position is x3 y4 z5, and I have g54 and the x axis selected, when I push the button sends the equivilent of the mdi command G10 L2 P1 X3.


You are so very close to guessing the correct incantation.

you need

[HALUI]
MDI_COMMAND = G10 L2 P1 X3

In your INI file. You also need to enable halui (all explained here: linuxcnc.org/docs/html/gui_halui.html )

Every MDI_COMMAND statement creates a HAL pin that can be linked to a real-world pin via whatever interface you are using by means of "net" statements in the HAL file.

When the pin goes high, the G-code gets run. The G-code can be a subroutine call, too. I have buttons that run entire machining operations.

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

More
18 Dec 2010 00:32 #6116 by cmorley
to answer your other question about setting coordinate via pyvcp panels:
use the halui mdi commands to
issue g 54 -59.3 commands based on which pyvcp component was pressed

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

More
18 Dec 2010 01:06 - 18 Dec 2010 01:08 #6119 by etgoodacre
Thanks for the help guys, I'm just retarded, I was unaware of the g10 l20 code, I thought you had to use g10 l2 and specify the offset.

As for picking the work offset, I'll just create a set of buttons on the axis ui so I can choose which offset to set. That way I can pick it, then walk over to my workpeice and set all the coordinates. Edit: what cmorley said.

Sorry about the dumb question, haha.
Last edit: 18 Dec 2010 01:08 by etgoodacre.

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

More
18 Dec 2010 01:19 #6121 by BigJohnT
Really the only dumb question is the one you don't ask... except for my daughter she did ask a dumb question once.

John

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

Time to create page: 0.619 seconds
Powered by Kunena Forum