<table><tr><td style="">TallFurryMan created this revision.<br />TallFurryMan added reviewers: mutlaqja, wreissenberger.<br />Herald added a project: KDE Edu.<br />Herald added a subscriber: kde-edu.<br />TallFurryMan requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15073">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">Consider a mount that cannot park is always unparked. This fixes the state of the mount as seen by the Scheduler when the mount cannot park.</li>
</ul>

<ul class="remarkup-list">
<li class="remarkup-list-item">Ensure getting parking state returns a valid state, even if last action was failed. This fixes an issue arising when parking operation is aborted, that caused the Mount interface to always return PARKING_ERROR.</li>
</ul>

<ul class="remarkup-list">
<li class="remarkup-list-item">Make the Scheduler use isMountParked when starting in case the state machine is not up-to-date. This fixes the issue where the Scheduler is started with a mount parking state that was manipulated from the INDI panel in-between.</li>
</ul>

<ul class="remarkup-list">
<li class="remarkup-list-item">Fix remaining issues in transitions of the parking engine states. This fixes incorrect transitions in the state machine, unrelated to the actual state they were attempted in.</li>
</ul>

<p>The next changes prepare the rework of the D-Bus connection of the Scheduler towards an event-driven implementation.<br />
These improve Scheduler robustness by managing device events that are not reflected in the state machine.<br />
They consolidate on the parking state changes, and are pushed now because they fix remaining issues with job startup.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Refactor INDI connection status test, to avoid depending on the machine state.</li>
<li class="remarkup-list-item">Move unpark check down to the slew procedure.</li>
<li class="remarkup-list-item">Refactor state checks into a call to checkStatus, managing most external events.</li>
<li class="remarkup-list-item">Move job startup from evaluateJobs to executeJob.</li>
</ul></div></div><br /><div><strong>TEST PLAN</strong><div><p>As this differental relates to parking states, use a basic scheduler job with only tracking set.<br />
Uncheck "Stop Ekos After Shutdown" in the Ekos options to avoid losing driver states when the job finishes.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Start Scheduler, check job/Ekos/INDI are started, executed and terminated.</li>
<li class="remarkup-list-item">Test with "UnPark Mount" and "Park Mount" checked and unchecked.</li>
<li class="remarkup-list-item">Test with a Scheduler stop in the middle of slewing or capturing, and a restart.</li>
</ul>

<p>Observe that if "UnPark Mount" is unchecked, the mount is still unparked ; this is by design.<br />
Option "UnPark Mount" is here to make sure the order of unparking is honored.<br />
This will be replaced later by one single checkbox with that specific meaning.</p>

<p>Observe that if "Park Mount" is unchecked, the mount is NOT unparked at the end of the procedure.<br />
This is by design, and is clearly not symmetric with the "UnPark Mount" option, thus needs to be reworked.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Remove the capture storage.</li>
<li class="remarkup-list-item">Start Scheduler, check job/Ekos/INDI are started, and kill/disconnect indiserver.</li>
<li class="remarkup-list-item">Check that Scheduler cancels the running action, and attempts to restore connection with devices.</li>
<li class="remarkup-list-item">If indiserver is still accessible, Scheduler will reconnect and restart the job.</li>
<li class="remarkup-list-item">If indiserver is not accessible anymore, Scheduler will attempt to reconnect multiple times then stop.</li>
<li class="remarkup-list-item">If indiserver is accessible but not responsive, Scheduler will attempt to reconnect devices, fail then stop.</li>
</ul>

<p>Note that using a local Simulator makes it difficult to test because the system is really quick to recover.<br />
During that test, a remote indiserver is easier to test with, and allows for various test cases with the network.</p>

<p>Observe that Scheduler is unable to handle the case of a single device being disconnected. Later fix is required.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Remove the capture storage.</li>
<li class="remarkup-list-item">Start Scheduler, check job/Ekos/INDI are started, wait for mount slew to start.</li>
<li class="remarkup-list-item">Abort the slew while it is running.</li>
<li class="remarkup-list-item">Check that Scheduler does notice the problem and restarts the slew.</li>
<li class="remarkup-list-item">Park the mount while it is slewing.</li>
<li class="remarkup-list-item">Check that Scheduler does NOT notice the problem until the mount is parked, but then unparks and restarts the slew.</li>
<li class="remarkup-list-item">Park the mount then abort the park while it is running by unparking the mount, this causes IPS_ALERT on the parking property.</li>
<li class="remarkup-list-item">Check that Scheduler does notice the problem and restarts the slew.</li>
</ul>

<p>Originally a parking property in IPS_ALERT would cause the Mount interface to return PARKING_ERROR, causing confusion and hanging Scheduler.</p>

<p>Next test requires two runs, one with guiding NOT set, the other with guiding set. This is obviously an edge case.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Remove the capture storage.</li>
<li class="remarkup-list-item">Start Scheduler, check jobs/Ekos/INDI are started, wait for the mount to capture.</li>
<li class="remarkup-list-item">Park the mount.</li>
<li class="remarkup-list-item">Check that Scheduler does NOT notice the problem if guiding is NOT set, and continues to capture until the end of the job.</li>
<li class="remarkup-list-item">Check that Guider notices the problem though, but nonetheless resumes guiding before the mount is fully parked.</li>
<li class="remarkup-list-item">Check that situation cannot be recovered.</li>
</ul>

<p>Observe that while Guider notices mount is parking, guiding is resumed by stubborn Scheduler, and successfully guides when close to the pole because of the lower slew speed.<br />
This is obviously an edge case, and probably cannot be considered a valid test case as a mount that is parking may not answer to guide commands. Simulator does.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R321 KStars</div></div></div><br /><div><strong>BRANCH</strong><div><div>bugfix__make_parking_state_job_centric (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15073">https://phabricator.kde.org/D15073</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kstars/ekos/mount/mount.cpp<br />
kstars/ekos/scheduler/scheduler.cpp<br />
kstars/ekos/scheduler/scheduler.h</div></div></div><br /><div><strong>To: </strong>TallFurryMan, mutlaqja, wreissenberger<br /><strong>Cc: </strong>kde-edu, narvaez, apol<br /></div>