Retry-Problem

Discussions, Bug Reports and Issues related to Beta versions of SharpCap
Post Reply
StarFlea
Posts: 66
Joined: Wed Dec 21, 2022 12:22 pm

Retry-Problem

#1

Post by StarFlea »

Hi Robin,

while testing my Alt/Az problem I encountered another problem: My plan was that if the plate solver should fail to solve (for whatever reason), I should take a little wait of 2 seconds and then do the two steps Solve + wait 2 sec to be retried 10 times (see attached sequence).

However, the sequence hangs after the first attempt (screenshot) and must be stopped manually.
PS-Test.JPG
PS-Test.JPG (122.7 KiB) Viewed 523 times
To test the plate solving (with ASTAP) I loaded a pretty bad image into the monitor camera and used the EQMOD simulator as mount. When testing I used the latest SharpCap version (4.1.10745.0).

In earlier tests with the version 4.1.10700.0, the 10 solver attempts ran through, but always without the 2-second wait (I thougt the error-retry works like a loop!?) ...

Best Regards!
StarFlea
Attachments
PS_00001.jpg
PS_00001.jpg (730.38 KiB) Viewed 523 times
PS-Test.scs
(275 Bytes) Downloaded 29 times
Log_2023-06-06T21_23_49-16604.log
(94.78 KiB) Downloaded 27 times
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Retry-Problem

#2

Post by admin »

Hi,

as far as I can work out from the log, the issue here is that you are using the 'Folder Monitor Camera' for testing, but there is only one frame for it to use. When the retry of the plate solving happens, the sequence wants to collect a new frame from the camera for the second attempt, so it sits there waiting for a new image to be dropped into the 'C:\CCD\Capture\00_55_13' folder, which never happens.

Of course, because the controls are locked while the sequence is running you cannot press the 'replay' button on the folder monitor camera to replay the single frame again. Probably the best idea for this sort of thing if you are testing is to use 'Test Camera 1 (Deep Sky)' - that will also load an image from file, but repeats it again and again.

cheers,

Robin
StarFlea
Posts: 66
Joined: Wed Dec 21, 2022 12:22 pm

Re: Retry-Problem

#3

Post by StarFlea »

Hello Robin,

that makes sense! I could have actually thought of that! ;)
It works with the DeepSky camera, but I can't see from the current process and the log that the 2-second wait is being executed...
Retry.JPG
Retry.JPG (170.57 KiB) Viewed 485 times
StarFlea
Attachments
Log_2023-06-07T14_57_19-15512.log
(184.48 KiB) Downloaded 23 times
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Retry-Problem

#4

Post by admin »

Hi,

that's correct. Since the wait is after the plate solve it won't run unless the plate solve succeeds.

The way the retry step works is that the first failure causes it to go back to the beginning without running the remaining steps inside the retry. If you want the delay to occur between attempts, put it before the plate solve step.

cheers,

Robin
StarFlea
Posts: 66
Joined: Wed Dec 21, 2022 12:22 pm

Re: Retry-Problem

#5

Post by StarFlea »

Ah, all right! That makes sense too!

Best regards!
StarFlea
StarFlea
Posts: 66
Joined: Wed Dec 21, 2022 12:22 pm

Re: Retry-Problem

#6

Post by StarFlea »

Although I assumed that if an error occurs, the steps below would be executed.

In this case, a sequence block that is only executed if an error occurs might be of interest...
For example, in certain cases it would only make sense to wait after an error has occurred...

StarFlea
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Retry-Problem

#7

Post by admin »

Hmm, yes, that would make sense. I think I have avoided it so far because it is not a simple thing to do with the current editing UI... Such a step would require *two* sets of substeps - the main ones and the ones to run on an error. I'm all set up for blocks with a single set of substeps, but not for two :(

cheers,

Robin
StarFlea
Posts: 66
Joined: Wed Dec 21, 2022 12:22 pm

Re: Retry-Problem

#8

Post by StarFlea »

Well, I don't know what programming language SharpCap was created in and I'm not good with Phyton either, but Java offers try-catch blocks for error handling.
I think they are called try-except in Python.

But you're right, in this case the sequence block should consist of the regular code and the error handling code.

Maybe you can program such a sequence block specifically, i.e. leave the regular code section open for the user and the error handling section specifically as a wait command with an adjustable waiting time. If you put the whole thing in a loop, you can run it as many times as you want (or just once). I can't think of any other sensible command sequence than waiting in the event of an error...

In Java I would (roughly) implement it like this:

Code: Select all

boolean error = false;
do{
      try{
           /*regular code*/
           error = false;
      catch (Exception e){
           wait(getSeconds());
           error = true;
      }
}while(error);
StarFlea
User avatar
admin
Site Admin
Posts: 13350
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Retry-Problem

#9

Post by admin »

Hi,

I think that there are other recovery options that might make sense in some cases - for instance to disconnect and reconnect a piece of hardware.

SharpCap is written in C#, so I have exceptions and exception handling to use in the implementation - the problem is providing a fairly clean way to expose that in the sequence editor... Ideally without needing to build too much new code for what is a bit of an edge case feature.

The sort of 'hack' way I came up with to deal with this is to use subroutines - either the error handling or the main code could be in a subroutine and that would let me have a single block of sub-code. I don't really feel comfortable with that though - it feels 'stretched' and I think I may go for the two sub-block option when I have some time.

cheers,

Robin
Post Reply