<div style="color:black;font: 10pt Arial, Helvetica, sans-serif;">I always wondered why anyone had a lead pipe laying about. Clueless.<br>
<br>
<br>

<div style="font-family:arial,helvetica;font-size:10pt;color:black">-----Original Message-----<br>
From: Murray Altheim via DPRGlist <dprglist@lists.dprg.org><br>
To: dprglist@lists.dprg.org<br>
Sent: Tue, Jan 26, 2021 7:24 pm<br>
Subject: Re: [Dprglist] KD01 Rotate in Place video<br>
<br>

<div dir="ltr">On 27/01/21 1:33 pm, John Swindle via DPRGlist wrote:<br clear="none">> Murray,<br clear="none">> Good diagnostic tests.<br clear="none">> I am clueless about Python, but, Yes, your timestamps show <br clear="none">> something you didn't intend. I've read the rationale of <br clear="none">> Python and some of the code documentation, but I still can't<br clear="none">> read and understand a single line of it.<br clear="none"><br clear="none">Hi John,<br clear="none"><br clear="none">I guess your mileage may certainly vary as regards Python. I've<br clear="none">been programming in many languages since the late 1970s and came<br clear="none">to Python rather late, but I can't share your feelings about it.<br clear="none"><br clear="none">Worries about performance aren't so much a concern when running<br clear="none">on the CPUs we do nowadays. A Raspberry Pi runs at 1.4GHz, the<br clear="none">ARM Cortex M0-4 processors are running from 48MHz up to 120MHz<br clear="none">range, the Orange Pi is a 2.0GHz quad-core, the NanoPi Fire<br clear="none">runs 8 cores at 1.4GHz. So we're no longer dealing with the<br clear="none">16MHz of older Arduinos. I'm not suggesting that throwing metal<br clear="none">at a problem is a good way to solve performance issues, but the<br clear="none">bottleneck in 2021 isn't likely to be the Python interpreter,<br clear="none">certainly not on a small robot.<br clear="none"><br clear="none">For myself, I've really enjoyed working with it as a language<br clear="none">and a developer "ecosystem", and have found it very quick to<br clear="none">learn. Coming from over twenty years as a Java infrastructure<br clear="none">developer I thought I might miss Java but actually almost prefer<br clear="none">Python for projects where it makes sense (e.g., not for large<br clear="none">infrastructure systems). And I like the syntax, nowadays even<br clear="none">more than Java. But I also realise this kind of thing is<br clear="none">entirely down to taste/aesthetics.<br clear="none"><br clear="none">The one real driver for me is that I'm using mostly Adafruit,<br clear="none">Pimoroni and PiBorg hardware on my robots, all of which are<br clear="none">supported by Python libraries. The choice of language was a<br clear="none">simple matter of accepting that robots using this kind of<br clear="none">hardware would be programmed in Python.<br clear="none"><br clear="none">> When I read that Python is still an interpreted language with<br clear="none">> very slow execution rates and non-deterministic rates, I quit<br clear="none">> learning about it. It's OK for things where time doesn't matter,<br clear="none">> like web pages or bulk transfers, but not for real-time things.<br clear="none">> Maybe I'm overlooking a real-time Python.<br clear="none"><br clear="none">My one real issue with Python is its threading implementation,<br clear="none">which while looking a lot like (and influenced by) Java isn't<br clear="none">really a true multi-threading system. I've had to work around<br clear="none">that. For single threaded applications the choice of Python<br clear="none">would make very little difference performance-wise.<br clear="none"><br clear="none">My own issues could also be down to my style of programming, as<br clear="none">I am using multi-threading, in particular for the PID loops.<br clear="none">It's entirely possible the timing issues are due to that, or<br clear="none">due to me running on Linux on a Raspberry Pi (a time-sharing OS)<br clear="none">rather than natively on a microcontroller. I am considering<br clear="none">running my robot's Python OS on an RP2040 to see if this makes<br clear="none">any difference.<br clear="none"><br clear="none">> So, I wonder if the lack of 50ms repeatable intervals is due<br clear="none">> to the way Python works, and not your fault.<br clear="none"><br clear="none">Well, I wouldn't say that's impossible but at this point I'm<br clear="none">putting this down to some fault on my part.<br clear="none"><br clear="none">> When I see stuff like this in my code, I try to force the <br clear="none">> interval by using a timer that I trust, or a loop that tunes <br clear="none">> itself, kinda like a PLL. PITA.<br clear="none"><br clear="none">As things stand, the PID call function returns the last value<br clear="none">set if called prior to the normal interval, so there's an element<br clear="none">of self-healing in the code now. In this case the value returned<br clear="none">would be 0.0 as the robot had been at rest. And in looking more<br clear="none">carefully at the code, it's not even clear that the timing is<br clear="none">the cause of the surge. I'm still digging...<br clear="none"><br clear="none">In other words, trying to figure out what's happening is all a<br clear="none">bit of an Agatha Christie novel.<br clear="none"><br clear="none">> Sorry to beat a dead horse, but wiggling the output gears <br clear="none">> might not tell you anything. The ratios may be so high, and<br clear="none">> there may be gear types in the gearbox that cannot transmit<br clear="none">> power backwards to the motor. The output shafts could be <br clear="none">> tight, and there could still be lots of gear slop on the <br clear="none">> input shaft. If you can spin the motors by manually spinning<br clear="none">> the wheels, then disregard this.<br clear="none"><br clear="none">The OSEPP motors I'm using have a 1:45 gear ratio, and yes, I can<br clear="none">spin the motor by turning the wheels. So I'm sticking with the<br clear="none">problem being entirely software. Mrs. Peacock in the conservatory<br clear="none">with the candlestick. Or the lead pipe. Or maybe Colonel Mustard<br clear="none">in the kitchen with the revolver.
<div class="yqt0817030845" id="yqtfd97585"><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 shape="rect" href="http://www.altheim.com/murray/" target="_blank">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 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>
</div>
</div>
</div>