Implement FocusMax-style focusing algorithm

SGP could implement a similar focusing algorithm as used in e.g. FocusMax. It is very reliable, handles arbitrary out-of-focus situations and doesn’t change focuser movement direction for the final move, avoiding any backlash issues.

The process relies on measuring v-curves for your setup beforehand. Then the actual focusing process reduces to moving focuser to “far” focus on the correct side, seeking to a known position on the v-curve (“near” focus), and finally calculating the optimal focus position from the v-curves and making the final move there.

There’s a good writeup on the subject from AIC 2012: http://www.focusmax.org/Downloads/Precision%20Focusing%20Using%20FocusMax.pdf

I will preface by saying that I have used FocusMax since it was announced at the old “Imaging The Sky” conference in Salem. In fact, Steve and Larry told me that a talk I gave the year before at the same conference on how to (tediously) do manual focus served as a kind of “negative inspiration” (aka “there has got to be a better way”) to writing it. :wink:

Yes, FocusMax was the original accurate autofocus and it does have some advantages, mainly for narrowband as it only needs one fairly bright star (but may need a slew to find one). It also has some disadvantages. One of the disadvantages is also that it only needs a single star so can fall prey to close doubles, less than flat optics, and other single star issues. It also requires carefully prepared v-curves be prepared ahead of time for each optical configuration. If your wide-band filters are less than parfocal, it will require you to switch v-curve profiles if you are going to focus through the imaging filters (as opposed to offsets).

The bottom line is that one of the reasons I like SGP better than ACP/CCD Autopilot/MaxIm is that it does NOT use FocusMax. Years of experience with FocusMax and a year of using SGP have convinced me that the focus is at least as good with SGP (and perhaps better with the improved focus in 2.4 - too soon to tell). Of course I own high quality focusers, maybe FM does better with poorer focusers but I have always felt that band-aiding bad hardware with software is a really crappy idea (just my opinion but based on 20 years of imaging). As far as backlash, almost all focusers have backlash compensation as a feature and it is easy to set up in most cases so can be mostly dealt with at that level.

The bottom line is that I am going to say loud and clear that going to that focus method exclusively would be a huge step backward. I think it “ain’t broke” so don’t “fix” it. I suppose the SGP authors could implement something like that as an alternative focus method at some time in the future but I also suspect that right now there is an ocean full of “bigger fish to fry” for the authors in terms of features.

1 Like

I think a Focusmax-style focusing algorithm, where the V-curves are calculated beforehand, would be a great addition to SGP. It wouldn’t have to replace the current algorithm, maybe just serve as an alternative. Many who have a permanent observatory setup would probably prefer to spend 15-30 minutes to measure the V-curves once every few months, if that means the actual focus runs are quick. I know I would. Currently FocusMax automatically focuses my system in 30 seconds or less. With SGP it always takes more than 2 minutes. I agree with CCDMan that SGP shouldn’t use FocusMax as an application, but SGP could implement the algorithm. It is well documented, and very robust.

I agree with Ccdman, I always had to be very careful when I focused using Focusmax. Wrong size star? Fail. Nebulosity? Fail. I had to slew all over the sky to find a star.

I like SGP’s method. I can see some advantages to the focusmax method, but honestly it was the reason I gave up on MaximDL. SGP’s method just work.

I have a permanent observatory, have used FocusMax since (literally) day one, and prefer the SGP method. I think that when folks complain about SGP being “slow” (Focus and Solve and Synch are often mentioned), they are talking about very small total amounts of time compared to a night of imaging. Just one of the not-uncommon failed focuses with FocusMax will cost you more images than that. As far as the FocusMax method being robust, it is robust in theory and under ideal conditions. Operationally it is the opposite of robust and has, as mads0100 said, lots of fails. OTOH, I can not not remember that last time I had a failed focus with SGP.

As far as using the FocusMax algorithm in SGP instead of the current SGP method. Not just no but hell no!

I think you kinda missed my point and focused (hah) on FocusMax’s implentation details – I fully agree on its star selection woes etc. SGP already has a good HFR measure that uses stars from the whole frame instead of a single one and V-curve analysis built-in. What I’d like to see is just that instead of always going through the whole V-curve there would be an option for using stored V-curve parameters. This would reduce the number of focus exposures to 2-3 in the ideal case, and give the ability to focus from badly out-of-focus situations in reasonable time (personally I have a mobile setup with camera lenses so the initial focus is often quite a bit off).

