Storing machine positions before homing

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Proidea
Posts: 22
Joined: Sat Jul 10, 2021 10:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Storing machine positions before homing

Post by Proidea »

I created a macro for homing the axes using the Zri from each servos.
The macro also performs the auto squaring using the Zri from the slave axis wired to a separate input and an inexpensive home switch.
It works fine.

Now, considering that for each axis the Zri homing position could be a full revolution of the motor from the home switch position (corresponding to 1 rev X pitch travel distance), I would like to recover that lost travel.

My solution would be the following, for example for the X axis:

X axis and the home switch on the left (Minus):

#123 = 1 ; dead-band value
M91/X L1 ;Move Minus to Home Switch
#121=#5021 ;#121 = Home Switch machine position
M106/X P-6 F70 ;Move Plus Until Zri Input Closes at 70 mm/min
#122=#5021 ;#122 = X Zri Machine Position
M106/X P6 F70 ;Move Plus to Clear Zri Input at 70 mm/min (superfluous)
G91 X[#121-#122+#123] G1 F80 ;Move incrementally to recover the lost travel
G90 ; back to absolute
M26/X ;Set X Home Position
...

Assuming that the home switch machine position is 20 (parameter #5021 stored in the variable #121), and the Zri on Machine position 30 (stored in #122), the travel to be recovered is 30-20-1=9, so it should move minus 9, and [#121-#122+#123] is equal to [20-30+1] = -9

The problem is that G91 X[#121-#122+#123]… doesn’t work as expected:
It seems that it ignores the value stored in #121: it moves by the value of #122+#123 (Plus 31). !!??


Any suggestion?


Thanks,

Henry
tblough
Posts: 3140
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

Re: Storing machine positions before homing

Post by tblough »

I'll bet the backoff distance doesn't change unless you make a mechanical change like moving the switch or changing the motor position. Therefore, just skip the fancy math and use a set distance. It will be a different value for each axis, but will be a constant. You can also use the slow probing rate for your feedrate value.


G91 G1 G20 X-0.060 F[#20201]
M26/X
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Proidea
Posts: 22
Joined: Sat Jul 10, 2021 10:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Storing machine positions before homing

Post by Proidea »

Thank you tblough for your interest but I believe your suggestion does not fit the problem I have proposed.
I tried to interpret your proposal and I honestly didn't understand (or misunderstood) ...

Should I manually move switches and / or motors? That makes no sense to me. It’s a homing MACRO;-
I cannot use a constant value as backoff because it is unpredictable – it could be from zero to the corresponding travel of the axis for one full revolution of the motor;-
Second: you insert a G20 (inch) in you string and I don't see what it has to do with it, since I use the metric system (please see my code); -
On top of that, the whole Computer Numerical Control - CNC - is based on mathematics…

Henry
tblough
Posts: 3140
Joined: Tue Mar 22, 2016 10:03 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: 100505
100327
102696
103432
7804732B977B-0624192192
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Boston, MA
Contact:

Re: Storing machine positions before homing

Post by tblough »

Sorry replace the G20 with G21 if you are using metric (I thought that would have been obvious). The distance could be anything between zero and one full turn but I bet it doesn't change - it's the same value every time. The only thing that will change that value is if you move the motor or limit switch, otherwise it will stay a constant.

Once you determine that constant value, you can adjust the recovery distance in the G91 line to restore the lost travel. You will have to determine the unique constant value for each axis.

CNC control is based on mathematics and logic. The latter seems to be harder to comprehend for many. The reason why no machine positions are being stored and calculated upon, is because there is no machine position until the axis is homed. All of your variables are 0.
Cheers,

Tom
Confidence is the feeling you have before you fully understand the situation.
I have CDO. It's like OCD, but the letters are where they should be.
Proidea
Posts: 22
Joined: Sat Jul 10, 2021 10:43 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Storing machine positions before homing

Post by Proidea »

...The reason why no machine positions are being stored and calculated upon, is because there is no machine position until the axis is homed. All of your variables are 0.


That's wrong.
Post Reply