private void ReportState(ref System.Windows.Forms.TextBox textBox1) { double currentThrottle = ((AxialAlpha.GetThrottle() + AxialBeta.GetThrottle() + AxialCharlie.GetThrottle()) / 3); if (altitude > 0) { textBox1.Text += "Craft is now at: " + String.Format("{0:N1}", altitude) + " meters, falling at " + String.Format("{0:N1}", velocity) + " meters per second. (Throttle: " + String.Format("{0:N3}", currentThrottle) + ").\r\n"; DataRecorderCSV.WriteLine(String.Format("{0:N1}", altitude) + ", " + String.Format("{0:N1}", velocity) + ", " + String.Format("{0:N3}", currentThrottle)); } else { if (DidVehicleLandSafely(velocity)) { textBox1.Text += "Craft landed at: " + String.Format("{0:N1}", velocity) + " meters per second.\r\n"; DataRecorderCSV.WriteLine("Craft landed at: " + String.Format("{0:N1}", velocity) + " meters per second."); } else { textBox1.Text += "Craft crashed at: " + String.Format("{0:N1}", velocity) + " meters per second.\r\n"; DataRecorderCSV.WriteLine("Craft crashed at: " + String.Format("{0:N1}", velocity) + " meters per second."); } textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret(); } textBox1.Refresh(); }
private bool RunThrottleTest(ref AxialThruster testThruster, double throttleTest, int resultTest) { // Try setting throttle try { testThruster.SetThrottle(throttleTest); } catch { if (resultTest != -1) { // Log a failure or output message return(false); } } // Try getting throttle if (resultTest == -1) { try { if (testThruster.GetThrottle() != 0) { Debug.Write(testThruster.GetThrottle()); // Log a failure or output message return(false); } } catch { // Log a failure or output message return(false); } } else { if (testThruster.GetThrottle() != throttleTest) { // Log a failure or output message return(false); } } // Try getting thrust if (resultTest == -1) { try { if (testThruster.GetThrust() != 0) { // Log a failure or output message return(false); } } catch { // We expect failure possibilities depending on input } } else { try { if (testThruster.GetThrust() != resultTest) { // Log a failure or output message return(false); } } catch { // Log a failure or output message return(false); } } // Get generated thrust try { if (testThruster.GetThrustGenerated() != 24) { // Log a failure or output message return(false); } } catch { return(false); } // Nothing else made us fail, so it looks good return(true); }