View Issue Details

IDProjectCategoryView StatusLast Update
0001133SkyChart1-Softwarepublic13-05-06 14:32
Reporteraruangra Assigned ToPatrick Chevalley  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product Version3.7 SVN 
Target Version3.8Fixed in Version3.7 SVN 
Summary0001133: user-added server commands for telescope control
DescriptionI spent some time to add server commands to control telescopes. I would like to share the codes in case it is useful.

u_constant.pas

  // Chart Commands
  numcmd = 102;

    ('GETSCOPERADEC', '97', ''),
    ('CONNECTINDI', '98', ''),
    ('DISCONNECTINDI', '99', ''),
    ('SLEWINDI', '100', 'RAhr in decimal and Dec in decimal'),
    ('ABORTSLEWINDI', '101', ''),
    ('SYNCINDI', '102', 'RAhr in decimal and Dec in decimal')

fu_chart.pas

    function cmd_GetScopeRaDec:string;
    function cmd_ConnectINDI:string;
    function cmd_DisconnectINDI:string;
    function cmd_SlewINDI(RA1,DE1:string):string;
    function cmd_AbortSlewINDI:string;
    function cmd_SyncINDI(RA2,DE2:string):string;


function Tf_chart.cmd_GetScopeRaDec:string;

var ra,dec:double;
    ok: boolean;
begin

if sc.cfgsc.ASCOMTelescope then begin
     Connect1.checked:=Fpop_scope.ScopeConnected;
     if Connect1.checked then begin
      Fpop_scope.ScopeGetEqSys(sc.cfgsc.TelescopeJD);
      if sc.cfgsc.TelescopeJD<>0 then sc.cfgsc.TelescopeJD:=jd(trunc(sc.cfgsc.TelescopeJD),0,0,0);
      Fpop_scope.ScopeGetRaDec(ra,dec,ok);
     end;
 end
else if sc.cfgsc.IndiTelescope then begin
     Connect1.checked:=Fpop_indi.ScopeConnected;
     if Connect1.checked then begin
      Fpop_indi.ScopeGetEqSys(sc.cfgsc.TelescopeJD);
      if sc.cfgsc.TelescopeJD<>0 then sc.cfgsc.TelescopeJD:=jd(trunc(sc.cfgsc.TelescopeJD),0,0,0);
      Fpop_indi.ScopeGetRaDec(ra,dec,ok);
     end;
 end
else if sc.cfgsc.LX200Telescope then begin
     Connect1.checked:=Fpop_lx200.ScopeConnected;
     if Connect1.checked then begin
      Fpop_lx200.ScopeGetEqSys(sc.cfgsc.TelescopeJD);
      if sc.cfgsc.TelescopeJD<>0 then sc.cfgsc.TelescopeJD:=jd(trunc(sc.cfgsc.TelescopeJD),0,0,0);
      Fpop_lx200.ScopeGetRaDec(ra,dec,ok);
     end;
 end
else if sc.cfgsc.EncoderTelescope then begin
     Connect1.checked:=Fpop_encoder.ScopeConnected;
     if Connect1.checked then begin
      Fpop_encoder.ScopeGetEqSys(sc.cfgsc.TelescopeJD);
      if sc.cfgsc.TelescopeJD<>0 then sc.cfgsc.TelescopeJD:=jd(trunc(sc.cfgsc.TelescopeJD),0,0,0);
      Fpop_encoder.ScopeGetRaDec(ra,dec,ok);
     end;
end;

result:=artostr3(ra)+blank+detostr3(dec);

end;



function Tf_chart.cmd_ConnectINDI:string;
var ok:boolean;
begin
if Fpop_indi=nil then begin
  Fpop_indi:=Tpop_indi.Create(self);
  Fpop_indi.csc:=sc.cfgsc;
  Fpop_indi.SetLang;
end;
  
  Fpop_indi.ScopeReadConfig(ExtractFilePath(Configfile));
  Fpop_indi.ScopeSetObs(sc.cfgsc.ObsLatitude,sc.cfgsc.ObsLongitude);
  TelescopeTimer.Interval:=2000;
  TelescopeTimer.Enabled:=true;
  
  Fpop_indi.ScopeConnect(ok);
  Connect1.Checked:=true;
  
