-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Added PerformanceModel for fixed wing #22091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice.
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.h
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/performance_model_params.c
Outdated
Show resolved
Hide resolved
1271e45
to
98120d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still some tests failing - but otherwise looking ok to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the separation into the dedicated performance model, makes it more readable. Let's give it a bit more testing, especially let's try to fine tune a vehicle flying with different weights and in different air densities.
Also, please adapt the PR description, the current one is missing a lot of things (eg the changelog only speaks about the new density param, but this Pr does much more).
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
98120d3
to
3512d37
Compare
src/modules/fw_pos_control/performance_model/performance_model_params.c
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
src/modules/fw_pos_control/performance_model/PerformanceModel.cpp
Outdated
Show resolved
Hide resolved
b1bab9a
to
0ef607b
Compare
282f3a7
to
a19d225
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RomanBapst Looking pretty nice! I have no functional changes, only some last documentation and sanity checks that would be good to put in.. then I'd be good to merge.
Also .. we will definitely need to get docs up on this soon. As there are implications here on how people tune their aircraft model. I was thinking it may even make sense to make a special section under the fixed-wing umbrella for "performance model" to explain what's happening.
b898d85
to
36267f6
Compare
@RomanBapst thanks for all the revisions. looks like it will need another rebase before we get it in. But otherwise - how are the docs coming along for this? do you need support? main thing we need to be on top of is making sure that those using these new params aren't doing so blindly - i.e. outlining what it takes to use the param properly, and discourage otherwise @dagar made a comment on in future if we can separate hobbiest level "i just want to plug in and let this thing fly" param sets from "i actually have a product and know what im doing for this extra performance"). happy to chat more on this - latter part here we can think about post this PR |
@tstastny I started with documentation here. PX4/PX4-user_guide#2842 The main thing I am missing is to explain how to cope with initial tuning not done close to sea level conditions. This is actually not just a problem related to this PR but it has always been a problem. Just need a nice way for the user to either back calculate or tell them to do the tuning near sea level. |
By default these advanced params are all disabled, so this PR should not add any additional complexity for the user. Advanced user who really care can read the docs and set the params accordingly. At least that's the idea. |
right - we've been ignoring it for a while. let's take this discussion onto your user-guide pr then to figure out how we provide an easy way for people to back calculate. |
@RomanBapst can you post the flight test results you have here? Then if you're happy with them - just need a rebase and we should merge this one. I'll start going through the user guide pr |
@tstastny @sfuhrer After looking at the test flights conducted at different altitudes (3000m and 400m) I noticed that the trim throttle compensation is completely off. I think there might be 2 reasons:
The right side of the equation is the drag and we assume it to be constant if we fly at constant equivalent airspeed! We can see that the thrust is a function of the square root of air density (which is how we currently compensate). But there is also a non-trivial relationship with rpm which needs to be taken into account, which could explain why only compensating for air density overestimates the trim throttle. Ok, now let's get to actual data. I am comparing two flights from the same vehicle with almost the same weight in the same configuration flown at different altitudes (500m vs 3000m). The vehicle at 3000m is about 200g heavier and flying at a slightly higher indicated airspeed. Both would suggest that it's trim throttle is slightly higher than it should be. Flight at 500m
Flight at 3000m
The trim throttle ratio is thus 1.08 and the square root of the air density ratio is 1.14. |
9d42854
to
02b5578
Compare
And then the only effect we would need to keep modelling is that the true airspeed (TAS) is higher when flying higher, for which then the we should change getTrimThrottleForAirspeed() to not take the CAS as input but TAS. |
I assume you are saying that because air density appears linearly in both equations? I think the problem is then that the right side is not constant anymore (it's then drag scaled by air density) and then you can't make the argument that the left side should be constant as well. Does that make sense? |
I think we are speaking of the same thing. The CAS to TAS relation is the one that currently gives the square root air density relation. I think that part is correct, just that we also have the rpm square relation which could basically nullify or at least reduce this effect. |
If it all boils down to have an accurate airspeed (TAS) to throttle mapping, then I would extend the current functionality around that, where we approximate it through a linear slope above and below trim airspeed. That I have found to be the most accurate way of doing it, and it only requires to set two airspeed/throttle pairs (see #21345). We now would need to figure out how to do it for TAS. |
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
Co-authored-by: Thomas Stastny <[email protected]>
- this will help users find the calibrated trim throttle value when not flying at sea level in non-standard atmosphere Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
ef62577
to
0aa3163
Compare
@tstastny I removed the weight scale for trim airspeed and added logging for the calibrated throttle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RomanBapst From what I understand from your comments you removed the weight-->trim throttle scaling. But we want to keep the density-->trim throttle scaling? Wasn't it that part that caused the issues in the high altitude flight test we did?
As a side note: please don't do rabases of large PRs when they are in the middle of the reviewing phase, I now have to go through the whole thing again to understand what has changed since I reviewed on Monday.
This is awesome! Thanks for putting all this work in :) !! |
Signed-off-by: RomanBapst <[email protected]>
@ryanjAA Are you planning to go fly near the service ceiling of your vehicle in the near future? :-) |
Signed-off-by: RomanBapst <[email protected]>
Signed-off-by: RomanBapst <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great - if there are no more concerns for first iteration .. let's get it in? @sfuhrer @RomanBapst
* created a Performance Model for fixed wing vehicle - added compensation for maximum climbrate, minimum sinkrate, minimum airspeed and trim airspeed based on weight ratio and air density - added atmosphere lib to standard atmosphere calculations --------- Signed-off-by: RomanBapst <[email protected]> Co-authored-by: Thomas Stastny <[email protected]>
Haha. I just saw this a year late... yes, going to fly at 3300m agl and 4500m. The concern is cruise speed needs to be increased (which is fine) because min speed at those altitude is essentially close to cruise. Wouldn't it make sense to also compensate for that here as well? As a percentage makes sense if you don't know baseline since that's universal. |
Solved Problem
Replaces #22049 and #22045
Changelog Entry
For release notes:
Test coverage
Followup PRs