ASCOM TempComp behavior

I’m building an Arduino focus controller that supports internal focus compensation using the ASCOM TempComp property. Before I start testing it with SGP, I would like to be sure what to expect. Here’s what I think I understand. If I have TempComp enabled, SGP will check for it and disable it prior to running AF. After AF completes, it will re-enable it. Is that correct?

What about the Focus Control buttons? If I understand correctly, I should not be able to move the focuser without disabling TempComp. Does SGP disable TempComp when you click one of the Focus Control buttons and re-enable it when the move is complete? If not, should it?

Thanks.

Tim

1 Like

One more thing I meant to ask - does SGP check for TempComp on startup and if it finds it, does it enable it?

Thanks.

Tim

This is correct.

Maybe? I would need to read the spec. With respect to these buttons. SGPro does not attempt to interrogate the state to enable or disable. What would happen is that you would click a button, the ASCOM driver would protect itself and throw an exception (silently) and the position will not move.

It does not (purposely). We do not assume availability of temp comp implies that users want to use it (or that it even contains trained data). If it is enable, external to SGPro, we will respect that and re-enable it for you when we’re done mucking with the position.

Bummer. The spec says:

“While in temperature tracking mode, Move commands will be rejected by the focuser.”

That means that I can’t use Focus Control if TempComp is enabled. I’m also not sure how I enable TempComp when using SGP. The firmware defaults to disabled and there is no way to toggle it in the ASCOM panel. I can fiddle with it in the code to default it to enabled, but it would still be nice to have a way to toggle it off and on. Maybe when you guys get some free time, you can install a toggle button. I hate to ask for yet another feature though and gest I can tell, I’m the only one who seems interested.

This means a lot to me because my new scope (FSQ106EDX4) moves a lot with temperature changes. It moves out of the CFZ with a degree Celsius change and when doing narrowband, the temp can change quite a bit more than that during a single exposure, particularly early in the evening. I really want to have TempComp running during the exposure and then run AF after its done. I have checked, and moving the focuser during an exposure does not affect the image at all from vibration.

Anyway, if you do find the time and have the inclination to add a button somewhere that toggles TempComp, I would be ecstatic.

Tim

That seems accurate. SGPro doesn’t prevent it, but your focuser should. We can look at better support for ASCOM temp comp at some point in the future (as a note, this issue is only present for those folks that feel temp comp between frames is not adequate). If you are OK with that, then SGPro temp comp will work just fine for you and you can ignore driver-based temp comp routines. Right now SGPro is tolerant of it, but not super compatible with it.

This varies by controller. I assume that most controller drivers would provide an UI for this if they want people to actually use it. It is this model that SGPro is designed to compatible with…

I have this same scope and I haven’t noticed sensitivity like this. If anything, these low FL scopes seem far more tolerant of focus error. Just a comment for no reason… it doesn’t have any bearing on your request.

Overall, adding better compatibility can certainly be on the list but it is not likely something we will address soon.

Not opposed the concept, just the amount of confusion, documentation support and sequence state.

Thinking about it… it would only take 5 minutes to expose temp comp through the SGPro focuser API. This would avoid all the complication of adding a user control and present the option only to advanced users (then you can author your own toggle switch).

That sounds great, Ken. I have never tried to interface with the API but would be willing to try.

Tim

In ASCOM, a focuser should start with temp comp disabled, because one cannot assume that the focuser is actually in focus.
Once temp comp is enabled, then the ascom driver will ignore move requests.
The question arises how to enable temperature compensation in the first place.

ASCOM provides both a get method driver.TempCompAvailable to query if the focuser supports temperature compensation.

And, there is also driver.TempComp.
If the TempCompAvailable property is True, then setting TempComp to True puts the focuser into temperature tracking mode. While in temperature tracking mode, Move commands will be rejected by the focuser. Set to False to turn off temperature tracking. An exception will be raised if TempCompAvailable is False and an attempt is made to set TempComp to true.

