Reset machine coordinates on special machine.

More
28 Jun 2022 20:29 - 28 Jun 2022 20:35 #246101 by BigGray
Tl; dr
Is there a way to reset the X and A- axis machine coordinates or re-home from G-code?
Assuming there is no way can someone point me to the right Part of the source code so I can  add a few lines and re-compile linuxcnc.
Or if there is a solution using nml that would be appreciated too.


Hello Everyone,

I have this quite unusual machine where the  material is fed by rollers(yellow). The  travel of X is "infinite".
After The Scissors cut off the material the machine is "homed" eg the X-axis should be at 0.0000


 
 

Linuxcnc assumes X has a fixed length in machine coordinates I guess
So I could not find a way to reset X without rewinding it which would push out the material as it has already been cut off.

G92 did nothing to the machine coordinates.
Using offsets G54 ... does not work either for my case as  this is a pretty fast machine that is being fed several G-code files a minute generated by another program.
The X value could exceed the variable size  in which it is stored.
Re-homing the machine manually just takes too long and can be forgotten doing it several times a minute.


Is there a way to reset the X and A- axis machine coordinates or re-home from G-code?

Assuming there is no way can someone point me to the right Part of the source code so I can  add a few lines and re-compile linuxcnc.

Or if there is a solution using nml that would be appreciated too.

Thank you in advance.
 
Attachments:
Last edit: 28 Jun 2022 20:35 by BigGray.

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

More
28 Jun 2022 21:11 #246104 by tommylight
Does the machine require homing X before use?
Can it deal with "immediate homing" for the X?
If yes, then adding a simple micro switch to scissors and wiring it in hal to "home X" should work just fine.
Not sure if external homing for a single axis works, i am sure it works for home all, so should also work.
The following user(s) said Thank You: BigGray

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

More
29 Jun 2022 19:17 - 29 Jun 2022 19:17 #246191 by BigGray
At the moment both A and X are homing immediately.

I simplified this machine a lot to make it easier to digest, a microswitch would not work.

However if tripping a microswitch while running gcode works then I should be able to use a M64 P1
from g-code and wire that output to the input of home x.

Sounds like a good compromise if it works.
If that works perhaps it is possible to include some while and if else to home X in the beginning of the gcode.

Will update as soon as I try it.
Last edit: 29 Jun 2022 19:17 by BigGray.

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

More
29 Jun 2022 21:03 - 29 Jun 2022 21:29 #246211 by chris@cnc
Not sure was the problem with g54 is. But G10 L20 P1 X0 A0 will set axis zero on actual position. 
P1 G54
P2 G55
….
Last edit: 29 Jun 2022 21:29 by chris@cnc.

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

More
29 Jun 2022 22:59 #246232 by andypugh
Another vote for G10. But look at the docs to work out which one you want (L1, L10, L2, L20)
linuxcnc.org/docs/stable/html/gcode/g-code.html#gcode:g10-l1

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

More
30 Jun 2022 21:16 - 30 Jun 2022 21:28 #246313 by BigGray
@Chris and Andy
I read the docs before making this topic.

Let me clarify my concern again.

The spool is 100 000 mm long and several spools are changed during the day.
If keep offsetting using G54 the G53 coordinate would exceed 999 999.

This is a mess I would like to avoid .
The machine is not using fixtures, using G54 G55... makes things just more complicated.

The easiest and best option is to reset the G53 coordinate as soon as the material is cut.
Because the machine is really at X0 then.
Same with the pizza cutter, it has no limits after cutting it should be zeroed.

If I just could reset the G53 Variable this would solve everything.
Last edit: 30 Jun 2022 21:28 by BigGray.

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

More
30 Jun 2022 21:24 - 30 Jun 2022 21:31 #246315 by BigGray
Tommy, I tried your suggestion and it did not work.

Perhaps I did not really understand what you meant.
If I trip the home switch of x while running a gcode file, that does not reset the machine coordinates(G53).

I'm using trivkins with 2 gantrys so both=true , and yes I did check the home-switch is working properly using hal config viewer.
Last edit: 30 Jun 2022 21:31 by BigGray.

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

More
30 Jun 2022 21:33 #246318 by tommylight
Is it going to be cutting a series of the same size stuff?
Using a gcode loop should make it possible to 0 the axis when it finishes then start over.

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

More
30 Jun 2022 22:36 #246323 by andypugh
After some experimenting, this works....

1) Set the axis to immediate homing (HOME_SEARCH_VELOCITY = HOME_LATCH_VELOCITY = 0 )
2) Toggle halui.mode.joint
3) Toggle halui.joint.0.unhome
4) Toggle halui.joint.0.home

(At this point the machine will automatically switch out of joint mode)

One way to do this is with a custom M-code. Save the following as a file called M100 in your nc_files directory and make it executable (either from the file manager properties or chmod +x M100.
#! /bin/bash

mode=$(halcmd getp halui.mode.is-manual)
echo $mode
halcmd setp halui.mode.manual 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.mode.is-manual)
echo mode is manual $mode
done
halcmd setp halui.mode.manual 0

mode=$(halcmd getp halui.mode.is-joint)
echo $mode
halcmd setp halui.mode.joint 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.mode.is-joint)
echo mode is joint $mode
done
halcmd setp halui.mode.joint 0

mode=$(halcmd getp halui.joint.0.is-homed)
echo $mode
halcmd setp halui.joint.0.unhome 1
while [ $mode == 'TRUE' ];do
sleep 0.1
mode=$(halcmd getp halui.joint.0.is-homed)
echo joint is homed $mode
done
halcmd setp halui.joint.0.unhome 0

mode=$(halcmd getp halui.joint.0.is-homed)
echo $mode
halcmd setp halui.joint.0.home 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.joint.0.is-homed)
echo joint is homed $mode
done
halcmd setp halui.joint.0.home 0

exit 0

It isn't as complicated as it might look, it just sets a pin and waits for the result for four different HAL pins in sequence.

Note that this will _not_ work inside a G-code programme because it requires a mode change to manual (out of auto)

I think that you might have to use G10 inside the G-code and M100 on spool change or similar.

The code does not have to be run from MDI M100, it could be linked to a physical button as a HALCMD (see the INI docs)

Or, it could be coded in Python, in which case it could watch a HAL pin and do the reset then.

It might not make sense for this to be an axis at all....
The following user(s) said Thank You: BigGray

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

More
03 Jul 2022 18:41 #246525 by BigGray
No, every piece is different.

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

Time to create page: 0.142 seconds
Powered by Kunena Forum