I was flying my drone in Auto and suddenly notices that the copter started circling very badly during flight so I switched to Loiter mode and it became stable.
Just curious to know why it happened. I have been doing the log analysis by myself and I found that EKF shows the error in heading but hard to find whether the drone started spining due to heading error or error increased due to spinning.
My drone first priority is GPS based yaw and then compass fallback. I am not able to find anything on whether GPS based yaw became poor or not.
As the GPS data looks proper.
Even if the GPS based Yaw became poor then drone should have switched to compass so why it did not switched to compass for heading? on what situation it will switch to compass?
So this hows that there is no EKF heading issue as the desired yaw increased before the EKF3 heading error increases, so heading estimation is perfectly fine.
Desired & actual heading is following each other. Means that drone is doing best to reach the desired heading so which means yaw estimation is perfectly fine.
The drone is rotating anti-clockwise and making bad roll & pitch angles also (shooting upto 80 degrees)
So to counter the anti-clock wise rotation, it should run the clockwise motors faster but it slowing down clockwise motors which is 1, 3 & 6.
6th motor (clockwise) is almost at 0 throttle then how the drone will counter the anticlock wise rotation?
My understanding is that It might be bad yaw tuning. But i want to have clarity whether my way of analysis is correct or not. So I would really appreciate if somebody can help me to resolve this issue.
I was looking at this log earlier and could not see any of the typical reasons for the rotations during flight. There was no motor/ESC issues, major compass problems or RC yaw input.
I didn’t see any specific issue with yaw tuning (or other tuning), but you could certainly reduce the PIDs a bit to these values without making yaw any worse:
Thanks for the response, so that means I was a bit right with my analysis.
Yes! I will reduce the PIDs as you stated and fly tomorrow morning.
Actually, sometime it takes lot of time for configuration the second GPS, I just turned it off and wait till fence arming disappear.
Actually I have the dual antenna GPS configuration for yaw, which is the primary GPS, the second one is just a failsafe GPS and I am running a script for that.
[/quote]
Would be waiting for @Yuri_Rage sir reply. But as per my understanding, the GPS yaw is fine as I have been using this configuration for last few months.
But this won’t be a problem I guess. Still waiting for the experts response. If I could solve this problem then maybe I would improve my log analysis skills.
So here If I am not wrong, these are the 3 EKF lanes, as I can see that all 3 lanes almost estimates the same heading. Now how can i know that what sensors each lane is using to estimate the heading?
If I am not wrong as I have set the Primary as GPS for yaw so XKF1[0] is the primary lane which might be using the primary GPS for yaw estimation.
and other 2 might be using the compass for yaw estimation.
The primary EKF yaw is exactly matching the vehicle achieved yaw but bit off to the estimated yaw (AHRS2.YAW). Which makes total sense as EKF yaw is the actual yaw not the desired yaw.
Desired yaw is what FC calculates based on the PIDs. So here the flaw is in desired yaw not the actual or estimated yaw as that EKF all lanes are estimating correct.
Btw, I did the manual flight and rotated the drone in clockwise and anti clockwise direction many times and did not see any issue. Which means can it be a mission problem? I am planning the mission in QGC. I will post the log soon.
I have seen your ArduPilot methodic configurator post, this is what exactly I have been looking for. Thanks for that wonderful post, it is really a great and crystal clear work. From now on wards, I will follow that guide.
I am just tagging you if you can get a chance to comment something on my issue. I don’t know whether it is okay or recommended to tag you or anybody in my post. If it not then sorry for that, I won’t do it again.
Desired Yaw is what was commanded of the copter, like an RC yaw input or mission command or even just the setting for yaw to point along GPS path during a mission.
If desired and actual yaw are very close, then the copter is just doing what it’s told. If desired is lagging actual (more often seen with pitch and roll) that is because there is an effort (in the code) to keep desired within reach of actual - or the PIDs build up too much leading to possible disaster.
If desired was leading there could be more tuning work, or the copters components are not meeting expectations.
What I havent been sure about is where the desired yaw (to do circles) is coming from.
Yes, this might be the source of the problem. I hope if someone can help me to find out the problem.
Btw, this is really interesting to do the log analysis, it basically helps to understand how the ardupilot works. So thank you and people who have made this wonderful community.
Hey @Vkk01 thanks for the feedback. Better than just reading the post is: using the ArduPilot methodic configurator software AND reading the post AND using the AI chatbot on the website.
Thanks @amilcarlucas for your response,
I am doing that, it will take some time for me to understand all fully.
Do you have any comment on my current issue? like why the drone is behaving like this?
I hope you are doing good. Can you please have a look at my GPS for Yaw configuration? I have a doubt on my GPS, I think my GPS is estimating wrong heading and that’s why the drone is rotating.
Because I tried all sorts of things and it is still coming in every 2nd flight.
@xfacta I have changed these PIDs but it is still coming. I think the fault is GPS based Yaw.
There’s nothing wrong with the GPS configuration, and it is reporting consistent heading.
When the Copter is on the ground, is the heading reported correctly? If not, you may have the GPS_MB1_OFS* parameters configured in the wrong axes. Otherwise, I cannot see a reason to blame the GPS for any of this.
And if you zoom in here then you can find out that GPS yaw is first changing followed by the Desired Yaw and Followed by the actual yaw.
I think the GPS is estimating the wrong yaw during the flight and which makes the drone go crazy. So if there is any way to find the estimated heading based on compass then we can actually find out the real cause.
It would be great help for me If you can check my compass whether they are good fit to use during the flight so that I can give compass as primary source for heading instead of fallback and do some testing to see whether this issue will still come or not.
I have done the magfit calibration but I still have a doubt whether compass are good to use or not because my drone has lot of interference issue.
What I can understand from this magfit calibration is that mean field error would still be more than 20 even after motor & iron offset calibration. I really don’t know whether this is in acceptable range or not.
EDIT: see follow on conversation below. I was incorrect about GPS orientation as a culprit.
Actually, now that I plot AHRS yaw and GPS yaw on the same scale, we can see that GPS yaw is consistently reported 90 degrees off. So your system is almost certainly mis-configured and fighting itself.
At a minimum, you likely have GPS_MB1_OFS_X and GPS_MB1_OFS_Y reversed, with a high likelihood of the same error regarding GPS_POS1_X and GPS_POS1_Y.
AHRS yaw is the fusion of all sensors (as calculated by the EKF). GPS course (while in motion) is taken as a truth source to correct yaw misalignment. So the EKF is probably biasing in the direction of GPS yaw whilst using GPS course to attempt to keep the AHRS happy.
The best way it to fix the problem at it’s source: Keep high current wires (battery, ESCs and motor cables) away from the FC and from the GPS receivers (where the compasses are).
Hey @Yuri_Rage, Thanks for reply. I again rechecked all, It seems okay to me.
Here is the setup info:
I have mounted my cube facing exact back so I kept the AHRS orientation as Yaw 180 (Value 4).
My Master antenna is coming left side of the drone on Y-axis and the separation between both antenna is 85cm, so I kept the value GPS_MB1_OFS_Y to -0.85. I have kept the antenna on the center motor axis of the hexacopter.
As the Master antenna is coming left side of the cg axis, not front & back. So I kept the GPS_POS1_Y to -0.43
Now as I mounted the cube facing back so I need to consider the master antenna to the reference of cube orientation? or the drone orientation?
Maybe I need to change the compass orientation as well or it will automatically change once I set the cube orientation?
Edit: As the GPS course is taken as true source for yaw and if my GPS configuration is wrong then drone should fly in different orientation during flight but it is flying in correct orientation, facing front during flight. So I guess GPS configuration is correct maybe I need to change the compass configuration or orientation?
So currently, I kept the compasses as far as possible to avoid the interference, this frame does not have much spacing, I need to give some provision to keep the stand so I can mount my compass at some more height.
But what do you say to my present compass interference? is it bad? Isn’t the battery current offset work?