on the fly config

More
08 Jul 2011 12:39 #11262 by btvpimill
on the fly config was created by btvpimill
Is it possible to re-configure the stepgen output without reloading EMC? What I want to do is have the machine boot up with all axis independent. Then Home all. Then maybe use M1xx or whatever is appropriate to slave 2 axis. Then with a different M1xx make them independent again.

I am thinking I can Unlink? then pins and link them to the other axis, then do the same to put them back.

So I would boot with X,Y,Z,A,V,W, then slave V to Y and W to Z. Then unslave them at will.

Of course I would need to do this without losing position information for the slaved axis.

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

More
08 Jul 2011 13:54 #11265 by ArcEye
Replied by ArcEye on topic Re:on the fly config
A search on the forum for 'slave drive' gives this thread

www.linuxcnc.org/component/option,com_ku...tart,0/lang,italian/

It looks like that is exactly what gantrykins does, homes independently and then slaves the paired drives.

Others will be able to give you chapter and verse once you have read up on gantrykins

regards

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

More
08 Jul 2011 15:28 - 08 Jul 2011 15:29 #11270 by btvpimill
Replied by btvpimill on topic Re:on the fly config
Ok, I read the thread and the reference for gantrykins that I found (1 page or so). It looks like a very nice tool, but I don't see how I would unslave them while running a part. (I guess I really need to put a pic of my machine here somewhere, it may make more sense then)

So My question stands, can this be done? If I at least feel sure it can, I will chase down all the info that seems relevent and try to work this out. If not, I will continue the way I am going, which is to just address Y and V (& Z,W) with the same commands when I am in mill mode.
Last edit: 08 Jul 2011 15:29 by btvpimill. Reason: at least 1 typo

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

More
08 Jul 2011 15:39 #11271 by andypugh
Replied by andypugh on topic Re:on the fly config
btvpimill wrote:

So I would boot with X,Y,Z,A,V,W, then slave V to Y and W to Z. Then unslave them at will.


That does sound like a gantry setup, so the earlier answer might work.

Yes, there are ways to do this, but I am not sure how un-slaving would work out. Would you want V to change to suit the current position, or would you want the motor to move to the V position it was at before it was slaved to Y?

This is the simplistic way that doesn't allow either of those approaches, using two user-defined G-codes.

M100
#!/bin/sh

# M100 in your G code program will link the V motor to the Y stepgen
# assuming that it is linked to p-port pins 01 and 02. and the Y-step signal is called Y-step in the HAL file. 

halcmd unlinkp parport.0.pin-00-out
halcmd unlinkp parport.0.pin-01-out
halcmd linkp parport.0.pin-00-out Y-Step
halcmd linkp parport.0.pin-01-out Y-Dir

M101
#!/bin/sh

# M100 in your G code program will link the V motor to the Y stepgen
# assuming that it is linked to p-port pins 01 and 02. and the Y-step signal is called Y-step in the HAL file. 

halcmd unlinkp parport.0.pin-00-out
halcmd unlinkp parport.0.pin-01-out
halcmd linkp parport.0.pin-00-out V-Step
halcmd linkp parport.0.pin-01-out V-Dir

This only does one axis, is totally untested, and assumes a parallel-port setup.

I feel that the best way might be with a HAL component that can do a bumpless transfer, inserted in the position-command signal upstream of the stepgen, and programmed to smoothly blend the output command between two possible inputs, whilst lying about the position to the V feedback pin.

Alternatively, perhaps use the HAL "offset" function to offset the V stepgen commanded position by the difference between the V axis command and the Y axis command.

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

More
08 Jul 2011 17:12 #11273 by btvpimill
Replied by btvpimill on topic Re:on the fly config
Thank you Andy, The best case would be that V kept track of its current position, but really it doesn't matter. I could call the M1xx's from the tool change sub's, that way the position of V and W would always be know. ie: If I move Y,V to 10. slave v, then before unslavingv move to Y10. This way V may just keep its position of 10 the whole time. Of course Z,W are the same situation so no need to discuss them also.

Also calling them from the tool changes makes the most sense as that is when I would want the slave/unslave to happen.

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

More
11 Jul 2011 00:10 #11370 by btvpimill
Replied by btvpimill on topic Re:on the fly config
Andy, I have tried your suggestion and it works perfectly. I will add the linkp needed to be linksp or linkps. But the manual came to my rescue once I knew what I was looking for. In fact, per the manual, I ended up using the net command instead.

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

More
11 Jul 2011 12:00 #11388 by btvpimill
Replied by btvpimill on topic Re:on the fly config
Now things are just becoming too much fun. Next question, if I want V to keep track of its current position even though it is slaved to Y, Given the folloiwing snippets from my hal file:

# Y [1] Axis - stepgen [1]
# ################################################
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 32000
setp stepgen.1.dirsetup 32000
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable

# V [7] Axis - stepgen [4]
# ################################################
setp stepgen.4.position-scale [AXIS_7]SCALE
setp stepgen.4.steplen 1
setp stepgen.4.stepspace 0
setp stepgen.4.dirhold 32000
setp stepgen.4.dirsetup 32000
setp stepgen.4.maxaccel [AXIS_7]STEPGEN_MAXACCEL
net vpos-cmd axis.7.motor-pos-cmd => stepgen.4.position-cmd
net vpos-fb stepgen.4.position-fb => axis.7.motor-pos-fb
net vstep <= stepgen.4.step
net vdir <= stepgen.4.dir
net venable axis.7.amp-enable-out => stepgen.4.enable


will it be as easy as :
halcmd unlinkp axis.7.motor-pos-fb
halcmd net ypos-fb stepgen.1.position-fb => axis.7.motor-pos-fb

Do I even have the correct signals? then of course I would undo that in the other M1xx.

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

More
11 Jul 2011 21:47 #11435 by eszyman
Replied by eszyman on topic Re:on the fly config
"halcmd unlinkp axis.7.motor-pos-fb" does indeed unlink the motor positioning to hal, but the net command seems lacking and I for one am out of ideas... perhaps your input and output is reversed?


Now I know the first part works because switching back give a joint following error hahah!

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

More
11 Jul 2011 21:59 #11437 by btvpimill
Replied by btvpimill on topic Re:on the fly config
OK, not sure but I think those are the wrong signals. I think the fb prolly stands for feedback, and since the axis(from stepgen's point of view) is not moving, the feedback prolly should not be either.

time to keep looking for that signal or pin that takes care of the position display.

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

More
11 Jul 2011 23:07 #11441 by andypugh
Replied by andypugh on topic Re:on the fly config
eszyman wrote:

Now I know the first part works because switching back give a joint following error hahah!


It will, because the -fb value and the -cmd value will be different, the definition of a following error.

You could set the V f-error to be wider than the machine travel, then look at the feedback rather than commanded value on screen. (toggle with the # key) and it might work. You might find that the machine is vaguely happy like that, or it might try to drive back to the original position once it gets control back.

Is this servo or stepper?

One thing that you might find useful is that
G0 V #5421
will drive the V axis to the same position as the Y axis. (#5422 for Z, etc)

When you would do that, I am not so sure.

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

Time to create page: 0.472 seconds
Powered by Kunena Forum