Thanks andy, I have issues interfacing with index-enable with hal's net command. right no I have :
net name1 mirror.0.index ppmc.0.encoder.07.index net ppmc.0.encoder.03.position => mirror.0.actual net name2 ppmc.0.encoder.07.position => mirror.0.mirror and my miror.comp code is -------------------------- *component mirror "index-enable hack";pin in bit index;pin in float actual;pin in float mirror;pin out bit enable;pin out float result;function_;license "GPL"; // indicates GPL v2 or later;;if(index == 1){ result = actual - mirror; enable = 1;}* --------------------------- I don't see why I would need a state, but more on that later. The code work "once" when I manually execute : setp ppmc.0.encoder.07.index-enable 1 But what I need is for ppmc.0.encoder.07.index-enable to be re-enabled at each servo cycle. I would also prefer ppmc.0.encoder.07.position to be reset to ppmc.0.encoder.07.position right after, but I don't think it is possible, so I will do this in post treatment Anyways the plan is to capture mirror.0.out in halscope along with both encoder positions. I should have everything I want to infer ppmc.0.encoder.07.position's at the time my trgigger is pulsed. the thing is, I can't seem to use index-enable with the net command. HAL sends me errors no matter what I try. for example: Signal 'name3' can not add I/O pin 'ppmc.0.encoder.07.index-enable', it already has OUT pin 'mirror.0.enable' Signal 'name3' can not add I/O pin 'ppmc.0.encoder.07.index-enable', it already has OUT pin 'mirror.0.enable' while executing "hal net name3 mirror.0.enable ppmc.0.encoder.07.index-enable" ("eval" body line 1) invoked from within "eval hal $what" (procedure "showEx" line 2) On Thu, May 17, 2018 at 9:24 AM, andy pugh <bodge...@gmail.com> wrote: > On 17 May 2018 at 13:34, Maxime Lemonnier <maxime.lemonn...@gmail.com> > wrote: > > > 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. > > If you are writing a custom .comp then I would source the index-enable > signal from that. > > It isn't clear from your description precisely when you want this to > happen, but I imagine that choosing the conditions is also something > easiest inside the custom component. > > HAL comps for jobs like this tend to be coded as a state machine: > > pin out signed state = 0; > pin in float input1; > pin in float input2; > pin out float output; > ... > ;; > switch state{ > case 0: //readiness state > if (conditions){ > state = 1; > index_enable = 1; > } > case 1: // waiting for index > if (! index_enable){ > state = 2; > output = input1 - input2; > state = 2; > } > case 2: // we don't really need this state > state = 0; > } > > > -- > atp > "A motorcycle is a bicycle with a pandemonium attachment and is > designed for the especial use of mechanical geniuses, daredevils and > lunatics." > — George Fitch, Atlanta Constitution Newspaper, 1916 > > ------------------------------------------------------------ > ------------------ > 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