Sure, focusing is only a portion of the total imaging time, but since weather is by far the biggest limitation in this hobby around here I’d rather have every small improvement that lets me spend more time exposing frames. Which would be around 5% for this specific request assuming 1,5 minute savings every 30 minutes. Everything adds up.

OK, I would not object to seeing pre-made curve profiles as a option as you describe. I would definitely object to either using a single star like FM does or to replacing the current curve method entirely with the FM pre-made curve method.

Having said that, I doubt I would use such a feature but I guess I would have to see it in action to say for sure. I would also have to doubt if this is very high on the feature list for the authors - I can think of a bunch of things that are way more important to me. Things like multi-camera and moble device monitoring would have much more impact on my imaging

1 Like

Thank you for your input. We currently have no plans to move to a FM style V curve profile. It has sufficient complexity and we feel like the AF algorithm, when used properly will not detract from your imaging time a significant amount. At most, scopes very sensitive to temperature will need to focus once every 30-40 minutes. Typical focus runs take 120-170 seconds. Over an 8 hour imaging session AF will cost you at most around 40 minutes. That estimate is pretty aggressive… the typical time the current method costs is about 20 min (~4% of imaging time) over 8 hrs or 2.5 min / hr.

How do we know this? We have analyzed more SGPro logs than I can count and have metrics that show this to be true.

The method you suggest above will take approximately 33% of the normal time to run (7 min over 8 hrs or ~ 1 min / hr). Essentially we are talking about complex software that we will need to support, debug an help tune for a savings in time that is fairly negligible.

That said, we do honestly appreciate your feedback.

I will echo OP’s suggestion to improve SGPro auto focus capability.

I have SGPro and auto focus feature is the only thing prevent me from using it, I like everything else. I tried multiple night (I could get perfect V curve) to get auto focus working, but it rarely worked. I think the issue has something to do with Crayfold focuser, where it is inherent having slippage issue. I believe SGPro needs to move focuser back and forth, so any slippage will impact accurate focus. Another reason is that the V curve sometimes is not good.

On the other hand, focusmax moves only one direction so it is less affected by slippage.

Auto focus is one of the most important features in automation, so I think you should consider make it more robust and less time consuming. 20min does not sound much, but considering summer night in NA has only 5hours imaging time (even less for mobile setup), it is not negligible.

I’m with CCDMan - FocusMax was a PITA to get right. Far too complex and also too dependent upon a single star. (I recall the last of the free versions was also very unreliable in my MDL system). If you have a Crayford focuser with slippage, then no V-curve is going to fix that. If you think about it, the focus mechanism has to move in both directions at some point and SGP has backlash compensation. I have used it successfuly with all my refractors, from 350mm FL to 1000mm FL without issue. My RCT had some issues - BUT - that is because it was not properly collimated. Again - not something to do with SGP but the mechanics/optics. FM had the issue that even though it had a V-curve, it was still dependent on just a few measurement points, which can be wrong - vs SGP which looks at more data points - across the entire image - which can reduce error singularities.

@Ken Nothing is perfect and there is one thing that might be considered is a kind of filter - that when SGP calculates the V-curve, it is stored and updated in the equipment profile. I do notice that I may have 3 points in a perfect line but a fourth point can skew the result. By having the V-curve being constantly updated, it could act as a sanity check and help reject outliers in the V-curve on the night, without changing the core algorithm?

If you read carefully, neither OP nor I suggested to use single star. I do think it is a smart idea to check stars across the image.

I have been using FM3.8 for a few year on my moonlite focuser, it never failed on me if it finds a star. Most of times it is not an issue for wide imaging.

FM only moves focuser in one direction when it starts auto focuser process, that is a very smart idea, basically it can avoid lots of mechanical issues.

There are many people are willing to pay more money for FM4 alone, it is an indication that it has some great features that other software dont have.

Really? can you explain what mechanical issue is not addressed by backlash compensation (as in SGP).

Just thinking out loud here but it seems like the whole issue of backlash can be eliminated with a small modification of the focusing routine. Currently when the auto focus routine is started, the focuser is moved out to a point that is calculated based on the number of data points and the number of steps between data points. Then the focuser starts moving inward taking focus frames. After all the focus frames are taken, the focuser is at its most inward position. SGP does its calculation for the point of best focus. The focuser changes direction and moves back out to the calculated point.

If backlash is enabled and the amount of backlash is accurate, the last move will stop at the calculated position of best focus. But the amount of backlash a focuser actually has can be difficult to determine accurately.