result:=msgOK;

end;



function Tf_chart.cmd_DisconnectINDI:string;
var ok:boolean;
begin

Fpop_indi.ScopeDisconnect(ok);
Connect1.Checked:=false;
 
result:=msgOK;

end;


function Tf_chart.cmd_SlewINDI(RA1,DE1:string):string;
var ra,dec:double;
    ok:boolean;
begin

ra:=StrToFloatDef(RA1,9999);
dec:=StrToFloatDef(DE1,9999);

if (ra>=0)and(ra<=24)and(abs(dec)<=90) then begin
 ra:=ra*15*deg2rad;
 dec:=dec*deg2rad;

 if sc.cfgsc.TelescopeJD=0 then begin
   precession(sc.cfgsc.JDChart,sc.cfgsc.CurJDUT,ra,dec);
 end else begin
   if sc.cfgsc.ApparentPos then mean_equatorial(ra,dec,sc.cfgsc,true,sc.cfgsc.FindType<ftPla);
   precession(sc.cfgsc.JDChart,sc.cfgsc.TelescopeJD,ra,dec);
 end;
 ra:=rmod(ra+pi2,pi2);
 Fpop_indi.ScopeGoto(ra*rad2deg/15,dec*rad2deg,ok);
 
 result:=msgOK;
end
else result:=msgFailed+' out of range';
end;


function Tf_chart.cmd_AbortSlewINDI:string;
begin
Fpop_indi.ScopeAbortSlew;
result:=msgOK;
end;


function Tf_chart.cmd_SyncINDI(RA2,DE2:string):string;
var ra,dec:double;
begin

ra:=StrToFloatDef(RA2,9999);
dec:=StrToFloatDef(DE2,9999);

if (ra>=0)and(ra<=24)and(abs(dec)<=90) then begin
 ra:=ra*15*deg2rad;
 dec:=dec*deg2rad;

 if sc.cfgsc.TelescopeJD=0 then begin
   precession(sc.cfgsc.JDChart,sc.cfgsc.CurJDUT,ra,dec);
 end else begin
   if sc.cfgsc.ApparentPos then mean_equatorial(ra,dec,sc.cfgsc,true,sc.cfgsc.FindType<ftPla);
   precession(sc.cfgsc.JDChart,sc.cfgsc.TelescopeJD,ra,dec);
 end;
 ra:=rmod(ra+pi2,pi2);
 Fpop_indi.ScopeAlign('sync',ra*rad2deg/15,dec*rad2deg);
 
 result:=msgOK;
end
else result:=msgFailed+' out of range';
end;



 97 : result:= cmd_GetScopeRaDec;
 98 : result:= cmd_ConnectINDI;
 99 : result:= cmd_DisconnectINDI;
 100 : result:= cmd_SlewINDI(arg[1],arg[2]);
 101 : result:= cmd_AbortSlewINDI;
 102 : result:= cmd_SyncINDI(arg[1],arg[2]);

TagsNo tags attached.

Activities

Patrick Chevalley

13-02-09 11:34

administrator   ~0002445

Thank you very much!
I tested your commands with the INDI telescope simulator and all work fine.
I added one command: TRACKTELESCOPE ON/OFF , equivalent of menu Telescope / Track telescope.

This is added by revision 2421:
http://sourceforge.net/p/skychart/code/2421

Can you send me an email with the name you want I add the Help/About/Authors and if you want I add your email or not.

Issue History

Date Modified Username Field Change
13-02-03 09:33 aruangra New Issue
13-02-09 11:34 Patrick Chevalley Note Added: 0002445
13-02-09 11:34 Patrick Chevalley Assigned To => Patrick Chevalley
13-02-09 11:34 Patrick Chevalley Status new => resolved
13-02-09 11:34 Patrick Chevalley Resolution open => fixed
13-02-09 11:34 Patrick Chevalley Fixed in Version 0.3.0 => 3.7 SVN
13-02-09 11:34 Patrick Chevalley Target Version 0.3.0 => 3.8
13-05-06 14:32 Patrick Chevalley Status resolved => closed