<div dir="ltr">Hi Samuel!<div><br></div><div>It could be too late, by the way here you are [1] a portable generic alternative I did several time ago.</div><div>As you can see at main.py [2], it is backward compatible ;)</div><div><br></div><div>Just add it to your PYTHON_PATH or to dist-packages and enjoy it.</div><div><br></div><div>[1] <a href="https://github.com/jderobot-varribas/drone1/blob/master/periodic_thread.py">https://github.com/jderobot-varribas/drone1/blob/master/periodic_thread.py</a></div><div>[2] <a href="https://github.com/jderobot-varribas/drone1/blob/master/main.py#L35-L43">https://github.com/jderobot-varribas/drone1/blob/master/main.py#L35-L43</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-05 3:19 GMT+01:00 samartin <span dir="ltr">&lt;<a href="mailto:samuel.martinm@gmail.com" target="_blank">samuel.martinm@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
In basic component, the timing of the thread is managed this way:<br>
<br>
        if (diff &lt; 0 || diff &gt; cycle)<br>
            diff = cycle;<br>
        else<br>
            diff = cycle - diff;<br>
<br>
Diff is the amount of time that it takes to execute the code, and cycle, how<br>
much time it should take the entirely cicle. What I do not understand is why<br>
if the code takes more time to execute than the cycle, it waits even longer.<br>
Wouldn&#39;t it be better to do something like this?:<br>
<br>
        if (diff &lt; 0 || diff &gt; cycle_gui)<br>
            diff = 0;<br>
        else<br>
            diff = cycle_gui - diff;<br>
<br>
Samuel<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://jderobot-developer-list.2315034.n4.nabble.com/Doubt-about-timing-in-some-threads-tp4642950.html" rel="noreferrer" target="_blank">http://jderobot-developer-list.2315034.n4.nabble.com/Doubt-about-timing-in-some-threads-tp4642950.html</a><br>
Sent from the Jderobot Developer List mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Jde-developers mailing list<br>
<a href="mailto:Jde-developers@gsyc.es">Jde-developers@gsyc.es</a><br>
<a href="http://gsyc.escet.urjc.es/cgi-bin/mailman/listinfo/jde-developers" rel="noreferrer" target="_blank">http://gsyc.escet.urjc.es/cgi-bin/mailman/listinfo/jde-developers</a><br>
</blockquote></div><br></div>