public bool CalcPosition(SettleSoundFile settleSoundFile, SonarConfig sc, RawPositionInfo raw, float longitude, float latitude) { if (settleSoundFile != null && sc != null && raw!=null) { try { scConfig = sc; this.raw = raw; USBL_GuiWei Position_Guiwei = new USBL_GuiWei(raw.XDistance, raw.YDistance, raw.ZDistance, raw.Heave, raw.Heading, raw.Pitch, raw.Roll, longitude, latitude, sc.SonarGPSx, sc.SonarGPSy, sc.SonarGPSz, raw.TravelTime, sc.SonarDepth, settleSoundFile.SVPd, settleSoundFile.SVPc); //USBL_GuiWei Position_Guiwei = new USBL_GuiWei((float)0.4785, (float)-0.5465, (float)-6.7128, raw.Heave, (float)48.7943, (float)0.1944, 0, longitude, latitude, sc.SonarGPSx, sc.SonarGPSy, sc.SonarGPSz, (float)0.0045, sc.SonarDepth, settleSoundFile.SVPd, settleSoundFile.SVPc); //USBL_GuiWei Position_Guiwei = new USBL_GuiWei((float)0.6391, (float)-0.0549, (float)-6.9063, raw.Heave, (float)48.73, (float)0.19, 0, longitude, latitude, sc.SonarGPSx, sc.SonarGPSy, sc.SonarGPSz, (float)0.0046, sc.SonarDepth, settleSoundFile.SVPd, settleSoundFile.SVPc); AjustLat = (float)Position_Guiwei.LatTarget; AjustLong = (float)Position_Guiwei.LonTarget; Noise = raw.Noise; Status = raw.Status; XAjust = (float)Position_Guiwei.x_local; YAjust = (float)Position_Guiwei.y_local; ZAjust = (float)Position_Guiwei.z_local; } catch (Exception) { return false; } return true; } return false; }
public async Task<bool> Start() { try { //USBLTraceService.StartService(); LoadConfiguration(); if(_appConf.GetVelProfileName()!=null) { if(File.Exists(_appConf.GetVelProfileName())) { SoundFile = new SettleSoundFile(_appConf.GetVelProfileName()); } } var shippath = _appConf.GetModelPath("Ship"); if (shippath == null) throw new Exception("未找到模型组件!"); shippath = BasicConf.MyExecPath+"\\"+shippath;//found CurrentModel = await LoadAsync(shippath, false); if (CurrentModel==null) throw new Exception("加载模型组件失败!"); _serviceStarted = true;//if failed never get here return _serviceStarted; } catch (Exception ex) { Error = ex.Message; EventAggregator.PublishMessage(new ErrorEvent(ex, LogType.Both)); return false; } }
private void ExecuteSaveAndRun(object sender, ExecutedRoutedEventArgs eventArgs) { try { FileInfo fi = new FileInfo(Profile); if (fi.Exists) { SettleSoundFile SoundFile = null; try { SoundFile = new SettleSoundFile(Profile);//整理声速剖面文件 } catch (Exception) { UnitCore.Instance.EventAggregator.PublishMessage(new LogEvent("读取声速剖面文件失败!", LogType.OnlyInfo)); return; } UnitCore.Instance.SoundFile = SoundFile; BasicConf.GetInstance().SetVelProfileName(Profile); } else { throw new Exception("声速剖面文件不存在!"); } var sc = UnitCore.Instance.SonarConfiguration; sc.VelCmd = SurVelSrcIndex; if (AvgVelIndex == 1) sc.VelCmd = sc.VelCmd | 0x04; sc.SurVel = SurVel; sc.AvgVel = AvgVel; sc.FixedGain = FixedGain; sc.TVGCmd = TVGCmd; sc.FixedTVG = FixedTVG; sc.TVGSampling = TVGSampling; sc.TVGSamples = TVGSamples; sc.TVGA1 = TVGA1; sc.TVGA2 = TVGA2; sc.TVGA3 = TVGA3; sc.PingPeriod = PingPeriod; sc.ADSaved = ADSaved; sc.PoseSaved = PoseSaved; sc.PosSaved = PosSaved; sc.SonarDepth = SonarDepth; sc.SonarGPSx = SonarGPSx; sc.SonarGPSy = SonarGPSy; sc.SonarGPSz = SonarGPSz; sc.Pitchfixed = Pitchfixed; sc.Rollfixed = Rollfixed; sc.Headingfixed = Headingfixed; if (!UnitCore.Instance.UpdateSonarConfig(false)) throw new Exception("无法保存默认参数"); UnitCore.Instance.EventAggregator.PublishMessage(new GoBackNavigationRequest()); } catch (Exception ex) { UnitCore.Instance.EventAggregator.PublishMessage(new LogEvent(ex.Message, LogType.OnlyInfo)); return; } }