Hi Gene,

My use case has nothing to do with machining. I'm using a cnc mill as a
precise robot. For the benefit of an eventual future user with the same use
case, imagine you have a camera with a signal that triggers at the begining
of each capture, and that you're capturing during CNC motion. suppose you
want to the the PRECISE moment when the capture started. Well se my
previous message and use that code:

net name0 ppmc.0.encoder.03.position mirror.0.actual #I acutaly used linksp
Apos-fb => mirror.0.actual
net name2 ppmc.0.encoder.07.position mirror.0.mirror
net name1 ppmc.0.encoder.07.index mirror.0.index
net name3 ppmc.0.encoder.07.index-enable mirror.0.enable

-------------------
component mirror "index-enable hack";
pin in bit index;
pin in float actual;
pin in float mirror;
pin io bit enable;
pin out float result;

function_;
license "GPL"; // indicates GPL v2 or later
;;

if(index == 1)
{
    result = actual - mirror;
    enable = 1;
}

you will obtain



the little plateaux in mirror.0.result are the position at which frame
started.



On Thu, May 17, 2018 at 10:24 AM, Gene Heskett <ghesk...@shentel.net> wrote:

> On Thursday 17 May 2018 08:34:27 Maxime Lemonnier wrote:
>
> > Hi all,
> >
> > I'm trying to implement a somewhat exotic behavior with EMC2. I have a
> > servo setup with two Pico Systems univpwm boards. I have spare encoder
> > channels I want to use to precisely checkpoint the position of a
> > channel when an external signal is triggered. So I have, concretely,
> > encoder.03's A and B wires connected to two different univpwm channels
> > (channels 3 and 7, so in HAL, ppmc.0.encoder.03 and ppmc.encoder.07).
> >
> > encoder.03's Z wire is connected to channel 3 BUT NOT to channel 7. My
> > trigger is connected to channel 7's Z.
> >
> > I would like to configure HAL to simply zero-out channel 7 when it
> > receives the trigger pulse, then I would write a comp that output the
> > position at which the trigger was pulsed using the delta between
> > encoder 3 and 7.
> >
> > How could I achieve that?
> >
> > Thank you very much.
>
> Not exactly a solution, but from the man 9 encoder page,
>   encoder.N.reset bit in
>       When true, counts and position are reset to zero immediately.
>
> but you are zeroing the encoder generating the z pulse.  And I don't grok
> the reason. I could see useing 3's z to zero the #7 encoder for some
> purpose on a dual motor gantry axis, but since I don't have one of those
> critters, its not something I've needed to do. Perhaps you could expand
> on what the result should be?
>
> A pair of mux2's used as sample-holds, feeding a sum2 with one inputs
> scale setp'd to -1, will give you a diff between the encoders, but not
> knowing the reason, the control of the mux2.sel's will be up to you
> to 'net' up in your .hal files.
>
> Because there is intertia in the mechanicals slowing the turn-around time
> at the bottom of a g33.1 rigid tap, something I usually do by wrapping
> it in a peck cycle because the G0704's draw bolt is such a puny thing I
> can't grab a tap by the shank and stop the slippage, I am useing 2
> mux2's as sample-hold's, feeding the sum2 with one inputs scale set
> to -1.000000, each mux2's active input feed from encoder.0.position, but
> one mux2.sel is tied to motion's reverse signal freezing it when motion
> issues the spindle-reverse command, and the 2nd mux2.sel is watching
> encoder.0.velocity to detect that the spindle has actually moved one
> count in reverse. The sum2 output is then the difference in counts. With
> a one count diff as the error budget. Thats 1.5 degrees of spindle
> rotation on the Sheldon but a very small fraction of a degree on the
> G0704 due to the location of the encoders a/b signals. There's more of
> course so the axis display is stable but thats the gist of it.
>
> Without knowing more, I can't suggest more.
>
> --
> Cheers, Gene Heskett
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page <http://geneslinuxbox.net:6309/gene>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to