<div style="color:black;font: 10pt Arial, Helvetica, sans-serif;">Folks:
<div><br>
</div>

<div>Looks like I stuck a stick in an ant hill.</div>

<div><br>
</div>

<div>Karim used the word I couldn't think of: normalizing. Normalizing the calculated measurements to the actual time interval. It makes the code much more resilient. Fewer hardcoded parameters.</div>

<div><br>
</div>

<div>As with Dave, most of my stuff is dependent on the clocks of the audio hardware, not the CPU's clock. With several independent audio devices, I've had to provide a sync, a metronome. With purpose-built hardware, or professional audio hardware, an external clock can run everything, but I'm trying the use the cheapest stuff available, just to prove that it is possible.</div>

<div><br>
</div>

<div>Regarding a sync, Murray added an external interrupt to time the loop (not to timestamp the sensors together as I am doing). For the loop timing<span style="background-color: transparent; font-size: 10pt;">, why not use the hardware timers built into the local interrupt controllers instead of an external source? Maybe I'm wrong here (because I haven't tried it, and I don't need to try it), but all of the local interrupt controllers that I've read about have hardware timers that can be programmed to give repeating interrupts. I see that this is available on Android. I read that the Android average timing will be the programmed timing unless the ISR takes more time than the interval between interrupts. One interrupt can be posted, but a second interrupt at the same level is discarded if the first has not been cleared. Makes sense.</span></div>

<div><br>
</div>

<div>One of my points earlier this week was that the average time between loops would be, say, 50ms, even if the jitter was high. I was assuming a hardware interrupt, not a programmed delay.<br>
<br>
Do rabbits get along with fire ants?</div>

<div><br>
</div>

<div>Later,</div>

<div>John Swindle<br>
<br>

<div style="font-family:arial,helvetica;font-size:10pt;color:black"><font size="2">-----Original Message-----<br>
From: Karim Virani via DPRGlist <dprglist@lists.dprg.org><br>
To: Murray Altheim <murray18@altheim.com><br>
Cc: DPRG <dprglist@lists.dprg.org><br>
Sent: Fri, Feb 19, 2021 8:19 am<br>
Subject: Re: [Dprglist] PID-tuned Clock in Python?<br>
<br>

<div id="yiv4075943637">
<div>
<div dir="ltr">David, I agree with everything you said. Your crotchety oldfartdom is too rich for me. I fold. I was bluffing all along.
<div><br clear="none"></div>

<div>Murray, good luck with the bottomless rabbit holery! You've descended beyond my depth.</div>
</div>
<br clear="none">
<div class="yiv4075943637yqt3367795744" id="yiv4075943637yqt56633">
<div class="yiv4075943637gmail_quote">
<div class="yiv4075943637gmail_attr" dir="ltr">On Fri, Feb 19, 2021 at 12:29 AM Murray Altheim via DPRGlist <<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:dprglist@lists.dprg.org" target="_blank" href="mailto:dprglist@lists.dprg.org">dprglist@lists.dprg.org</a>> wrote:<br clear="none"></div>
<blockquote class="yiv4075943637gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">On 19/02/21 6:16 pm, David Anderson via DPRGlist wrote:<br clear="none">
> Howdy<br clear="none">
> <br clear="none">
> Karim, I can certainly match your downright nitpickery and am therefore<br clear="none">
> all in with crotchty oldfartdom.<br clear="none">
Man you crotchety old guys are _hard_core_. And nitpickery.<br clear="none">
<br clear="none">
I manage to wrangle my mean clock error down to about 0.09ms per 50ms loop<br clear="none">
(measured over 1000 iterations, even under system load), so less than a<br clear="none">
tenth of a millisecond error on a 50ms loop is just not good enough?!<br clear="none">
<br clear="none">
Woof. Woof woof and more woof.<br clear="none">
<br clear="none">
But *clearly* Ima gonna havata do bettera, or its le scarpe di cemento.<br clear="none">
Maybe down to una microsecondo prima del molo dei pescatori รจ il mio destino.<br clear="none">
<br clear="none">
I've updated the code so it's now a proper class with YAML configuration,<br clear="none">
etc. and updated the github repo at:<br clear="none">
<br clear="none">
    <a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="https://github.com/ifurusato/ros/blob/master/ext_clock_test.py">https://github.com/ifurusato/ros/blob/master/ext_clock_test.py</a><br clear="none">
    <a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="https://github.com/ifurusato/ros/blob/master/lib/ext_clock.py">https://github.com/ifurusato/ros/blob/master/lib/ext_clock.py</a><br clear="none">
<br clear="none">
[For those of us building robots on platforms that don't have access to<br clear="none">
fancy hardware clocks, we have to make do somehow. Ima tryin.]<br clear="none">
<br clear="none">
Cheers,<br clear="none">
<br clear="none">
Murray<br clear="none">
<br clear="none">
...........................................................................<br clear="none">
Murray Altheim <murray18 at altheim dot com>                       = =  ===<br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="http://www.altheim.com/murray/">http://www.altheim.com/murray/</a>                                     ===  ===<br clear="none">
                                                                    = =  ===<br clear="none">
     In the evening<br clear="none">
     The rice leaves in the garden<br clear="none">
     Rustle in the autumn wind<br clear="none">
     That blows through my reed hut.<br clear="none">
            -- Minamoto no Tsunenobu<br clear="none">
<br clear="none">
_______________________________________________<br clear="none">
DPRGlist mailing list<br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:DPRGlist@lists.dprg.org" target="_blank" href="mailto:DPRGlist@lists.dprg.org">DPRGlist@lists.dprg.org</a><br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org">http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org</a><br clear="none">
</blockquote></div>
</div>

</div>
</div>

<div class="yqt3367795744" id="yqt31355">_______________________________________________<br clear="none">DPRGlist mailing list<br clear="none"><a shape="rect" ymailto="mailto:DPRGlist@lists.dprg.org" href="mailto:DPRGlist@lists.dprg.org">DPRGlist@lists.dprg.org</a><br clear="none"><a shape="rect" href="http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org" target="_blank">http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org</a><br clear="none"></div>
</font></div>
</div>
</div>