Hello,
trying to tune the position hold of my helicopter I have seen a strange behaviour of the positon controller.
This is the link to download the log: Unique Download Link | WeTransfer done on the ground with the helicopter perfectly still.
Here is a quick screenshot with the TPN in red and the PN in green.
What I think I see is the movement of the target positon (PSCN-TPN and PSCE-TPE) when the actual position (PSCN-PN and PE) differs too much from the target.
During the test I used Positon hold but I haven’t changed the positon or moved the sticks at all, but it looks like the position controller changes the target position even if not commanded. It seems to be correlated to how far the actual positon is from the target position, or maybe when the target velocity is over a max value?
Is this normal behaviour? Why this happens and what are the parameters that influence it?
Thanks so much, this is starting to drive me insane…
I think your test is invalid since the aircraft knows whether it is flying or not. I’m guessing that because it knows that it is not flying that it slews the target position to the current position. Just before takeoff I believe those would be synched momentarily and then the target would only be affected by autopilot or pilot inputs.
To fool the aircraft on the bench, you would want to disconnect you esc from the battery. Then arm the controller and enable motor interlock. Keep the aircraft in stabilize mode initially and raise the collective. Then raise aircraft off of the ground and set it on a table. Switch into loiter and see what happens. I think the target position wouldn’t move but you would see swashplate inputs happening as the gps drifts where the controller is trying to get the actual position to line up with the target.
To fool the aircraft on the bench, you would want to disconnect you esc from the battery. Then arm the controller and enable motor interlock. Keep the aircraft in stabilize mode initially and raise the collective. Then raise aircraft off of the ground and set it on a table. Switch into loiter and see what happens. I think the target position wouldn’t move but you would see swashplate inputs happening as the gps drifts where the controller is trying to get the actual position to line up with the target.
That’s almost exactly what I did. To be honest, after arming and runup I haven’t raised the test bench from the ground to a table, but I think that I fooled it anyway and the behaviour I see in the test it’s the same it has on the aircraft when it flies. I have seen the swashplate servos moving when the gps drifts, as you said. To be clear I have first seen this behaviour in flight and then reproduced on the bench with default parameters to be sure that it wasn’t caused by some changes I did. I’ll look deeper into this anyway to be sure that it knows it’s flying.
I don’t completely trust loiter yet so I use mainly position hold (to retain fast control on the aircraft, just in case).
Anyway, you agree this is not what it should do? The Target Position shouldn’t change even if the heli drifts far from it, right? It seems that there is a threshold over which, even without any input from the pilot, the positon controller changes the Target Position closer to the Actual Position: I am not sure if this threshold is linked to Position or Velocity or maybe something else…
I’ll take a look at your log tonight to see if you’re actually fooled the controller to think that it was flying. If you look at it yourself, you should see the flag in the events that says not landed. If you see that, then it thinks it’s flying.
I’ll take a look at your log tonight to see if you’re actually fooled the controller to think that it was flying. If you look at it yourself, you should see the flag in the events that says not landed. If you see that, then it thinks it’s flying.
Thanks Bill, you can see even in the screenshot I posted, it says EV: NOT_LANDED
I don’t have the flight log with me now but I will check them when I work on this again (end of the week).
I made this test on purpose to use the latest version (I am still on 4.5.1 on the heli) and standard parameters, to be sure that it wasn’t my customization doing this.
I noticed this strange behaviour because I was not happy with how much drift I had with the GPS I was using (NEO3 pro uavcan form cuav), and tried a few different options (another identical gps and a M8N from holybro) to be sure it wasn’t defective. Turns out they are all drifting more or less the same, so we started to investigate this strange TPN/TPE change.
If you look at the log you will see TVN/TVE rising up to the moment in which TPN/TPE are than changed (and moved closer to Actual Position). It seems to me that TPN/TPE change is more related to target velocity then target position, but I am not sure. There must be something somewhere that makes the position controller do this, right? A threshold on some parameters that create this sort of leash…
I am trying to do these tests multiple times with standard settings, so that when I post here I am sure that it’s something real and can be reproduced, so that I don’t waste your time.
Thanks a lot!
I spoke with @Leonardthall regarding this behavior. He said that this is expected behavior in Loiter flight mode. As you’ve pointed out in your previous posts, once the position error exceeds a certain value, the target position is dragged along with the actual position. Maybe @Leonardthall can explain why this is done in loiter. This is not done in auto flight mode.
Thanks, I was almost sure this was a feature and not a bug, given that I was able to recreate the event every time I tried. Is this documented somewhere in the wiki? What parameters influence the threshold above which the target position is dragged along with actual position, and can I tune this or disable it alltogheter? I can imagine why this was introduced, but will be nice to hear from Leonard an official explanations, and maybe if there is a way to have a position hold/loiter mode that won’t do this…
Any news about this? I can’t find anywhere about this in the traditional helicopter documentation. Is there a parameter I can change to modify this behaviour? Where do I have to look if I need to change the code? Thanks!
You shouldn’t try to disable this behaviour as it prevents extremely dangerous behavior in case of a GPS glitch. Position control should be tight enough not to trigger this behaviour outside of having extreme outside disturbances that would likely make flying unsafe anyway.
I think that GPS Glitch protection is implemented in another way as described in the documentation under EKF Failsafe: GPS Failsafe and Glitch Protection — Copter documentation
This is something different, as no gpsglitch is triggered here.
Are GPSGLITCH parameters affecting this too? It does not seem so from the logs…