static bool SlewToStar(string starName, double starRA, double starDec) { //Moves the mount to center the calibration star in the guider FOV //Async slew to target (letting dome catch up), then CLS to align (does not coordinate with dome) // //First, convert RA and Dec to topocentric (Epoch now) as that is what the slew expects sky6Utils tsxu = new sky6Utils(); tsxu.Precess2000ToNow(starRA, starDec); starRA = tsxu.dOut0; starDec = tsxu.dOut1; sky6RASCOMTele tsxm = new sky6RASCOMTele { Asynchronous = 0 }; try { tsxm.SlewToRaDec(starRA, starDec, starName); } catch (Exception ex) { return(false); } return(true); }
public static bool CLSToTarget(string tgtName, SpeedVector sv, bool IsPrecision = false) { //first, couple dome to telescope, if there is one sky6Dome tsxd = new sky6Dome(); try { tsxd.Connect(); tsxd.IsCoupled = 1; } catch (Exception ex) { //do nothing } int clsStatus = 123; sky6RASCOMTele tsxmt = new sky6RASCOMTele(); ClosedLoopSlew tsx_cl = new ClosedLoopSlew(); sky6StarChart tsxsc = new sky6StarChart(); sky6Utils tsxu = new sky6Utils(); //Check to see if target is above horizon double tgtRAH = Transform.DegreesToHours(sv.RA_Degrees); double tgtDecD = sv.Dec_Degrees; tsxu.ConvertRADecToAzAlt(tgtRAH, tgtDecD); double tgtAzmD = tsxu.dOut0; double tgtAltD = tsxu.dOut1; if (tgtAltD <= 0) { MessageBox.Show("Slew failure: Target is below the horizon"); return(false); } //Clear any image reduction, otherwise full reduction might cause a problem ccdsoftCamera tsxcam = new ccdsoftCamera() { ImageReduction = ccdsoftImageReduction.cdNone, Asynchronous = 1 //make sure nothing else happens while setting this up }; //Abort any ongoing imaging tsxcam.Abort(); bool returnStatus = true; // diagnostic string strRA = Utils.HourString(tgtRAH, false); string strDec = Utils.DegreeString(tgtDecD, false); // tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString()); tsxmt.Connect(); tsxu.Precess2000ToNow(tgtRAH, tgtDecD); double jnRAH = tsxu.dOut0; double jnDecD = tsxu.dOut1; //tsxmt.Asynchronous = 0; try { tsxmt.SlewToRaDec(jnRAH, jnDecD, tgtName); } catch (Exception ex) { MessageBox.Show("Slew Failure: " + ex.Message); returnStatus = false; } if (IsPrecision && returnStatus) { //*** precision slew try { clsStatus = tsx_cl.exec(); } catch (Exception ex) { returnStatus = false; } } try { tsxsc.Find(tgtName); } catch (Exception ex) { returnStatus = true; } return(returnStatus); }