Compass, Loiter and Toiletbowl

I am a newbie and am learning how to get everything working together. I have been having trouble for a few months attempting to get my quad build stable.

I am using an SK450 frame with a pixhawk and ubloc (and 900mhz telemetry) from 3DR on the GPS mast. Afro ESC and Sunnysky 980kv motors. I am using FrSky on 2.4 for control. Current Mission planner.

I had the quad pretty stable for a bit using an upside down yogurt container as a GPS mast. I wanted to get FollowMe mode working so I updated to 3.2 and crashed. After the rebuild I reverted to the stable build 3.1 and I used the GPS mast instead of the yogurt container.

Loiter mode is just not entirely stable. It will start to slowly toiletbowl. Not fast like it has in the past, but slowly start to toiletbowl. I have run through the compass and accel calibrations many many times. I also have run compassmot which currently is reporting about 20%. (18-22%)

Under 3.2 it would give me bad compass health errors at startup.

So I have some questions and would appreciate it if someone could take a look at the recent included log file as I am running out of leads.

  1. Do the arrows on the pixhawk and ext 3dr compass/GPS have to be pointed in the same direction?

  2. Does the PDB need to be far away from the pixhawk or the compass? I can get it away from one but not both. There simply isn’t enough real estate.

  3. I have removed the screw in the lower right of pixhawk with the idea that it may be effecting the internal compass, but it didn’t change anything.

  4. Does the pixhawk have to be well bonded to the airframe or can it float a bit?

  5. Do I have a bad sensor?

I have run the log analysis and it reported:
Log File E:/APM/LOGS/91.log
Size (kb) 7098.3466796875
No of lines 96548
Duration 0:10:46
Vehicletype ArduCopter
Firmware Version ArduCopter
Firmware Hash
Hardware Type
Free Mem 0
Skipped Lines 0

Test: Brownout = PASS -
Test: Compass = FAIL - Large compass off params (X:-75.74, Y:-165.91, Z:-234.92)
Large compass offset in MAG data:
Y: -165.00
Z: -234.00
Large change in mag_field (160.01%)
Max mag field length (578.93) > recommended (550.00)

Test: Dupe Log Data = PASS -
Test: Empty = PASS -
Test: Event/Failsafe = FAIL - ERR found: FS_BATT
Test: GPS = FAIL - Min satellites: 4, Max HDop: 5.13
Test: Parameters = PASS -
Test: PM = PASS -
Test: Pitch/Roll = FAIL - Pitch (-58.51, line 81171) > maximum lean angle (45.00)
Test: Underpowered = PASS -
Test: VCC = PASS -

  1. It reports the Compass = FAIL because of large offets and large change in mag field.
    a. This is different that what is reported by compassmot.
    b. I am at a loss on what additionally I can do to deal with the compass(es). The external compass unit (ubloc from 3DR) it on an official 3DR mast an sticks significantly above the unit. The pixhawk is pretty close to the PDB but I am out of ideas on how to separate the two. Maybe I could get a few cm more, maybe.

Thanks,

Ed

Here are some images of the Quad to show relative positions of some of the important items.

Yes.

It needs to be away from the compass.

Nope, that would cause a slight change in offset.

PIXHAWK should be well-isolated from vibration. Yours looks ok, but if you do some fast flight that might change.

No. There’s definitely something up with the offsets (compass calibration) though. Since you have telemetry, can you send me a telemetry log (.tlog) containing 360-degree rotations about the vertical axis in the following orientations:

  • level
  • left down
  • right down
  • nose up
  • nose down
  • upside-down

They don’t have to be perfect, you can just hold it and rotate it in your hands.

I think I have what you requested. I flew it again today.
The spiral is slow and somewhat manageable, but annoying. :slight_smile:

COMPASS_OFS_X -83.790526
COMPASS_OFS_Y -26.977896
COMPASS_OFS_Z -53.909145
COMPASS_OFS2_X -126.172951
COMPASS_OFS2_Y -139.136374
COMPASS_OFS2_Z -243.354855