In stead of stopping at the calculated focus position, what if SGP moved the focuser all the way back to the original starting point, reversed and then moved to the calculated position? This would make the focuser travel to the best focus point in the same direction it was traveling when the best focus point was originally crossed. The double reversal of the focuser completely eliminates the effect of backlash. Backlash does not have to be enabled and the amount of backlash does not have to be known for this to work.

BTW – this is the method used by a machinist on a manual lathe to eliminate backlash. No machinist using a manual lathe ever knows the backlash of the cross feed because it is irrelevant to making high tolerance parts.

I may have missed something here but this logic might be used automatically if SGP’s backlash option was not enabled. The benefit of using backlash compensation is that, if known accurately, it would save some time.

Charlie

The issue I am talking about is the slippage. Even SGPro can compensate backlash, but it does not know if there is a slippage and how to compensate. It assumes that focuser will be at exact position after backlash compensation, this may be true without slippage.

When focuser change direction, due to backlash, there will be a very short period of time of no payload, once backlash is done, it comes to full load The sudden change of payload will get slippage worse (than full engaged focuser). So for crayfold type of focuser, each time it switches direction, it will introduce undetermined slippage where SGPro can not compensate.

On the other hand, FM only moves focuser in one direction after focuser is fully engaged, so the slippage is much smaller.

Two things to note to improve SGP autofocusing (and it has nothing to do with the application):

  1. Get a trustworthy focuser - No matter how good the focusing algorithm, if your focuser is slipping you WILL be disappointed with the results. Get a good focuser or tune the one you have and save hours of frustration.

  2. Calculate your step sizes properly.

From a layman’s perspective I’ll go with the SGP auto-focusing algorithm any day of the week and twice on Sundays. By using all the stars in the frame it takes the guess work out of finding the right star even in bad seeing conditions. Those of us starting out rather spend out time imaging than figuring out where in the sky I should point. Maybe at some point when I have more experience under my belt I may want to change my current method of letting SGP do everything for me but it just works so I don’t know why I would.

I use moonlte focuser. I always get consistent result with FM3, but it rarely works with SGPro even I have perfect V curve. So looks to me, more sophisticated software does make difference.

I have Moonlite on my RCT. These are good focusers and there is a tensioner that, if set correctly, stops slippage. Normally the SGP routine is moving the focuser inwards during the V-curve generation, against gravity and that is the most likely time that slippage (if any) would occur. Moving it back (with gravity) should be much less likely to slip in that sense. Again - slippage is slippage and if SGP is making a good v-curve, then as long as the midpoint is correctly calculated, the rest is mechanical engineering.

I have a QSIwsg683 on the end of my Moonlite. It is quite heavy. I made sure there was no lubricant or contamination on the Crayford ‘flat’ area and set the tensioner so that with the scope pointing to the zenith, a gentle tug on the camera downwards did not cause any slippage. There is no backlash on the Crayford per se - as there is no gear interface but I do get it in the motor gearbox. It is very easy to work out the backlash - if one measures it at 50 steps, there is no harm in making it 100 steps in the software, so long as the value exceeds the actual measured amount.

PLEASE, don’t fool around with the SGP focus algorithm. This is one of the reasons I went with SGP.

I, like others here, had fm when it was free and not charging the ridiculous price that it currently does. It was a PITA. I get so much more from SGP and how it focuses. It gives me a good indication of what my seeing conditions are going to be like for the evening from the get go. I might be wrong, but when I get a nice V with SGP, my seeing conditions are usually pretty good. Plateaus at the bottom have been a good predictor of not so great conditions for the larger f/l scope.

When using fm, along with ccdap for automation, having to go to a star at 60 degrees and focus was a real time consumer. Everytime you did that, additional time was wasted on plate solving with ccdap and there was no guarantee that the plate solves would work. I had a lot wasted nights after I had gone to bed, and a plate solve had failed due to a multitude of reasons. I guess, in theory, this was the correct way to focus. In practical terms for me, SGP keeps the focus on target without the slewing to a focus star. I would rather have it focus in the target area of my image, than have to do multiple plate solves and come back to the target.

Bottom line, SGP ends up saving me a lot of time that can then translate into more subs.

Honestly, I have used pretty much every focus method there is in the past 20 plus years, including FM. In fact, my lecture on manual and mask focusing at the old Imaging the Sky conference ITS-99, according to Steve Brady, got him to thinking about how to automate focus and FocusMax was revealed at the following year’s conference. I used it from then on until I switched to SGP. IMHO, the SGP method is simply more robust. Period.