Update: 2020-11-27 Relationship to telemetry(/OSD?) Disproven?
The relation to telemetry was proven false in further testing. That implies that the relation to OSD (a form of telemetry) also needs to be retested.
I can recreate this issue (~ 4Hz oscillation in VelocityRoam mode) every time (but only when vehicle is pointed south). I tried both leaving GCS telemetry powered off and completely disabling the quad FC's OpLink and the oscillation still happened.In relation to oscillations that occur when using OSD-telemetry (
https://forum.librepilot.org/index.php?topic=4923.0), I have basically confirmed that it happens with normal telemetry too. It happens with my 16.09 Sparky2 DJI GPS quad when using telemetry in VelocityRoam. Not in Attitude mode. Further testing is needed.
For VelocityRoam (and I presume any similar GPS mode) some setups have "steps" or fast oscillations in stabilization. Instead of quickly becoming level it takes small steps toward level about every 250ms (time is guessed). Strangely, stick response is still immediate, so it acts like it's concept of level is oscillating, but not the stick control response that is relative to that concept.
Years ago I saw the GCS attitude oscillate when the quad was motionless on the ground. Recalibrating the mags seemed to fix that. I want to get all the info I can get before I recal the mags and the problem seems to go away again. The new/old WorldMagModel may even have an issue here. Some of my quads have the new model and some the old. Some of my quads have my DJI GPS oscillation fix (as posted on the forum). Not sure about this quad.
It appears that several similar issues may all have the same cause. This has been seen even before 16.09 and with Ublox GPS. Both the pre-16.09/Ublox-GPS and my 16.09/DJI-GPS have a fast east/west oscillation that can become this fast-stepped-recovery to a slow 4 second oscillation for my 16.09/DJI-GPS and . This quad is tuned fairly tightly with AutoTune with a high max roll rate, so the attitude commands from VelocityRoam have a very quick response. It may be that loosely tuned models would not show the stepping, and only the slow oscillation.
One possible reason that also needs to be explored is that pirouettes (even very slow ones) with this quad, cause a lateral drift that is related to compass heading. When you do a full 360, the drift comes back to the original location.
This implies that the GPS antenna has a directional offset? One of the things on my list :slightly_smiling_face: is to add a GPS mount offset so that this pirouette is stationary. This issue raises questions about bank angle though. Does the GPS have a bank angle offset too? That would cause this issue too. I need to rotate the GPS 90 degrees, change aux mag orientation, and see if the oscillation is still east-west or whether it is now north-south. This seems to be caused by bad sensor calibrations (accel and mag) so it's hover position is in the direction of non-level drift with the GPS constantly trying to pull it back. You yaw rotate and the drift is in a different direction but it tries to bring it back to the "Position Hold" location.
Then there are all those unneeded telemetry packets that I found some years ago; remove them all to see if it is congestion related. Maybe try really reducing all the telemetry for a test. It is odd that increasing a telemetry packet rate makes the fast oscillation / steps quicker (in time with telemetry) and thus less of a problem. It would seem that reducing the telemetry packet rate would slow the fast oscillation down and make it worse. Slowing it down should reduce congestion if that is an issue.
Further testing is needed ... to recreate the issue, and to see that it goes away if telemetry is disconnected or disabled entirely. To see if the new WorldMagModel helps. To compare with/without the DJI oscillation fix code that I posted on the forum some time ago (recall though that it happens with Ublox too). To see if reducing the AutoTune PIDs is warranted. To see if a coded GPS mount offset (pirouette drift out and back) is warranted. To see if GPS bank angle affects the GPS location that it gives to us. Note to self: I need to rotate the GPS 90 degrees, change aux mag orientation, and see if the oscillation is still east-west or whether it is now north-south.
I will try to get some logs, examine them for clues, and make videos.
Here is @Trust's recent thread with excellent video of the same problem (watch the video in the first post from 0:18 to 0:30). @Trust complained of the quick oscillation, but you can see that there is the same slow oscillation too.
https://forum.librepilot.org/index.php?topic=4923.0Here is a video from years ago. The first 10 seconds show the large slow oscillation with steps. The rest of the video is full of recording dropouts and is worthless.
password is oops
Edit 20201125: Here are some possible reasons and factors I can think of for these oscillations. If you think of one not mentioned, feel free to post about it here:
- See if it goes away if telemetry is just disconnected (coordinator powered off) or if telemetry must be disabled in the model or if just drastically reducing the number/size of packets makes it go away.
- Simple priority issue. Both telemetry and stabilization must be high priority. Loosen the tight 2ms telemetry reply window and reduce the telemetry priority. What does this do to OpLink RC control?
- Examine captured telemetry: See if some of the embedded debug shows signs of a problem:
ActuatorCommand->UpdateTime, MaxUpdateTime, NumFailedUpdates
ActuatorDesired->UpdateTime, NumLongUpdates
CallBackInfo
EKFStateVariance
SystemAlarms
TaskInfo
etc
- Does increasing VtolPathFollower->UpdatePeriod (to more than the telemetry period) have an affect?
- Add debug to watch the starving of stab by telemetry "after the fact" since telemetry is part of the problem- Try to time the period exactly. That may hint at what it is related to if it is a nice number like 250ms.
- Change the PID tunings and/or vehicle weight to see if the oscillation period changes. If it changes, the problem is not related to a timed process.
The following aren't fixes since it only occurs with telemetry enabled. They are probably only interesting side projects at this point:Interesting related topics:
- See if the new WorldMagModel helps.
- Compare with/without the DJI GPS oscillation fix code that I posted on the forum some time ago (recall though that it happens with Ublox too). DJI GPS fix code helps the slow oscillation, but not the fast oscillation.
- See if reducing the AutoTune PIDs is warranted. Probably not since user @trust has the issue without using AutoTune to tune PIDs.- Rotate the GPS mounting say 90 degrees and correct for this in aux mag orientation settings. See if the problem is still an east west oscillation when facing south (north with some vehicles).
- See if a coded GPS mount offset (pirouette drift out and back) is warranted.
- See if GPS bank angle affects the GPS location that it gives to us.
- Imagine what an incorrect WorldMagModel value would do. If magnetic inclination is wrong then there would be 0 or 2 headings that would match. Imagine a cone pointing straight down from the vehicle. The magnetic field should be a line on that cone. If the mag vector falls inside the cone then there are two roll angles that put the vector on the cone.
- Hand code a WMM inclination offset and vary that to see if the oscillation changes.
- Try old EKF settings.
- Oscillation seemed significantly worse at the PCMA field than at the house 35 miles away. Both using the same HomeLocation (at PCMA).