/// <summary> /// Event handler is called when CVM device info has changed /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Arguments</param> private void RosControlBase_CvmDeviceInfoChaged(object sender, EventArgs e) { double f = rosControlBase.Device.DeviceInfo.FocalPoint; double B = rosControlBase.Device.DeviceInfo.Baseline; if (pointcloudViewModel.ImagingPipeline != null) { pointcloudViewModel.ImagingPipeline.SetCameraInfo(B, f, rosControlBase.Device.DeviceInfo.PrincipalPoint); } PointcloudView.AddFov(rosControlBase.Device.DeviceInfo.FovV, rosControlBase.Device.DeviceInfo.FovH, 1f, 10f, rosControlBase.Device.DeviceInfo.Baseline); }
/// <summary> /// Initialization /// </summary> public void InitializeBusinessLogic() { ConfigurationHelper.RegisterSettings(Properties.Settings.Default); pointcloudViewModel = new PointcloudViewModel(new SharpDX.Size2(0, 0)); PointcloudView.ViewModel = pointcloudViewModel; PointcloudView.InitializeScene(); DataContext = pointcloudViewModel; rosControlBase.RosConnected += RosControlBase_RosConnected; rosControlBase.RosDisconnected += RosControlBase_RosDisconnected; rosControlBase.CvmDeviceInfoChaged += RosControlBase_CvmDeviceInfoChaged; }
/// <summary> /// Event handler is called when successfully connected to ROS master server /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Arguments</param> private void RosControlBase_RosConnected(object sender, EventArgs e) { try { // NOTE: GPU filters can be initialized only when View3D of HelixToolkit has been launched. PointcloudView.InitializePipeline(Properties.Settings.Default.ForceCpuFiltering, 1); if (rosControlBase.Device.DeviceInfo != null) { pointcloudViewModel.ImagingPipeline.SetCameraInfo(rosControlBase.Device.DeviceInfo.Baseline, rosControlBase.Device.DeviceInfo.FocalPoint, rosControlBase.Device.DeviceInfo.PrincipalPoint); } } catch (Exception ex) { MessageBox.Show($"Fatal error initializing pipeline: {ex.GetBaseException().Message}"); throw; } // RGBPreview.Subscribe(); // DisparityPreview.Subscribe(); }