Bug 419426

Summary: polynomial focus routine generates out-of-bound positions
Product: [Applications] kstars Reporter: Hans Lambermont <hans>
Component: generalAssignee: TallFurryMan <eric.dejouhanet>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: git   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screenshot of focuser tab
screenshot of indi control panel

Description Hans Lambermont 2020-03-30 18:04:03 UTC
Created attachment 127118 [details]
screenshot of focuser tab

SUMMARY
The polynomial focus routine can generate out-of-bound positions, the INDI focuser device driver then throws an error and refuses to instruct the physical focuser to go to the beyond-maximum position, but the polynomial focus routine stops here and the entire ekos schedule stops.
The good news is that a bad weather event still manages to park the mount and close the roof. Phew.

STEPS TO REPRODUCE
1. have the optimal focus point close to the maximum, or as an edge case :
2. move the focuser to the maximum position and start the autofocus routine.
3. 

OBSERVED RESULT in the EKOS focuser tab (apparantly CEST tz)
2020-03-30T02:11:49 Autofocus failed, moving back to initial focus position 188600.
2020-03-30T02:11:49 Focuser error, check INDI panel.
2020-03-30T02:11:49 Focusing outward by 20000 steps...
2020-03-30T02:11:49 FITS received. HFR 1.65 @ 188600. Delta (15.4%)
2020-03-30T02:11:49 Image received.
2020-03-30T02:11:43 Capturing image...
2020-03-30T02:11:43 Please wait until image capture is complete...
2020-03-30T02:11:43 Image received.
2020-03-30T02:11:36 Capturing image...
2020-03-30T00:36:28 Autofocus complete after 3 iterations

and in the INDI control panel : (apparantly UTC tz)
2020-03-30T00:11:49: [INFO] Focuser is moving to position 188600
2020-03-30T00:11:49: [ERROR] Requested position out of bound. Focus maximum position is 188600

EXPECTED RESULT
Do not try to move to a position over the focuser max.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 18.04.4 LTS
kstars-bleeding 6:3.4.1+202002231737~ubuntu18.04.1 amd64

ADDITIONAL INFORMATION
Comment 1 Hans Lambermont 2020-03-30 18:06:33 UTC
Created attachment 127119 [details]
screenshot of indi control panel
Comment 2 Jasem Mutlaq 2020-06-15 17:41:38 UTC
Ekos scheduler fails completely when focus fails?
Comment 3 Hans Lambermont 2020-06-15 18:26:14 UTC
Yes, the scheduler stops in this case.

Focus failed on 2020-03-30T02:11:49.833

```
[2020-03-30T02:11:49.833 CEST INFO ][     org.kde.kstars.ekos.focus] - "Autofocus failed, moving back to initial focus position 188600."
[2020-03-30T02:11:49.837 CEST INFO ][           org.kde.kstars.indi] - Integra85 :  "[ERROR] Requested position out of bound. Focus maximum position is 188600 "
[2020-03-30T02:11:49.838 CEST DEBG ][ org.kde.kstars.ekos.scheduler] - Focus State "Aborted"
[2020-03-30T02:11:49.923 CEST INFO ][           org.kde.kstars.indi] - Integra85 :  "[INFO] Focuser is moving to position 188600 "
```

Nothing happened from that time on until 2 hours later the Weather Safety Proxy said `Weather is UNSAFE` after which the scheduler stopped the job and shut down the observatory.