Real Time Computing challenges.

Re-writing ScopeDog into Python wasnt too difficult once I discovered the trick to getting a loop to maintain precise timing. If you’re interested, insert this into a while loop. This will ensure a precise 1 second period. (The rest of the loop can take a variable amount of time, as long as it is always less than 1 second.)

remain = 1-(time.time() % 1)

But once I started to connect and combine my eFinder and SkySafari, things got difficult. All three components, ScopeDog (the drive), eFinder (capture & plate-solving) and SkySafari (control and insatiable desire for position fixes!). Python wouldnt normally be used for real time computing applications, but it is very suited to astronomy calculations and nice to work with.

ScopeDog must maintain an exact 1Hz tempo to keep its tracking accurate, but this needs to pause cleanly when a goto, move or joystick actions is executed.

The eFinder needs time to get an image and solve it. This can take 2-5 seconds and may even fail.

SkySafari just solders on demanding positon fixes at least every second and throws an error if it doesnt get timely or well formatted answers.

Most issues were overcome by creating a separate Python thread for each of these three functions. This worked but still often one thread is waiting for results from another. This was then resolved by creating a 'virtual encoder’ scope position, shared by all threads. This positon is maintained by the 1Hz ScopeDog thread by using plate-solves results whenever available and computing a theoretical position inbetween times based on tracking and other scope moves.

Its working, just. At least well enough to try on the scope at night. 

© AstroKeith 2022