-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Option to use position for fixed wing nav altitude control #10903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to use position for fixed wing nav altitude control #10903
Conversation
|
@sensei-hacker It needs testing but it's not experimental. Pretty much as it was before #9471 but with some improvements for rate control. |
|
There is an issue open which might be relevant for this one: |
|
@breadoven I flew a few flights today with one of the planes that had tuning issues using the velocity altitude controller. After enabling When entering a descending loiter and then watching it level out at I could have tuned it a bit tighter and you would never have noticed any problems. But when panning the camera back to look at the elevator. I could see slight oscillations. That's why I settled with the values I have. So it seems beneficial for this plane.. I'll be interested to hear what others think. |
|
@Jetrell You could set Good to see this works especially the new method used for rate control. Much better than the old method. |
|
I like the idea with rate control vertical speed. However, I think the default value can be improve. The new default was a bit on the aggressive side. |
|
After running some more tests with this today. And proceeding to increase the gains. There was no possibility of getting near what could be achieved with the old If I had to rate it in tuning similarity from 1 to 10.. 1) Position and 10) Velocity. I'd say it's an 8. However it has still taken the edge off those harder to tune planes. But it's not as care-free as the old position controller. But it's also more precise than it was. |
Is this related to rate control behaviour or maintaining an altitude such as during cruise or both ? If it's an issue during cruise when it's trying to maintain an altitude then the only things that are different to the old postion based control are:
If the above changes are made then the PID control will be exactly the same as before. If it still behaves differently then I'm afraid it'll be down so some other change that's come in at version 8.0.0 because as far as the PID controller is concerned inputs and the PID factors will be the same as before so it should output the same pitch control demands as previously. |
It was related to both. Yesterday I started out with P = 30, and had I and D set to the old defaults for the Position controller, 5 and 10.
Judging by how much effect D-term has on this controller. I'd say this is likely the case. Being that the tune didn't end up much different to the velocity altitude tune, |
|
As a late comer to the party. My tests show the same. The required tune for the position z changes where practically the same as that of the velocity z tune. However it appeared to calm things a little. I have not had the opportunity to test the changes made in commit 83d162c |
|
I realised I've been HITL testing this with control smoothness set to 7. So I tested again still using error for D term but with control smoothness set to 0 and it starts oscillating in pitch ... most obviously when changing altitude in Cruise. After switching to using measurement for D term instead and changing the PID D term factor back to the original value (30 to 100) the pitch oscillation is gone. Obviously this is HITL but I suspect using measurement for D term makes a difference. So I've changed the PID D term factor back to the equivalent of the old method which together with the using measurement rather than error should ensure it now behaves as before. Edit: |
So that should mean we can switch |
With |
|
It now looks more like the way it used to work with the old With the old stock tune of P = 30 -35, I = 5, D = 10... It will hold altitude in Cruise, with a 1 meter drift at most. I tried increasing the P up to 40 and D up to 50, as the old position controller could handle. It only caused small pitch oscillations. But it also didn't improve its ability to acquire and hold the altitude target any better either. So in conclusion. This addition to the fw altitude controller does the job, and is more care-free in it setup. And is plenty good enough for general use. I'll personally use |
|
Did you test this PR with |
It might have been a good thing to check this. I was out today using the last commit. Which is the same as last week. I thought it could have been a problem with profile switching between them. But when I just used the Vel z, the issue was the same with WP altitude.. But when using I've been looking over the DVR and logs for the last hour. And I can't think of any other reason this would be. So I thought I'd mention it to you, in case it there is an issue. |
|
So it appears that using measurement for D term for velocity based altitude control fixes the instability problem ? Interesting that it makes such a difference. I assume the WP issue is related to the actual altitude lagging the desired altitude when flying between waypoints with different altitude settings ? If you fly between waypoints with the same altitude setting does it hold altitude OK ? I think the lagging issue is likely caused by I'm thinking the best thing would be to go with this PR as it is other than a change to increase the default FF setting. If it turns out that the instability issue using velocity for altitude control is fixed using measurement for the D term then the position option can simply be removed in a later release if it is considered redundant. As a side note the only nav related control left using error for D term is roll control for heading adjustment. Makes you wonder if that might work better using measurement given I noticed you get oscillations with WP course tracking and control smoothness set to 0 (HITL testing). Might be worth a quick test. |
|
Just a final word on this, after being out flying today. Using the @breadoven Thanks for your perseverance with this. I was rather impressed with how responsive it can now be tune without side effects, on these higher level aerobatic planes. |
|
It does make you wonder why you'd want to use error for the D term when it just seems to cause problems ... or in this case makes the PID loop fundamentally unstable. Still need to test the roll control using measurement rather than error, see if it makes any difference. I thought the following was interesting: |
|
@breadoven Sorry it took so long to conduct the tests. We found the velocity controller was more responsive than the position controller. It had no quames with aggressively maxing out The use of the altitude position controller When tuning either altitude controller. There is a balance required, between |
Adds an option to use position based nav altitude control on fixed wing instead of velocity based control which doesn't appear to work reliably on some plane types. Option enabled with new setting
nav_fw_alt_use_position(OFF by default).nav_fw_alt_control_responsestill works with the position based control in the same way as for velocity based control.Only tested on HITL so far where it seems to work well. The new method of controlling altitude rate appears to be a big improvement on the old position based altitude control method with rates being held more accurately with limited pitching oscillations compared to previously. PID values may need further fine tuning.