Jump to content

Cannot calibrate Gyro with Mag Compass


Nealius

Recommended Posts

On 11/10/2023 at 5:43 PM, NineLine said:

Thanks, I am gonna try and take a look this weekend. 

@NineLine

In another thread about the compasses in the Mosquito (here) we've had a similar discussion, and the repeater compass in the Mosquito shows similar behaviour.  In that case there's also a P8M compass in the cockpit which does adjust for pitch and bank (up to 10 degrees) and that compass shows a much smaller error due to the pitch nose-up on the ground, so the two compass readings are usually different (unless you're pointed to magnetic north or south).

I did some testing to work out what the compass heading shown by the repeater was, and am reasonably confident that it's behaving as if fixed in the airframe with no gimbal or float to allow for pitch and bank.  Whether this is realistic or not we're not sure about, but kablamoman's documents here suggest that at least for the P51 the repeater compass should have a pitch/bank allowance from the float.

I think the repeater compass on all modules I've tested shows what I call the 'aircraft magnetic heading' (abbreviated to ACMagHead or acmaghead in my test results below).  This is the magnetic heading obtained by setting up a vector in the magnetic field direction from the declination and inclination values, then rotating it to the aircraft coordinates by rotating through the heading, pitch and bank angles and taking the direction from the x- (forwards) and z- (starboard) coordinates.  This is what I'd expect a simple compass fixed horizontally relative to the aircraft to read.  Ie. it looks to me like the repeater compasses have zero allowance for pitch and bank.  The maximum difference between this and the magnetic heading measured horizontally relative to the ground is indeed around 25 degrees for 12 degrees pitch.

I've repeated these tests now for the P51 and put the results below if they're useful.

To perform the tests I've first set the deviation figures to zero in Mods/aircraft/P-51D/Cockpit/Scripts/RemoteCompass_AN5730/compass_param.lua so that there are no deviations affecting the readings.  I've then set up a hook script to log relevant data at intervals of approx. 4 times a second to a CSV file and set up a mission with a P51 on a parking area at Anapa with start type set to 'Take off from ground (hot)'.  The mission date was left at the default which gives magnetic declination of slightly over 7 degrees east and inclination of 63.2 degrees.

With this setup, I've run a number of static tests at fixed headings, where I set the heading in mission editor to 217, 247, ..., 337, 007, 037 giving magnetic headings of 210, ... 030 and left the aircraft static for a few seconds until the compass pointer is steady, then quit the mission and made a copy of the CSV data.  I also run two dynamic tests where I taxied turning through around 180 degrees to port and to starboard, and again saved the CSV data.

I'll attach tracks for the dynamic tests along with the script used to log the data at the end of this post.

From the CSV data, I made up the following graph, which I'll attempt to explain below.

TestGraph.png

All the plotted lines show the difference between a compass reading figure (calculated or measured) and the 'magyaw' figure, which is the horizontal (relative to ground) magnetic heading obtained from Export.LoGetMagneticYaw().

The blue and black plots are the 'ACMagHead' figure referred to above for the two dynamic (turning taxi) tests, which agree apart from small differences caused by changes in pitch because of ground bumps or uneven acceleration, etc.

The vertical purple lines, with points shown, are the readings of the repeater compass from the static tests at various angles and show the repeater pointer moving to and settling on a reading at the mission start.  The points are at approx. quarter second time intervals.  As can be seen, they settle to a final value close to the calculated curve (within a degree or so, where the pointer damping stops the needle movement).

The red and green plots show the repeater compass readings from the dynamic tests - turning to port (red) and starboard (green).  As can be seen, they generally follow the calculated curve (except for a vertical line where the pointer is moving to its initial heading at mission start), but lag behind it since the pointer takes time to move to the new headings, so that when turning to port the reading is always a bit higher than the calculated heading and to starboard it is always a bit lower.

I think these results support my assertion that it's the 'ACMagHead' figure that the repeater compass shows.

Here are the tracks of the two dynamic tests:

Testing_P51_GroundCirclePort.trk

Testing_P51_GroundCircleStbd.trk

and the hook script used to log the data (which includes the calculation of the ACMagHead figure):

jb_dcs_dump_data.lua

and here are the CSV files containing the logged data produced by the two dynamic tests:

 

 

jb_dcs_dump_data_CirclePort.csv

jb_dcs_dump_data_CircleStbd.csv

 


Edited by JBDCS
Spotted and fixed small error in .lua script, should not affect the results
  • Like 1
Link to comment
Share on other sites

On 12/20/2023 at 9:10 PM, kablamoman said:

The P-47 and Spitfire correctly read 65 degrees magnetic sitting on the ground in Bazenville aligned with a magnetic heading of 65.

The P-51 and all Axis birds read ~90 degrees with their deck angle titled up on the ground, and the error seems to modulate in relation to the deck angle. Flying with a neutral deck angle along the same heading results in correct readings.

I've just checked in the setup files for the P-47 and the Spitfire.  Those two both have pitch and bank correcting compasses in game - they have a max_pitch_bank setting in the setup file and details of the compass gauge pitch/bank/heading cockpit argument numbers towards the end of the file.  For the P-47 the max_pitch_bank limit is 20 degrees and for the Spitfire it's 10 degrees, so the Spitfire may show some smaller errors if the pitch on the ground is more than that.

For reference the setup files are:

P-47: Mods/aircraft/P-47D-30/Cockpit/Scripts/compass_device.lua

Spitfire: Mods/aircraft/SpitfireLFMkIX/Cockpit/Scripts/compass_device.lua

These are similar to the P8M setup in the Mosquito, which like the Spitfire had a 10 degree limit set up (in Mods/aircraft/MosquitoFBMkVI/Cockpit/Scripts/compass_device.lua) - unsurprising since it's the same compass type.  This still gives small errors on the ground since the aircraft is pitched up at 11.1 degrees, but much smaller than the errors being discussed in this thread.  However the Mosquito repeater compass (Mods/aircraft/MosquitoFBMkVI/Cockpit/Scripts/repeater_compass_device.lua) behaves the same as the P-51 repeater, with large errors.

Looking at the FW-190D9, that one (Mods/aircraft/FW-190D9/Cockpit/Scripts/Avionics/MagneticCompass.lua) does have a max_pitch_bank setting in it (of 20 degrees), but I think last time I tried that, which was admittedly a few years ago, it still gave the large errors despite having that line in there, and your post suggests that's still the case.

Maybe it needs a fully-featured compass setup with pitch and bank corrections in the "gauge" table for the corrections to work properly, which the Spitfire, P-47 and the Mosquito P8M have - I'm really just guessing about that though.

Hopefully we can get further comments or info from the devs at some point to clarify the situation.


Edited by JBDCS
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...