This means a client app can use the driver.TempComp method to enable or disable the focuser temperature compensation - something SG does when performing an autofocus.

In general, for ASCOM, the UI of the focuser is only available on the setup dialog box of the focuser which is displayed before connecting. The ASCOM GUI is not available once connected and should not be made available (explicitly stated in ASCOM developer docs). This means it is up to the client app, in this case SG, to provide a mechanism for turning temperature compensation on or off within the SG application, Adding a simple check box in SG would suffice.
Regards
Robert

I just thought I would provide an update in case anyone else is interested in internal temp compensation and SGP. I built the focuser controller that Robert (brown_rb above) designed here:

I wanted to be able to user internal temperature compensation with SGP with my two Moonlite focusers and my Rigel focuser while preserving the ability to do AF. If anyone is interested, I built the Uno/L293D minimal option with the temperature probe. It was a very simple build since I did not want the LCD display or the buttons.

The way the ASCOM TempComp property is supposed to work is that I the property is enabled, the focuser will move based on temperature changes defined by a user-settable temperature coefficient. So, for long narrowband subs, the focuser will keep track of the temperature and make moves during the exposure (or any other time) as the temperature changes. When TempComp is enabled, the ASCOM standard says that all move commands must be disabled so the only moves the focuser will make are the ones driven by TempComp.

Of course, when SGP tries to run AF, it will not work with TempComp enabled, nor would the focuser movement buttons in the focuser pane. However, SGP correctly disables TempComp prior to an AF run and then correctly enables it again when the AF run is complete. I have tested all of that and it works quite well.

The problem is that SGP does not offer a way for the user to toggle TempComp. So, if the focuser starts with a default value of TempComp disabled, there is no way to enable it within SGP. AF and the move buttons will work fine, but TempComp will never actuate. If TempComp is enabled by default, it will perform internal temperature compensation and AF will work properly, but there would be no way for the user to move the focuser with the buttons in the focuser pane since the only time TempComp would be disabled would be during an AF run.

I typically operate the observatory remotely, and my usual work flow is to set initial focus using F&F and the move buttons on the focuser pane to get things close. This is usually necessary because the starting temperature is usually quite different than the ending temperature of the previous session and as a result, the initial focus position of often off too much for AF to work well. To do this, I would need TempComp disabled (otherwise I could not use the move buttons). Once initial focus is set, I typically let SGP handle focus for the rest of the night, at which point, I would want TempComp enabled.

Since there is no way to enable/disable TempComp from within SGP, I have been working with Robert to solve this dilemma, and he has very graciously taken his time to modify his ASCOM interface to include a TempComp toggle button.

Now, when I first connect, I do so with TempComp disabled so I can use the move buttons and F&F to get focus close. Once I’m sure that it is close enough to let AF do its thing properly, I disconnect the focuser, open the ASCOM interface with the tools button, enable TempComp and then reconnect the focuser. I then leave everything to SGP and TempComp. It’s a bit kludgy, but since SGP has no way to enable/disable TempComp, it is the only way to make internal temperature compensation useful.

I write all of this in case there is anyone else who struggles like I do with rapid temperature changes and long subs. At times of the year like now, it is not uncommon for it to be 60 degrees when I start imaging and drop below freezing by the time the night is over. I have seen the temperature change by more than 2 degrees C during a 20-minute exposure. This can cause the focus to be soft during the last part of the exposure. Additionally, if the focus is off by enough, when AF runs at the end of the exposure, I will often get a wonky curve and the resulting focus is not as good as it could be. AF works best, as we all know, when it is already close to good focus. The closer, the better.

I tested everything last night using the Moonlite CXL on the Tak FSQ106 EDX4. I already knew that my temperature coefficient was about 16 steps per degree C. I had SGP set to run AF for every 2 degree C temperature change and had TempComp set up to move 4 steps for every 1/4 degree change. I watched it closely for the first part of the night. Everything worked beautifully. The focuser is quite smooth and the moves during image acquisition had no effect on image quality from vibration. When AF ran, I got a perfect “V” curve every time, with AF changing the focus position by no more than 3 or 4 steps when it completed.

