public override void SyncRaDec(Coordinates coordinates) { if (this.CommandBool(string.Format("{0}{1}{2}{3}#", GeneralCommands.SYNC_HP, Utils.Deg2HEX32(coordinates.Ra), GeneralCommands.COMMA, Utils.Deg2HEX32(coordinates.Dec)), false)) { return; } throw new Exception("Error setting parameters"); }
public override SiteOfPier GetDestinationSiteOfPier(Coordinates coord) { var par = new List<byte>(); par.AddRange(this.DoubleToBytes(coord.Ra)); par.Add((byte)GeneralCommands.COMMA); par.AddRange(this.DoubleToBytes(coord.Dec)); par.Add((byte)GeneralCommands.TERMINATOR); // var res = this.SendCommand(GeneralCommands.GET_DEST_PIER_SIDE, par.ToArray()); var ra = coord.Ra * 15d; var dec = coord.Dec < 0 ? coord.Dec + 360 : coord.Dec; var res = SetValues(GeneralCommands.GET_DEST_PIER_SIDE,new[] {ra, dec}, 6, 8); if (res.Length < 2) throw new Exception("Error setting parameters"); return this.DecodePierSite((byte)res[0]); }
public static AltAzm RaDec2AltAzm(Coordinates coord, LatLon location, DateTime time, double elevation) { var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils(); var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year); MJDdate += time.TimeOfDay.TotalDays; var tfm = new ASCOM.Astrometry.Transform.Transform(); tfm.JulianDateTT = MJDdate; tfm.SiteElevation = elevation * 1000; tfm.SiteLatitude = location.Lat; tfm.SiteLongitude = location.Lon; tfm.SiteTemperature = 0; tfm.SetJ2000(coord.Ra, coord.Dec); tfm.Refresh(); var res = new AltAzm(tfm.ElevationTopocentric, tfm.AzimuthTopocentric); return res; }
public static Coordinates AltAzm2RaDec(AltAzm altAzm, LatLon location, DateTime time, double elevation) { var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils(); var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year); MJDdate += time.TimeOfDay.TotalDays; var tfm = new ASCOM.Astrometry.Transform.Transform(); tfm.JulianDateTT = MJDdate; tfm.SiteElevation = elevation * 1000; tfm.SiteLatitude = location.Lat; tfm.SiteLongitude = location.Lon; tfm.SiteTemperature = 0; tfm.SetAzimuthElevation(altAzm.Azm, altAzm.Alt); tfm.Refresh(); var res = new Coordinates(tfm.RAJ2000, tfm.DecJ2000); return res; }
public void Sync(Coordinates coord) { lock (_sync) { ti.SyncRaDec(coord); } }
public bool Slew(Coordinates coord) { this.CheckPark(); if (this.telescopeMode != TelescopeMode.Normal) return false; this.tp.IsAtHome = false; lock (_sync) { SlewWaitHandle.Reset(); this.ti.RaDec = coord; this.telescopeMode = TelescopeMode.Slewing; Thread.Sleep(300); } return true; }
public SiteOfPier GetDestinationSiteOfPier(Coordinates coord) { if (!ti.CanGetSiteOfPier) throw new NotSupportedException("Device is not capable to get SiteOfPier"); lock (_sync) { return ti.GetDestinationSiteOfPier(coord); } }