Sorry for my ignorance.

  1. What should I do with those offsets?
  2. Are they what they should be or what they currently are?
  3. How did you determine them?
  4. Why are they different from what is being used?
  5. what should I do going forward?

I flew it again yesterday in windy conditions. One flight it seemed to have no problems, the next flight exhibited the slow spiral.

Thanks! I am looking forward to solving this and learning a bit more how everything integrates.

EdWilders.

They are parameters that you can input on the full parameter list in mission planner.
They are what your compass calibration should be.
I got them by running a compass calibration algorithm over your log.

Thank you!
I guess what I am trying to understand is The Why. You calculated new offsets from a small amount of data. I have repeatedly run the compass calibration where many more data points were taken.

  1. Why did the compass calibration routine not calculate the correct offsets? What are some possible reasons?
  2. What did I do wrong or what do I need to do differently so that the calibration will determine the correct offsets? I do not want to continue the error.
  3. What units are the offset values?
  4. What is the baseline or from what does the compass values need to be offset?

EdWilders

1 Like

[quote=“EdWilders”]Thank you!
I guess what I am trying to understand is The Why. You calculated new offsets from a small amount of data. I have repeatedly run the compass calibration where many more data points were taken.

  1. Why did the compass calibration routine not calculate the correct offsets? What are some possible reasons?
  2. What did I do wrong or what do I need to do differently so that the calibration will determine the correct offsets? I do not want to continue the error.[/quote]
    Not certain why. Perhaps it didn’t get enough points, or it was done too close to something magnetic?

I think they are (roughly) microteslas.

The “compass” is a 3-axis magnetometer. It yields a 3-dimensional magnetic field vector, which is the vector sum of the earth’s magnetic field, the magnetic field of anything that happens to be on the vehicle, and any bias inherent to the sensor. So, we subtract off the latter two, the body-fixed magnetic field errors - that is what the offsets are.

In addition, we have compassmot, which lets you subtract off the dynamic magnetic field from high-current power wires in your power distribution. We will also eventually have scale factors - of note is that your Z-axis magnetometer is scaled by 20% - pretty bad, but luckily it is the Z-axis, which doesn’t matter very much much.

Update:
I have completed several flight and have run into some different issues and when they are resolved I will pick this one back up.

I put in the new compass offsets and flew it. It flew well, but I was not paying much attention to MP (hard to see), ran the battery out and crashed it. :blush: In my defense, the battery indicator in MP still showed about 20% although the voltage was very low. It survived surprisingly well. During rebuilding I noticed that some of the screws seemed to be magnetized, so I removed the upper level screws and heated them up on the stove. That wasn’t working too well, so I moved them to a spoon over a candle. Eventually they stopped showing attraction to a kitchen knife.

I reran the wizard and all the setup calibrations, worked out a few more bugs. Hosed my telemetry radios by attempting to increase the air and baud rates via MP. Now neither respond in anyway to MP although their lights appear to show that the radios are communicating with each other. :cry:

I went for another flight without telemetry and it worked well. As I was coming down for a landing (LAND mode), it freaked out and crashed. What I think happened is that a micro crack in the frame from a previous crash caused a motor/prop/end of arm to break off. At least that is how it very briefly looked while crashing and how it ended up when I retrieved it.

So compass fixes are on hold until I get new frame bits and I resolve the 3dr telemetry radio issues.

Thank you very much for your help.
Ed

Where can find this compass calibration algorythm. I need to change those params aswell. Having the same issue "Test: Compass = FAIL - FAIL: Large compass offset params (X:205.93, Y:-33.68, Z:494.66)
FAIL: Large compass offset in MAG data (X:205.00, Y:-33.00, Z:494.00)
mag_field interference within limits (5.39%)
Max mag field length (664.36) > recommended (550.00)
".

1 Like

I’m also wondering the same thing - @Sander, were you able to find it?

Thanks!