On Mon, Jul 20, 2009 at 11:23:55AM +0100, Leslie Newell wrote:
> Has anyone tried turning a cam on a lathe using EMC? I tried using lots 
> of G33 moves but they seem to get out of sync. My machine has pretty 
> high acceleration and top speed but even at very low spindle speeds 
> (14rpm) it doesn't seem to keep up.

Without seeing your gcode, I am going to take a guess that the problem
is one of two things: you have lots of tiny moves, or you did not
properly calculate your K values.

emc's spindle synchronized motion is more or less the traditional motion
planner, but using spindle angle instead of time to control the forward
progress.  Specifically, it has the same behavior when there are a lot
of small segments: it will plan each individual move so that it can stop
by the end of that move and stay within machine constraints.

> Does EMC have any other way of doing synchronised moves apart from G33/G76?

emc and gcode don't, but of course hal does.  You could create a
component which offsets the commanded X according to the spindle angle
and the shape of the cam.  The component would include the mathematical
description of the cam shape, r=f(theta)+r0.  It would take as inputs
the spindle angle and the commanded motor position (r0), and output the
modified motor position (r)

    net Xpos-cmd => camcutter.pos-cmd-in
    net Xpos-cam-cmd camcutter.pos-cmd-out => stepgen.0.motor-pos-cmd # or 
whatever

    net Xpos-cam-fb stepgen.motor-pos-fb => camcutter.pos-fb-in
    net Xpos-cb <= camcutter.pos-fb-out

    net spindle-revs => camcutter.spindle-revs

    net cam-enable motion.digital-out-nn => camcutter.enable

In emc 2.3 and above double precision numbers are used for hal "floats",
so you can probably skip messing with index-enable and just use theta =
2*pi*spindle_revs for a periodic function f().

In your component, you have something like this:
    if(enable) {
        double theta = spindle_revs * 2 * M_PI;
        double displacement = f(theta);
        motor_pos_cmd_out = motor_pos_cmd_in + displacement;
        motor_pos_fb_out = motor_pos_fb_in - olddisplacement;
        olddisplacement = displacement; // (instance variable)
    } else {
        motor_pos_cmd_out = motor_pos_cmd_in;
        motor_pos_fb_out = motor_pos_fb_in;
    }
but this gives a step discontinuity when enable changes.  You need to
embellish it with code to slow apply and unapply the displacement.  Such
code is in emc/motion/simple_tp.{c,h} in "libraryish" form.  (I'd be
tempted to just copy both into a single header, change simple_tp_update
to be static, and include the header)

Jeff

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to