So, if you want to do internal temperature compensation even though SGP does not fully support it, you can. If you are at all handy with electronics, you can build a richly-featured controller for less than $50 all-in.

Tim

1 Like

Anyway, if you do find the time and have the inclination to add a button somewhere that toggles TempComp, I would be ecstatic.

As I have been using my kludgy fix for this, something that occurs to me that might be a whole lot simpler fix. My problem is that I can’t use the fine and coarse focus control buttons with TempComp enabled. In order to use them, I need to disconnect the focuser, open the driver UI, disable TempComp and then use the focus control buttons. To return to TempComp behavior, I need to reverse the process.

It occurs to me that SGP could simply disable TempComp when a focus control button is pressed and re-enable it when the move is finished. That’s what it does for AF and I believe it also does it for Go To. This would preclude the need to have a new TempComp enable/disable button. SGP would simply disable it whenever it needed to move the focuser and then enable it when it was done. That way, I could just start the focuser with TempComp enabled and never have to mess with it again.

Without knowing what is involved, this seems like an elegant and simple (in theory) fix. Thoughts?

Tim

Ken wrote
This varies by controller. I assume that most controller drivers would provide an UI for this if they want people to actually use it. It is this model that SGPro is designed to compatible with…

Actually this is not correct for ASCOM focuser drivers. A UI to do this when the driver is connected is actually very much frowned on by ASCOM standards. For a focuser, a setupdialog box gives access to the driver settings, but once connected, the UI no longer becomes available and the client interacts directly with the driver via the driver methods which set/get driver properties.

In ASCOM, any requests to change driver properties whilst connected will come from the client app. There is no provision for re-displaying the setupdialog box or another special dialog box to interact with the driver. That would be a big No No.

Regards
Robert

I am having exact the problem.

I have my own focuser controller which can do temperature compensation, and it works really well within 3C degree temperature drop (my scope is slower)

The only issue with SGPro is that I can not enable/disable TempComp in it. I dont like the idea to enable/disable it in setup box. Another option would be add a hardware switch.

But I think the easiest way would be adding a check box in SGpro, which should be fairly easy. Focusmax and MaximDL already provide such function.

Sure would be nice. I’m surprised more people don’t have this problem.

I am surprised too, maybe others only need to do auto focus between frames. But for me, I want to do focus adjustment within frame, as well as to reduce frequency of auto focus.

This is the only issue I am facing now before I can fully switch to SGPro.

This is the solution I would like to see. Simple and effective.

When running the AF routine manually, it would be nice if it disabled temperature compensation in the focuser and paused PHD2 Guiding. When the AF routine finishes, it would re-enable TC and guiding. This would be controlled by the existing options in SGP.

I regularly startup PHD2 before starting a sequence and I normally run an initial AF in preparation for starting a sequence. So, having the AF routine manage those two issues would be very useful.

cm

I wish the same.

Another issue I am facing now is that when TempComp is enabled and focuser does not honor move command, somehow I think SGPro is still expecting focuser movement, which messes up focuser control. Disconnect/reconnect does not fix the issue always, it seems those commands waiting in the queue are not deleted and could mess up focuser control.

So SGPro should either drop the command if it reads TempComp set, or disable then enable TempComp. The latter seems a cleaner solution.

@Ken Could you confirm the issue in my above post is a real bug in SGPro?

@spokeshave
Which version did you use and verify AF with TempComp enable/disable? I tried last night ( I have the latest version), SGPro disabled TempComp and ran AF algorithm, but it did NOT enable it after AF. This occurred for both “AF at the beginning of sequence” and “AF when filter change”. I did not try “AF when temperature drops” but I doubt it would be different.