I'm still very new to flying a Tarot PRO Hexacopter and APM 3.2.1 and its been fine up to now, I have about 4 hours of flying experience with out incident. I added my FPV components and was about 11 minutes into a perfect flight in Loiter mode and low wind and good weather conditions. While hovering my machine at approx 30 meters altitude it suddenly started a shallow Toilet Bowel effect and got progressive more severe, and then also lost complete control. I tried to activate RTL with no effect. I then switched to Stabilize but because I had pulled the throttle to zero for RTL my machine inverted and was heading for the ground at a rapid rate. After applying full throttle I saved my machine from complete destruction with about half a meter above ground level.
My question is what causes Toilet Bowel effect and what should I do to fix it. Can antbody help please.
This issue here is toilet bowling which is caused by the compass not being calibrated correctly so that it knows what direction the copter is pointing in. From there it will be able to Pitch or Roll the copter in the correct direction to compensate for Loiter or Position hold drift.
If the compass is off it will pitch when it should be rolling causing it to fly in a circle until it crashes.
Could you post the log file?
I had a similar problem when I used neodymium magnet to balance a brushless gimbal. Once I removed the magnets and re-calibrated the compass it worked great again. Also check to see if your external compass/gps may have gotten turned in respect of your Hexacopter.
Loiter is effectively navigation to a fixed point. If you are east of the desired loiter point, and the aircraft heading is pointing north, the aircraft is commanded to roll left to move back to the west and reduce the error. If you are east of the of the desired loiter point, and the aircraft heading is pointing east, the aircraft is commanded to pitch back to move to the west and reduce the error. So, the pitch and roll commands needed are a function of both the position error and the aircraft heading.
Aircraft heading is determined by a mix of the gyros and the compass. In the short term the angular rates from the gyro are integrated, but long term drift is determined by the compass. So, if your compass is not calibrated you can't rely on the aircraft heading data, and don't know which way to steer to move towards any given position. If there is a very large error in the compass (say you have it pointed 180 degrees in the wrong direction) then the aircraft moves in entirely the wrong direction and you don't believe that the navigation loops are working at all, while smaller errors produce the toilet bowl effect where at least you see it trying.
You can see the effect of the mix of gyro and compass data by taking the compass off the aircraft (but leaving it electrically connected). Rotate just the compass and the heading value very slowly moves to a new value (which no longer reflects the aircraft heading). Rotate just the aircraft and in the short term the heading value looks like it is following the aircraft properly, but over the long term will move back to the original (compass defined) value which does not reflect the aircraft heading.
This is not unique to APM. Check the section "Fix the TBE (Toilet Bowl Effect) Problem" of the DJI manual here where they go through which direction to rotate the compass depending on which way the aircraft is circling.
"Loiter is effectively navigation to a fixed point." What defines the point?
"If you are east of the desired loiter point, and the aircraft heading is pointing north, the aircraft is commanded to roll left to move back to the west and reduce the error. If you are east of the of the desired loiter point, and the aircraft heading is pointing east, the aircraft is commanded to pitch back to move to the west and reduce the error."
If the compass is off 90 degrees, east becomes south, north becomes east, west becomes south, substitute in quoted statement and result is the same.
"and reduce the error" What determines the error?
Actual magnetic heading is irrelevant, maintaining a fixed heading is irrelevant to maintaining a hover. Maintaining a fixed heading may make the computing easier that is all. The gyros can be used keep the copter level in pitch, roll and yaw.
"In the short term the angular rates from the gyro are integrated, but long term drift is determined by the compass" How does the compass control long term drift in pitch and roll?
The accelerometers detect movement in the XYZ planes A decent hover can be attained in XYZ by adjusting thrust of individual motors in opposition to accelerometer inputs, along with gyros input. This will not compensate for wind drift however.
A GPS can be used for drift but accuracy is only reliable either short or long term to 2.5 meters at best. Using GPS for position control, will cause "toilet bowling", just by following its short term variations.
If it doesn't know the orientation of the copter to its True North reference it still should be able to adjust, similar to what a human would do hand flying if you move the control right and the copter goes left you move the control right to make it go left.
Again I don't know how the code is written, I do know that GPS is not good for maintaining altitude, or a position within 2.5 meters,
Magnetometers are good at detecting motor thrust levels and other magnetic fields generated by electrical current.
Pressure sensors can measure airspeed changes, as well as altitude changes.
When flying my Piper Arrow, on takeoff, I set my Gyro compass to the runway heading (magnetic) and compare my mag compass reading, generally I use the gyro compass as my main reference. GPS will give my True Heading while flying and where I live the mag heading is 16 degrees west of true north. The autopilot only uses gyro inputs, it could also use Navigation inputs GPS/VOR/ILS but never the mag compass.
If Loiter relies on a calibrated mag compass it will always "toilet bowl" most of the time.
Apparently this concept is harder than I imagined. These are good explanations that don't seem to be getting through. I have written my own flight controller from the ground up. I know how these thing work, so I'm going to throw in my 2 cents and hope for the best. I'm going to take the long way around the barn so buckle-up.
The magnetometer gives a direction vector in three dimensions. As you have noted, it does not give position but only a reference direction. In the flight controller this direction vector is corrected for declination, inclination, hard iron effect and soft iron effect to determine "true" north. The hard iron and soft iron effects are the part that magnetometer calibration effects.
In a flight controller, navigating between way points involves flying towards a distant point until you are "close enough" and then moving on to the next way point. To do this the aircraft's current gps position is compared to the desired position (way point). The difference between these points creates a vector that describes the desired flight path. If the reference direction from the magnetometer is perfect, the aircraft can precisely fly that vector and arrive at the desired location. Each time a new gps reading is acquired, a new vector is determined allowing the aircraft to continue heading directly towards the desired way point even if it is being deflected by wind.
In a situation where the magnetometer is not calibrated correctly, the reference direction has a deviation from true north. If this deviation is "small", nothing bad happens. In a situation where an aircraft is flying towards a distant point, moderate errors look to the controller like it is being effected by wind (or some other force). Example: If the way point was directly north of the aircraft, the error in the reference direction would cause it to travel at an angle slightly off from the desired vector (assuming no other forces acting on the aircraft, this deviation angle would match the error in the reference direction). This deviation angle causes the aircraft to move slightly off of the desired vector. Each new position update detects this deviation and creates a new vector pointing at the desired way point. When approaching from a distance this causes a flight path that instead of looking like a straight line looks like an arc that bends tighter as the aircraft gets closer to the way point.
If the aircraft is told to go to a specific way point and hover on that spot (loiter), then this error in reference direction can be more problematic. Each small move towards the hover point has the same angular error as is found in the reference direction. The next move attempts to both move closer to the desired position and compensate for the error introduced by the last correction. If the error in the reference direction is large enough (bad calibration), then each correction generates more positional error than it corrects. This is called toilet bowl effect. In cases of mild miss-calibration, you can have a toilet bowl effect that does not devolve into a death spiral, but just looks like the aircraft moving slowly in a circular fashion.
In position hold, the desired "way point" is the copters current position when the sticks are released. It will attempt to loiter on this point until given a new command.
Bottom line, magnetometer calibration error can cause an aircraft to move in a direction that is not purely where it wants to go. This generates a flight path is is constantly correcting for error. Extreme cases will cause crashes.
As a side note, many good gps units can give a positional fix that is accurate to +/-1m. With some fancy math and sensor fusion magic, is is possible to hold to a position smaller than this under good conditions.
Thanks Phillip, clear explanation.
thank you for this detailed explanation
The GPS gives you position error, but not an accurate heading at low speed. If you know you're 4 feet south of where you're supposed to be, but don't know which way "south" is, you don't know which way (front, back, left, right) to lean to correct it.
You mentioned that "The hard iron and soft iron effects are the part that magnetometer calibration effects." It is my understanding that this should be a three step calibration;
First, "since tilt/sensitivity errors vary with location, it is not possible to employ a static correction factor (such as a lookup table)"
Second, Hard iron compensation, "Compensating for hard iron distortion is straightforward, accomplished by determining the x and y-offsets and then applying these constants directly to the data. It is important to note that tilt compensation must be applied prior to determining hard iron corrections."
Third, soft iron compensation. "If tilt and hard iron effects are present, compensation for these distortions must be applied prior to correcting for soft iron distortions."
Since we only do a single calibration, I do not see how everything is compensated for correctly.
Can you explain how total calibration is accomplished?
What compass accuracy is expected after calibration?
What compass accuracy is required for proper operation?
You also stated;
" Each time a new gps reading is acquired, a new vector is determined allowing the aircraft to continue heading directly towards the desired way point even if it is being deflected by wind."
This is a poor way to Navigate by GPS, it is called "resetting the needle". The standard way is to navigate on the planned course, each GPS update generates a xtrack error from the desired course and the pilot should correct to keep on course, this also corrects for crosswind in an aircraft and cross currents in a boat. For conventional aircraft the plane's compass heading will be different from the course being flown i.e., the plane appears "crabbed", and the actual compass heading plays no part in the actual navigation except as a "reality check", all corrections are relative, e.g. add or subtract heading degrees to correct course. I can see that in a multi-copter left- right is more complicated because, it can be oriented in any direction, and relies on calculations to determine actual Frame alignement in order to correctly power the proper motors.
Perhaps we need a gimbaled wind vane and always keep frame aligned with apparent wind.
I still contend that even if the alignment of the frame is known precisely, the GPS position accuracy alone will cause an apparent "toilet bowl effect".
Although sometimes it seems we can navigate to within a meter, statistically with the GPS devices in common use, 2.5 meters is the best we can expect most of the time. Some of the time we also will lose lock.
Users keep reporting problems with Loiter. most have done calibration, I believe there is something fundamentally wrong with the implementation, what size compass error causes a problem 5, 10, 15 degrees?
How does that relate to expected calibrated compass accuracy?
With moderate winds I can see that perhaps 45 degrees of compensation could easily be required to order fly a desired course 90 degrees to the wind how is that different than a 45 degree compass error and no wind?
It seems that while in loiter maximum speed should be limited, the videos I've seen and my experience show this isn't the case, which probably only compounds the problem.
At small differences of lat-long is the math running out of precision in calculating bearing to WP vectors?
Here is a copy of a test I ran using UBLOX software on an M8 module, how good would loiter work over this period of time? I believe it was somewhere between 15-30 min after perhaps an hour of lock.
I had the same issue. A mess of wires too with a splitter. I wish the pixhawk had two I2C ports.. just sayin
Every single time I ever had 'toilet bowl' effect it was the compass. You can pretty much take that to the bank Henry. Is your compass with the gps on a pedestal? How far away from the electronic is it? The single most common problem with compass issues is it's too close to electronics. Try and move any wires etc away from the compass. Also you might want to look here
in particular the compass mot which is compass motor compensation. I got rid of my toilet bowl by simply doing the compass mot. I would recommend you only go 3/4 throttle when doing so. I had better luck this way. good luck!
Wow great explanation Phillip thank you!