Reset machine coordinates on special machine.

More
03 Jul 2022 18:56 #246526 by BigGray
Thanks a lot Andy for the effort to test this.

The bash file would make for another home button, only for x and a right?
Not really what I'm looking for, it's too cumbersome to use at the speed the machine cuts.
imagine re-homing 60 times an hour. 480 times a day.

Since A will make even more turns then X as it slices the same piece several times, the length would add up even faster.

I think it must be an axis because it needs trajectory planning between x y z and a.
This thing is a lot more complicated then the drawing. in total 6 servo's.

All machine controllers cutting from spool have this reset feature.

When I have time I'll have a look at the source code.
If I find the variable that stores machine coordinates, I guess it's trivial to write some code to reset it from G code.

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

More
03 Jul 2022 20:24 #246538 by andypugh
OK, the next suggestion would be to invent a new G-code that resets the chosen axis.

I think this might be possible via remaping, in Python, calling "canonical commands"

github.com/LinuxCNC/linuxcnc/blob/master...mc/nml_intf/canon.hh

Contains all the commands that the G-code is converted to.

But, is it really a problem if machine (rather than relative) position can't display in the DRO?

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

More
05 Jul 2022 01:25 - 05 Jul 2022 01:26 #246623 by cakeslob

I think it must be an axis because it needs trajectory planning between x y z and a.

Keeping this in mind
I dont know how the lengths are sent to the machine or how the programs look, but the machine feeds pizza in one direction (x), of variable lenghts, from a giant 1km long spool of pizza, and then a axis pizza cutter cuts it. With a 1 pizza per minute cycle time, and several other servos that I will assume are for things like cheese control, sauce spreading and anchovy distribution, but you have these axis under control.

Does the 1km pizza spool need to be X axis?

Could it be like an external stepgen in hal (synced with tc comp?) with a remapped letter code like E and commanded incrementally? Or something in classic ladder?

If you only need it to feed an variable incremental amount of pizza every cycle, does that feed roller need to be X axis or can it be something else, like how paste extruders, or 3d printers, or like a bar stock cnc lathe?
Last edit: 05 Jul 2022 01:26 by cakeslob.

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

More
06 Jul 2022 17:04 #246735 by BigGray
The Pizza cutter cuts shapes in the "pizza", like a star for example.

The A axis calculates the amount of turns of the cutter wheel needs to make it travels from current to commanded position.
An extruder is similar, I just don't need to store the amount of turns the cutter made as it needs to be reset for the following piece.

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

More
06 Jul 2022 19:37 #246751 by BigGray
Thanks Andy I had a quick look at it.
Did not see a function which would do what I wanted.
CANON_POSITION GET_EXTERNAL_POSITION just finds the current positon.


Looking trough the code, homing.c has the homing functions.

HOME_SET_SWITCH_POSITION sets the joint offset on the final move.
joint->pos_cmd+=offset;
joint->pos_fb+=offset;
joint->free_tp.curr_pos+=offset;
joint->motor_offset-=offset;

Those are defined in motion.h
double pos_cmd //commanded joint position
double pos_fb //position feedback ; comp removed
double motor_offset /* diff between internal and motor pos, used to set position to zero during homing*/

I suspect I cannot access those variables while running gcode;

In EMC_NML.hh I found;

EmcPose postion //current commanded position
EmcPose actualPostion //current actual postion ; from forward kins

Trajectory planner (tp.c) has tp-> currentPos
hmm maybe i could reset A in
int tpCompleteSegment(....) //cleanup after a trajectory segment is complete

Looking at it trajectory planner tp-> currentPos looks like the right var to reset for A
could hardcode that.

X needs to be reset at every cutoff, seems a bit weird to have to access trajectory planner for that.

Or am I completely wrong and is the current positon not in tp->currentPos?


Well yea seems to be in motion.h
emcmot_internal_t struct has a member called coord_tp which contains currentPos.

Can I just update currentPos like that or will that result in something weird?

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

More
06 Jul 2022 21:05 #246757 by chris@cnc
Did we have the G91 option? It's possible to use program in incremental mode?
Another idea is to use external encoder and the "encoder.N.reset bit".
I think two simple sensors count and one proxy reset. 
linuxcnc.org/docs/stable/html/man/man9/encoder.9.html
The following user(s) said Thank You: BigGray

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

More
09 Jul 2022 14:44 #246946 by BigGray
G91 would make programming too difficult.

encoder.N.reset bit indeed works, also works while running g-code.

Unfortunately it causes a following error which disables the drives.
If i reenable the drives the reset indeed has completed.

I tried disabling the pid loop but still got the following error.

using hal configuration both pos_cmd and pos_fb are reset to zero as well.

Any ideas how to fix the following error?

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

More
14 Jul 2022 23:00 #247329 by andypugh
Can you explain why having very large numbers in the machine absolute coordinates is a problem?
If you display the working coordinates you won't see them.

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

More
18 Jul 2022 15:16 - 18 Jul 2022 15:24 #247694 by BigGray
1)That is what the original controller(dead) did.
The original controller re-homed automatically and reset the machine coords to zero the before cutting then started cutting, because the spool is like a spring if you disable servos it can lose wind itself back a bit. If linuxcnc goes to sleep it auto disables drives.
Btw it also computed the Z and A positions from X&Y.
It re-homed after every time it cut the spool completely.
The original controller just took some nice X Y values without offsets.


2) Avoid writing Gcode like G54 G1 X100 .000 Y100.000 Z45.000 A154366.000
I will have to do this even when using offsets or I would have to call G10 L20 P1 A0 after every line which is kind of crazy as there can be thousands of calls in just one sheet.

Using relative coords is not an option if i cannot do that only for the A axis.



3) I was hoping to avoid dealing with offsets as they make debugging harder.
The g code generator needs to be solid else it will crash the machine.


4)using offsets when loading a new job after the first axis still shows the first job so it goes off-screen which is not handy as a job can be 100000.0000 mm long
The preview is needed to avoid confusion.


I can see how this looks like no issue for someone using a mill.
Maybe this looks trivial but on fast machines that rehoming of X happens several times a minute so it was automated.

Currently I set it up using offsets and large numbers for A in Gcode.
Everything works except it just is not elegant.

If only "encoder.N.reset bit" didn't cause a following error.
Last edit: 18 Jul 2022 15:24 by BigGray.

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

More
18 Jul 2022 15:30 #247697 by andypugh

4)using offsets when loading a new job after the first axis still shows the first job so it goes off-screen which is not handy as a job can be 100000.0000 mm long
The preview is needed to avoid confusion.
 

G10 will move the tool point to the origin on the preview. 
The only time that the big numbers would be visible would be if you chose to display absolute machine coordinates rather than relative working coordinates. 

If you use G10 and display working coordinates then I think that the machine will appear much the same as with the old controller. 
 

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

Time to create page: 0.113 seconds
Powered by Kunena Forum