2017-08-12, 03:54 PM
25% usage sounds like one of the four raspberry pi cores is completely blocked. And looking at the code, this makes sense. The while does not sleep at all, if IMURead and HandleRequests are faster than 0.1 second.
I guess the other way around was meant?
if dt < .1:
time.sleep(dt)
Still i find the variable sleep time amount weird.
Maybe time.sleep(.1-dt) makes more sense? Therefore IMURead() and HandleRequest are only called at most every .1 seconds.
______________________________
Testing the first change, read_sensors_d goes from 100% of one core to ~35%, adding in the second change brings it down to ~1%. No adverse effects on the visible sensor response. Sean, any adverse effects on pypilot calculations?
I guess the other way around was meant?
if dt < .1:
time.sleep(dt)
Still i find the variable sleep time amount weird.
Maybe time.sleep(.1-dt) makes more sense? Therefore IMURead() and HandleRequest are only called at most every .1 seconds.
______________________________
Testing the first change, read_sensors_d goes from 100% of one core to ~35%, adding in the second change brings it down to ~1%. No adverse effects on the visible sensor response. Sean, any adverse effects on pypilot calculations?