On 26 July 2011 02:32, Dave <[email protected]> wrote:

> My question is:  What would be the best way to implement this two "X"
> axis control scheme with EMC2?

In some ways the hard part is the easy part, but there will be an
unexpected tricky part.

Is this a servo machine or a stepper machine?

You could switch which axis is controlled by X using the HAL mux2 function:
Wire axis.0.motor-pos-cmd to the mux input, a front-panel button to
the mux selector bit, and then wire the two outputs to each of the
stepgens or PIDs. A parallel mux2 would swap over the ...position-fb
signals.

Alternatively, you could link the swap button to M1nn commands. That
way you could do the swap both inside the G-code and as an MDI_COMMAND
linked to the physical button.
M101
#!/bin/bash
unlinkp stepgen,0.position-cmd
unlinkp stepgen.0.position-fb
linksp x-cmd stepgen.3.position-cmd
linksp x-fb stepgen.3.position-fb

M102
#!/bin/bash
unlinkp stepgen,3.position-cmd
unlinkp stepgen.3.position-fb
linksp x-cmd stepgen.0.position-cmd
linksp x-fb stepgen.0.position-fb

The problem with both approaches is synchronising the new axis
physical position with the internal position inside the motion
planner.

I think the simplest solution might be to put a limit3 function
between the output of the mux and the input of the stepgen/PID, then
the stepgen/PID would move at a max speed governed by the limit2 accel
and velocity limits (which would need to be set from the same INI file
parameters as the motion controller uses).
There would still be a problem with the position feedback, I am not
entirely sure how to fix that without using a custom HAL component.
(Though, in honesty, I would have started on a custom component some
steps ago if it was my own machine)

It might be clever to treat the swap as a toolchange. That way you
could set the "TOOLCHANGE_AT_M30" option, and eliminate the
axis-to-motion synchronisation problem. You could also handle the
Y-axis part of the table swap as a simple tool offset in the Y
direction.

Is suspect that there is a clever way to synchronise the physical and
nominal position of the axes using coordinate systems. If one table is
G54 and the other is G55 then using the previous M-Code files, and
calling them from a subroutine with something like :

O<table_swap> SUB
   O100 IF [#5220 EQ 1]
        #5001 = #5420 (store the current X)
        G10 L20 P2 X[#5002]
        G10 L2 P2 Y +24
        G55
        M101
    O100 ELSE
        #5002 = #5420 (store the current X)
        G10 L20 P2 X[#5001]
        G10 L2 P2 Y 0
        G54
        M102
    O100 ENDIF
O<table_swap> ENDSUB
M2

Might work.

Thinking some more, just a simple G0 X0 in the above code might be a
whole lot simpler. The code above could be used if there are encoders
and the operator is able to manually move the table if the encoder
position was linked to a G-code analogue input. (I haven't found a way
to set the coordinate systems from the command line, but that out to
also work if it can be done)


So, there you are, three half-complete and different approaches
presented in a stream-of-conciousness way :-)

-- 
atp
"Torque wrenches are for the obedience of fools and the guidance of wise men"

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to