public StarProspect OffsetCenter(StarProspect tgtStar, double imagePA) { /*Calculates an offset position that places the input position in the center * of the guider FOV. * * Note that the bearing for moving off the target star is opposite for different * sides of the pier. If the scope is peering over the meridian, then this wont work * well. */ //Set the star chart FOV 4 times the y distance (arcmin) center of the ccd // fov to the center of the guider fov -- not really needed but helps viewing during processing SetStarChartSize(); // Convert target star RA and Dec to radians and place in RA/Dec structure double tgtRA = Transform.HoursToRadians(tgtStar.StarRA); double tgtDec = Transform.DegreesToRadians(tgtStar.StarDec); Celestial.RADec tgtStarPosition = new Celestial.RADec(tgtRA, tgtDec); // Compute the rotation (radians) associated with any guider FOV offset from the image PA double gRotationR = -Math.Atan2(gfov.CenterX, gfov.CenterY); // Increment the image PA by the guider offset double bearingR = gRotationR + Transform.DegreesToRadians(imagePA); // Reverse bearing if the mount is pointing east //if (!pierEast) { bearingR = -bearingR; } // Compute the distance beween the center of the Image FOV and the center of the Guider FOV double distanceR = Transform.DegreesToRadians((SumOfSquares(gfov.CenterX, gfov.CenterY)) / 60.0); // Calculate an offset position such that the guider FOV will have the target star in its center //Celestial.RADec endPosition = Celestial.Travel(tgtStarPosition, -gVectorR, gRotationR); Celestial.RADec endPosition = Celestial.ComputePositionFromBearingAndRange(tgtStarPosition, bearingR, -distanceR); // Convert this position back to hours and degrees (RA and Dec) and return the result // as a DBQStar structure StarProspect endStar = new StarProspect() { StarRA = Transform.RadiansToHours(endPosition.RA), StarDec = Transform.RadiansToDegrees(endPosition.Dec) }; return(endStar); }
private void PickButton_Click(object sender, EventArgs e) { PickButton.BackColor = Color.LightSalmon; StartButton.BackColor = Color.LightSalmon; //Pick up the target star location as selected in TSX Star Chart MessageBox.Show("Select target star"); WriteLog("Picking up coordinates of selected target star"); sky6ObjectInformation tsxoi = new sky6ObjectInformation(); StarProspect foundStar = new StarProspect(); tsxoi.Index = 0; tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); foundStar.StarName = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000); foundStar.StarRA = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000); foundStar.StarDec = (tsxoi.ObjInfoPropOut); tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG); foundStar.StarMag = (tsxoi.ObjInfoPropOut); WriteLog("Target star found: " + foundStar.StarName); //Closed Loop Slew (following standard slew -- see notes) to the target guide star WriteLog("Centering imaging camera on target star"); bool slewDone1 = SlewToStar(foundStar.StarName, foundStar.StarRA, foundStar.StarDec); if (slewDone1) { WriteLog("Target star centered"); } else { WriteLog("There was a problem centering the target star"); } //Calculate a pointing position that would put the target star in the guider FOV WriteLog("Calculating offset for centering star in guider FOV"); StarProspect tgtPosition = guiderFOV.OffsetCenter(foundStar, imagePA); WriteLog("Offset calculated for pointing at " + tgtPosition.StarRA.ToString("0.000") + " , " + tgtPosition.StarDec.ToString("0.000")); //Closed Loop Slew (following standard slew -- see notes) to that offset position WriteLog("Centering target star in guider FOV"); bool slewDone = SlewToPosition(tgtPosition.StarRA, tgtPosition.StarDec); if (slewDone1) { WriteLog("Target star centered in guider FOV"); } else { WriteLog("Could not recenter the target star"); } //plate solve current location -- not necessary but it sets up the star chart nicely for viewing // note that we are not in such a hurry that we can't mess around a bit WriteLog("Checking offset position with a plate solve"); imagePA = PlateSolve(); //Reset the chart size for something pleasant around the FOVI's guiderFOV.SetStarChartSize(); //center the star chart on the pointing location == once again, for esthetic purposes WriteLog("Recentering chart"); sky6StarChart tsxsc = new sky6StarChart { RightAscension = tgtPosition.StarRA, Declination = tgtPosition.StarDec }; WriteLog("Target star centered in Guider FOV"); PickButton.BackColor = Color.LightGreen; StartButton.BackColor = Color.LightGreen; OptimizeButton.Enabled = true; CalibrateButton.Enabled = true; OptimizeButton.BackColor = Color.LightGreen; CalibrateButton.BackColor = Color.LightGreen; //all done return; }