Hello there,

I'm trying to get an octocopter I built to perform well enough on Loiter. Stabilize always works really well, but loiter sometimes works and sometimes doesn't.

It shows toilet bowl-like behaviour, where it spirals out of control. Horizontal speed keeps increasing until it touches ground or hits something.

I tried the following, to no avail:
- Calibrated compass using On-Board calibration. Offsets: (X:~16 Y:~49 Z:~35)
- Recalibrated acc and gyros
- Adjusted (without adjusting other params) (+50%) POS_XY_P
- Adjusted (without adjusting other params) (+100%) WPNAV_LOIT_MAXA
- Tried flying with auto declination enabled
- Tried with manual declination
- Double checked declination
- Compass-motor calibration done (~30% interference at home, tied down).
- Moved flight controller upwards, away from electronics


I use a PX4 (actually a Pixhack, which is almost identical but with better EMF shielding) with Arducopter 3.5.2.

Sometimes it works, then the next day it doesn't work at all.

Log file attached. Screenshot plotting PosX vs DPosX and VelX vs DVelX attached as well.

Feel free to blurt out whatever comes to mind. I am utterly desperate. There must be something I am completely missing!

Views: 210

Attachments:

Reply to This

Replies to This Discussion

Toilet bowling is usually caused by the compass heading being out of phase with the true heading of the MR. Calibration fixes this normally on the ground but in the air other things can come into effect, particularly magnetic fields generated by DC current through wires.

It doesn't look like you're using a external compass? That's the first thing to rectify and place it at least 10cm above the nearest wires carrying any DC voltage. Usually this will fix the problem completely.

Note: AutoDec should always be enabled. COMPASS_LEARN can also be left on.

Graphing magX also shows some unwanted oscillation in the first part of the log. There's also major fluctuations in magX while flying which don't seem to correspond with the yaw angle, need an external compass here.

Thanks for your observations; it helps a lot.

You're right, I am only using the internal compass. Quite dumb of me to completely forget about that. However, I disabled it on purpose, months ago. There is a part of the story I completely forgot to mention.


Months ago, the only way I could get it to calibrate, and fly well in loiter, was by disabling the external compass. I tried for months to get it to work with both compasses or either exclusively the external one. I even made modifications to the compass driver in NuttX to make sure that data from the internal compass wasn't being fused with data from the external compass.

Still, my flight controller is positioned 10cm above the center of mass. The wires powering the ESCs are below the center of mass. I thought that would be enough to deal with interference. Although the currents in the flight controller alone might be enough to cause the interference you are seeing. (I have peripherals like a Pixy, which uses quite bit of power).

Unfortunately, I had very high offsets with the external compass and was unable to calibrate with it enabled back then.

I will try flying with the external compass enabled again. A lot has changed since the last time I tried flying with it. There is now more distance between components, ArduCopter has been updated, and I am using another FC board.

When you say "place it 10 above the nearest wires carrying any DC voltage", does this include 5V power wires? Or just the wires powering the motors?

Yes, currents in the FC and close peripherals can cause magnetic interference, definitely. APM2.0 had problems as it only had compass onboard and many things were tried to get around this. The way I understand it is that you can disable the internal compass but not the external one for the best chance at success.

5V power wires generally carry low currents so should be OK but magnetometers are very sensitive so best if you can avoid them. Avoid any battery supply wires and motor supply wires.

How close are your esc's to the pixhack or gps? Somethings that ussually helps is raising the gps on a mast, moving gps away from power wires and esc's, twisting the ground and power wires to reduce electromagnetic interference.

Thanks for both of your insights.

Based on the given suggestions, I made some changes and flew again in two areas. I tested Loiter and WPNav, with success. However I am not convinced the problem won't come back again, time will tell. 

I made the following changes:

- Enabled COMPASS_LEARN

- Enabled AUTODEC 

- COMPASS_USE is enabled

- COMPASS_USE2 is disabled (means internal compass won't be used for heading estimate).

- Connected I2C cable from my GPS, thus enabling the external compass again.

- Calibrated in a park (away from interference from metallic objects), using Mission Planner's on-board calibration.

- No motor calibration

- Flight controller is mounted 10 cm from base of frame, like before.

- Increased length of my GPS mast from ~5 cm to ~10 cm. (GPS mast base is attached to the flight controller)

- The GPS module is therefore distanced in 20cm from the base of the frame, and 10cm from the flight controller.

PS: MAG2 = Internal compass, MAG = External compass

As you can see, the internal compass is a bit noisier, especially when Dist1 = 0 (not flying). When not flying, the internal compass seems to oscillate at ~8Hz, visible on both X and Y axles on the picture above.

Flight log: https://www.dropbox.com/s/2uje7naizrrjqa6/00000028.BIN?dl=0

Do the compass values in the log look healthy now?

Reply to Discussion

RSS

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service