public Form1() { InitializeComponent(); gmap.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance; GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly; gmap.Position = new GMap.NET.PointLatLng(42.292315, -83.715531); lastPoint = new GMap.NET.PointLatLng(42.292315, -83.715531); gmap.MouseDoubleClick += new MouseEventHandler(MainMap_MouseDoubleClick); DroneTerminal.AppendText("Drone Battery: 98%" + Environment.NewLine); xbee = new Xbee(this); }
public void UpdateValues() { //Print current GPS position to the terminal if (DroneTerminal.InvokeRequired) { DroneTerminal.Invoke(new MethodInvoker(delegate { DroneTerminal.AppendText("Current GPS: " + SharedVars.currentGps.x + "," + SharedVars.currentGps.y + "," + SharedVars.currentGps.z + '\n'); DroneTerminal.AppendText("Current Gyro: " + SharedVars.sensorData.gyroData.x + "," + SharedVars.sensorData.gyroData.y + "," + SharedVars.sensorData.gyroData.z + '\n'); })); } else { DroneTerminal.AppendText("Current GPS: " + SharedVars.sensorData.currentGPS.x + "," + SharedVars.sensorData.currentGPS.y + "," + SharedVars.sensorData.currentGPS.z + '\n' + "Current Gyro: " + SharedVars.sensorData.gyroData.x + "," + SharedVars.sensorData.gyroData.y + "," + SharedVars.sensorData.gyroData.z + '\n'); } //Update flight mode value if (textBox1.InvokeRequired) { textBox1.Invoke(new MethodInvoker(delegate { textBox1.Text = "Current Flight Mode: " + SharedVars.flightMode.ToString(); })); } else { textBox1.Text = "Current Flight Mode: " + SharedVars.flightMode.ToString(); } if (liveVideoFeedBox.InvokeRequired) { liveVideoFeedBox.Invoke(new MethodInvoker(delegate { liveVideoFeedBox.Image = SharedVars.videoFeedImage; })); } else { //Update Live video feed pic liveVideoFeedBox.Image = SharedVars.videoFeedImage; } if (pictureBox1.InvokeRequired) { pictureBox1.Invoke(new MethodInvoker(delegate { pictureBox1.Image = SharedVars.objectDetectionImage; })); } else { //Update Live video feed pic pictureBox1.Image = SharedVars.objectDetectionImage; } if (gmap.InvokeRequired) { gmap.Invoke(new MethodInvoker(delegate { gmap.Position = new GMap.NET.PointLatLng(SharedVars.sensorData.currentGPS.x, SharedVars.sensorData.currentGPS.y); })); } else { //Jump to current GPS position on map gmap.Position = new GMap.NET.PointLatLng(SharedVars.sensorData.currentGPS.x, SharedVars.sensorData.currentGPS.y); } }
private void button1_Click(object sender, EventArgs e) { textBox1.Text = "Current Flight Mode: Return to Operator"; DroneTerminal.AppendText("Drone Returning to operator" + Environment.NewLine); sendFlightMode(FlightMode.home); }
//Manual Flight Button private void button4_Click_1(object sender, EventArgs e) { textBox1.Text = "Current Flight Mode: Manual Flight"; DroneTerminal.AppendText("Entering Manual Flight" + Environment.NewLine); sendFlightMode(FlightMode.manualFlight); }
private void button3_Click_1(object sender, EventArgs e) { textBox1.Text = "Current Flight Mode: GPS Waypoint"; DroneTerminal.AppendText("Entering GPS Waypoint Mode" + Environment.NewLine); sendFlightMode(FlightMode.gpsNav); }
private void button2_Click_1(object sender, EventArgs e) { textBox1.Text = "Current Flight Mode: Computer Vision"; DroneTerminal.AppendText("Entering Computer Vision Mode" + Environment.NewLine); sendFlightMode(FlightMode.roadLineDetection); }