private void updateInstrument(AltimeterInstrumentControl control, ARDrone.Control.ARDroneControl.DroneData droneData) { control.Invoke((MethodInvoker) delegate { control.SetAlimeterParameters(droneData.Altitude); }); }
private void updateInstrument(AttitudeIndicatorInstrumentControl control, ARDrone.Control.ARDroneControl.DroneData droneData) { control.Invoke((MethodInvoker) delegate { control.SetAttitudeIndicatorParameters((droneData.Theta / 1000), -(droneData.Phi / 1000)); }); }
private void updateInstrument(HeadingIndicatorInstrumentControl control, ARDrone.Control.ARDroneControl.DroneData droneData) { control.Invoke((MethodInvoker) delegate { // Psi range -180..0..180 but heading indicator require 0..360 if (droneData.Psi > 0) { control.SetHeadingIndicatorParameters(Convert.ToInt32(droneData.Psi / 1000)); } else { control.SetHeadingIndicatorParameters(360 + Convert.ToInt32(droneData.Psi / 1000)); } }); }
private void updateInstruments() { if (this.arDroneControl.IsConnected) { ARDrone.Control.ARDroneControl.DroneData droneData = arDroneControl.GetCurrentDroneData(); foreach (InstrumentControl instrumentControl in instrumentList) { try { switch (instrumentControl.GetType().Name) { case "AttitudeIndicatorInstrumentControl": updateInstrument((AttitudeIndicatorInstrumentControl)instrumentControl, droneData); break; case "AltimeterInstrumentControl": updateInstrument((AltimeterInstrumentControl)instrumentControl, droneData); break; case "HeadingIndicatorInstrumentControl": updateInstrument((HeadingIndicatorInstrumentControl)instrumentControl, droneData); break; case "VerticalSpeedIndicatorInstrumentControl": updateInstrument((VerticalSpeedIndicatorInstrumentControl)instrumentControl, droneData); break; } } catch (Exception e) { Console.WriteLine(e.Message); this.stopManage(); } } } }
private void updateInstrument(VerticalSpeedIndicatorInstrumentControl control, ARDrone.Control.ARDroneControl.DroneData droneData) { control.Invoke((MethodInvoker) delegate { control.SetVerticalSpeedIndicatorParameters(Convert.ToInt32(droneData.vZ)); }); }