View Issue Details

IDProjectCategoryView StatusLast Update
0002086CCdcielGeneralpublic19-02-16 20:55
Reporterhan Assigned ToPatrick Chevalley  
PrioritynormalSeveritytweakReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version1.0 
Summary0002086: Optimisation dynamic focusing by reducing the number of steps for reaching target position from 3 to 2
DescriptionAfter the new target position is calculated in procedure Tf_starprofile.doAutofocusDynamic, line 1035 it takes three steps to reach the correct focus position. This is inefficient and takes for my geared focusser a few seconds. Suggest to simpily to code and reduce it from 3 to 2 focuser steps. It works fine in simulation and I will test it tonight.

step 1 Move to target - backlash compensation
step 2 Move to target

{- - - - -} is remove
Line 1035 procedure Tf_starprofile.doAutofocusDynamic;

              // compute focus
              p_hyp:=0;a_hyp:=0;b_hyp:=0;
              find_best_hyperbola_fit(dyn_v_curve,afmpos,p_hyp,a_hyp,b_hyp); {output: bestfocusposition=p, a, b of hyperbola}
              msg(Format(rsHYPERBOLACur, [FormatFloat(f3, p_hyp), FormatFloat(
                f4, lowest_error), inttostr(iteration_cycles)]),3 );
              // focus position with last move in focus direction
              step:=round(AutofocusDynamicMovement*(AutofocusDynamicNumPoint-p_hyp)); // required steps from original start position for optimal focus
              focuser.FocusSpeed:=step {+AutofocusDynamicMovement - - - - - - - - - - - - };
              if AutofocusMoveDir=FocusDirIn then begin
                onFocusOUT(self); // move to target position
                {wait(1); - - - - - - -}
                {focuser.FocusSpeed:=AutofocusDynamicMovement; - - - - - - - - - - - -}
                {onFocusIN(self); - - - - - - - - - - -}
              end
              else begin
                onFocusIN(self); // move to target position
                {wait(1); - - - - - - - - }
                {focuser.FocusSpeed:=AutofocusDynamicMovement; - - - - - - - -}
                {onFocusOUT(self); - - - - - - - - }
              end;
              wait(1);
              terminated:=true;
              end;
TagsNo tags attached.

Activities

han

19-02-16 11:50

reporter   ~0005403

The last step is maybe strange but correct. Swapping onFocusOUT and onFocusIN doesn't work
.
              if AutofocusMoveDir=FocusDirIn then
                onFocusOUT(self) // move to target position
              else
                onFocusIN(self); // move to target position

Patrick Chevalley

19-02-16 19:24

administrator   ~0005404

The problem doing it this way is you not do the last move in the configured focus direction.
This work only if the backlash compensation is configured.
Maybe this is possible by adding a test for backlash compensation > 0

Patrick Chevalley

19-02-16 20:55

administrator   ~0005407

I do the change with a test for backlash compensation:
https://github.com/pchev/ccdciel/commit/adf8e37bc2e2ad2fc10919ea3d6af572dd08b08c

Issue History

Date Modified Username Field Change
19-02-16 11:24 han New Issue
19-02-16 11:50 han Note Added: 0005403
19-02-16 19:24 Patrick Chevalley Note Added: 0005404
19-02-16 20:55 Patrick Chevalley Assigned To => Patrick Chevalley
19-02-16 20:55 Patrick Chevalley Status new => resolved
19-02-16 20:55 Patrick Chevalley Resolution open => fixed
19-02-16 20:55 Patrick Chevalley Target Version => 1.0
19-02-16 20:55 Patrick Chevalley Note Added: 0005407