public AutonomyViewModel(ModelContainer ModelContainer) { modelContainer = ModelContainer; LoggerViewModel = new LoggerViewModel(modelContainer.logger); CameraViewModel = new CameraStreamViewModel(); DetectionListViewModel = new DetectionListViewModel(modelContainer); StartAutonomyCommand = new RelayCommand(StartAutonomyAction, Allow); StopAutonomyCommand = new RelayCommand(StopAutonomyAction, Allow); modelContainer.dataContainer.Position.newDataCallback += (float x, float y, float z) => { RaisePropertyChanged("posX"); RaisePropertyChanged("posY"); RaisePropertyChanged("posZ"); }; modelContainer.dataContainer.Velocity.newNormCallback += (float x) => RaisePropertyChanged("Velocity"); modelContainer.dataContainer.Acceleration.newNormCallback += (float x) => RaisePropertyChanged("Acceleration"); modelContainer.modelStatus.taskManagerStatus.NewData += () => RaisePropertyChanged("TaskManagerStatus"); modelContainer.modelStatus.networkStatus.ConnectedToJetsonCallback += (bool val) => JetsonConnected = val; modelContainer.modelStatus.AutonomyStatusCallback += (bool val) => AutonomyStatus = val; modelContainer.dataContainer.Attitude.newDataCallback += (float x, float y, float z) => { Roll = x; Pitch = y; Heading = z; }; modelContainer.dataContainer.motorsData.newDataCallback += () => { RaisePropertyChanged("MotorsData"); }; }
public ControlViewModel(ModelContainer modelContainer) { Position = new MovementInfoClass(); this.modelContainer = modelContainer; CameraViewModel = new CameraStreamViewModel(); HUDViewModel = new HUDViewModel(); DetectionListViewModel = new DetectionListViewModel(modelContainer); DetectionDrawerViewModel = new DetectionDrawerViewModel(modelContainer); ModeChangedCommand = new RelayCommand(ModeChangedAction, CanArmAction); ArmCommand = new RelayCommand(ArmAction, CanArmAction); DisarmCommand = new RelayCommand(DisarmAction, CanDisarmAction); DetectionBtnClickedCommand = new RelayCommand(DetectionBtnClickedAction, (object p) => { return(true); }); modelContainer.modelStatus.ArmCallback += (bool value) => { Armed = value; }; modelContainer.modelStatus.networkStatus.ConnectedToJetsonCallback += (bool value) => { JetsonConnected = value; }; modelContainer.modelStatus.networkStatus.CameraStreamConnectedCallback += CameraStreamStatusChangedCallback; modelContainer.modelStatus.DetectorStatusCallback += (bool val) => { DetectionState = val; }; }
public IMUViewModel(ModelContainer modelContainer) { this.modelContainer = modelContainer; AttitudePlotViewModel = new PlotViewModel("Attitude", 3, 100); //, true, v => v + "°", "roll", "pitch", "yaw"); GyroPlotViewModel = new PlotViewModel("Gyro", 3, 20); //, false, v => v + "°", "x", "y", "z"); MagPlotViewModel = new PlotViewModel("Mag", 3, 20); //, false, v => v + "°", "x", "y", "z"); AccPlotViewModel = new PlotViewModel("Acc", 3, 20); //, false, v => v + "°", "x", "y", "z"); DepthPlotViewModel = new PlotViewModel("Depth", 1, 20, -4, 0); //, false, v => v * -1 + "m", "Depth"); MovementViewModel = new MovementInfoViewModel(); CameraViewModel = new CameraStreamViewModel(); PIDViewModel = new PIDViewModel(modelContainer); modelContainer.jetsonClient.callbacks.PIDCallback += PIDViewModel.UpdatePIDS; modelContainer.modelStatus.networkStatus.CameraStreamConnectedCallback += CameraStreamStatusChangedCallback; modelContainer.dataContainer.Attitude.newDataCallback += (float x, float y, float z) => { float[] a = { x, y, z }; AttitudePlotViewModel.UpdatePlotData(a); }; modelContainer.dataContainer.Acc.newDataCallback += (float x, float y, float z) => { float[] a = { x, y, z }; AccPlotViewModel.UpdatePlotData(a); }; modelContainer.dataContainer.Gyro.newDataCallback += (float x, float y, float z) => { float[] a = { x, y, z }; GyroPlotViewModel.UpdatePlotData(a); }; modelContainer.dataContainer.Mag.newDataCallback += (float x, float y, float z) => { float[] a = { x, y, z }; MagPlotViewModel.UpdatePlotData(a); }; modelContainer.dataContainer.Baro.newDataCallback += (float value) => { float[] a = { value }; DepthPlotViewModel.UpdatePlotData(a); }; }