From 6797510236325440d3639e9ca7a0907baf410224 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Sun, 9 Oct 2011 21:30:28 +0800 Subject: [PATCH] planner quick hil fix gains 4500 4500 4500 500 and reverse rudder --- .gitignore | 11 +++++++- .../GCSViews/Simulation.cs | 28 +++++++++++++++---- .../Release/ArdupilotMegaPlanner.application | 2 +- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index e282838e79..9cf00281e4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,13 @@ CMakeFiles CMakeCache.txt cmake_install.cmake build -/Tools/ArdupilotMegaPlanner/bin/Release/gmapcache \ No newline at end of file +/Tools/ArdupilotMegaPlanner/bin/Release/gmapcache +/Tools/ArdupilotMegaPlanner/APMPlannerXplanes/APMPlannerXplanes/Debug +/Tools/ArdupilotMegaPlanner/CustomImages +/Tools/ArdupilotMegaPlanner/Updater/obj +/Tools/ArdupilotMegaPlanner/Updater/bin +/Tools/ArdupilotMegaPlanner/bin/Debug +/Tools/ArdupilotMegaPlanner/bin/APM Planner.app +/Tools/ArdupilotMegaPlanner/obj +/Tools/ArdupilotMegaPlanner/resedit/bin +/Tools/ArdupilotMegaPlanner/resedit/obj \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index dcc99f45be..407721b827 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -26,6 +26,7 @@ namespace ArdupilotMega.GCSViews EndPoint Remote = (EndPoint)(new IPEndPoint(IPAddress.Any, 0)); byte[] udpdata = new byte[113 * 9 + 5]; // 113 types - 9 items per type (index+8) + 5 byte header float[][] DATA = new float[113][]; + TDataFromAeroSimRC aeroin = new TDataFromAeroSimRC(); DateTime now = DateTime.Now; DateTime lastgpsupdate = DateTime.Now; List position = new List(); @@ -836,7 +837,7 @@ namespace ArdupilotMega.GCSViews } else if (receviedbytes == 582) { - TDataFromAeroSimRC aeroin = new TDataFromAeroSimRC(); + aeroin = new TDataFromAeroSimRC(); object temp = aeroin; @@ -1154,7 +1155,7 @@ namespace ArdupilotMega.GCSViews throttle_out = 1; rudder_out = (float)MainV2.cs.hilch4 / -ruddergain; - collective_out = (float)(MainV2.cs.hilch3 - 1000) / throttlegain; + collective_out = (float)(MainV2.cs.hilch3 - 1500) / throttlegain; } else { @@ -1164,7 +1165,7 @@ namespace ArdupilotMega.GCSViews throttle_out = ((float)MainV2.cs.hilch3 + 5000) / throttlegain; rudder_out = (float)MainV2.cs.hilch4 / ruddergain; } - + /* if ((roll_out == -1 || roll_out == 1) && (pitch_out == -1 || pitch_out == 1)) { this.Invoke((MethodInvoker)delegate @@ -1176,7 +1177,7 @@ namespace ArdupilotMega.GCSViews catch { } }); } - + */ // Limit min and max roll_out = Constrain(roll_out, -1, 1); pitch_out = Constrain(pitch_out, -1, 1); @@ -1207,7 +1208,14 @@ namespace ArdupilotMega.GCSViews else { list3.Clear(); } if (CHKgraphthrottle.Checked) { - list4.Add(time, throttle_out); + if (heli) + { + list4.Add(time, collective_out); + } + else + { + list4.Add(time, throttle_out); + } } else { list4.Clear(); } } @@ -1223,6 +1231,11 @@ namespace ArdupilotMega.GCSViews { updateScreenDisplay(lastfdmdata.latitude, lastfdmdata.longitude, lastfdmdata.altitude * .3048, lastfdmdata.phi, lastfdmdata.theta, lastfdmdata.psi, lastfdmdata.psi, roll_out, pitch_out, rudder_out, throttle_out); } + + if (RAD_aerosimrc.Checked) + { + updateScreenDisplay(aeroin.Model_fLatitude * deg2rad, aeroin.Model_fLongitude * deg2rad, aeroin.Model_fPosZ, aeroin.Model_fRoll, aeroin.Model_fPitch, aeroin.Model_fHeading, aeroin.Model_fHeading, roll_out, pitch_out, rudder_out, throttle_out); + } } } catch (Exception e) { Console.WriteLine("Error updateing screen stuff " + e.ToString()); } @@ -1240,6 +1253,11 @@ namespace ArdupilotMega.GCSViews Array.Copy(BitConverter.GetBytes((double)(rudder_out * REV_rudder)), 0, AeroSimRC, 16, 8); Array.Copy(BitConverter.GetBytes((double)(throttle_out)), 0, AeroSimRC, 24, 8); + if (heli) + { + Array.Copy(BitConverter.GetBytes((double)(collective_out)), 0, AeroSimRC, 24, 8); + } + try { SimulatorRECV.SendTo(AeroSimRC, Remote); diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application index 17a69fd7ac..ab5abf9620 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application +++ b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application @@ -11,7 +11,7 @@ - KL2GgPg3v0nfw+58LySJfeIHyEM= + JxmjTgyhsfYjYCKuWvibXDaws3I=