Hi All,
This is my first post here. I am very new to this so please forgive me if I am a little ignorant. I have found the new Ardupilot site fantastic. Great resource.
I would like to use the log captured on my dataflash to see if I have any issues with compass interference. Can someone verify that I have the information correct please.
I am running APM 2.5 on the latest firmware 3.1.2. I have captured the necessary data (IMU and COMPASS) logs and have placed it into a spreadsheet. IMU for vibration COMPASS for compass interference. After capturing the data I turned both IMU and COMPASS off to reduce log file size and free up processor time as per instructions.
When looking this up on the Ardupilot site I noticed that the following was a little misleading:
[color=#400000]Another general thing to check re the compass is the offsets which should bet between -150 ~ 150. These are found in the tlog’s SENSOR_OFFSET group as mag_ofs_x, mag_ofs_y, mag_ofs_z and in the dataflash’s COMPASS message as[/color] [color=#FF0000]OfsX, OfsY, OfsZ[/color]. [color=#400000]They can also be seen in the parameters as COMPASS_OFS_X, COMPASS_OFS_Y, COMPASS_OFS_Z.[/color]
The dataflash COMPASS message is MOfsx, MOfsy and MOfsz. So initially I grabbed the wrong data (I think?) .
In the same section on the web site it also states the following:-
[color=#400000]Dataflash log’s COMPASS message hold the compass’s raw x, y and z axis values (called MagX, MagY, MagZ) which are equivalent to the tlog’s RAW_IMU xmag, ymag and zmag fields. It’s possible to calculate the mag-field length by first loading the dataflash log file into excel, filtering by the COMPASS message and then calculating the mag-field using the formula mag_field = sqrt(MagX^2, MagY^2, MagZ^2). Note that the COMPASS message is not enabled by default in the dataflash logs because it runs at 50hz and does affect CPU performance a bit. [/color]
The formula states “mag_field = sqrt(MagX^2, MagY^2, MagZ^2)” I took all the mag fields and then on each row of a spreadsheet I used the following formula on each “MAG” row. I only show the first row formula here.
=SQRT(POWER(A1,2) + POWER(B1,2) + POWER(C1,2))
Then I take the Max, Median and Minimum values from the column and work out the percentage difference above and below the median value.
Should I be adding the values or multiplying them. The formula given, I guess, is for a function in a programming language of some sort. I am not familiar with the syntax of the statement.
Using the above formula I produced a graph that followed the throttle graph. But I am not sure if the values are correct to calculate the correct percentages. Using the above method I got a completely different value that I received using the compassmot procedure which gave me a reading of over 400%. I think the issue there was that the current readings had not been calibrated as I do not have a way to measure the current at present. So the internal reading could be a mile out.
In the spreadsheet I am not sure if I should take the minimum reading as 0 or to the lowest value once the motors have the craft flying. In the attached image you can see that the blue line (compass Offset) follows the red line (throttle) closely. Should I take the minimum value as zero or should it be around 250. This makes a huge difference the end result. Note: the Red Throttle line was produced in Mission Planner captured and then overlaid onto the Graph in the Spreadsheet.
As the result from this exercise was a figure of around 30% - 35% I have decided to get a GPS/Magnetometer and mount it on the end of a small pole up and away form the electrics. This I hope will prevent any potential issues. It will also lessen any interference with the GPS making it more reliable in Return to Home and Loiter.
The ultimate test will be if it still circles (Toilet Bowls) once the Magnetometer is moved. Though I must admit I was not sure if the circling was due to the wind or to the hardware.
If the above excel formula is correct then I will write a macro that will grab all the necessary data from a log file and process it to give the percentage values. It seems a lot easier and more reliable than the compassmot (rather potentially dangerous) method.
I appreciate any information on this. Thank you.
Regards,
Neil…