Fixed wing Auto Speed Mode - #11595
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Test firmware build ready — commit Download firmware for PR #11595 243 targets built. Find your board's
|
|
@breadoven Firstly I want to start by saying how much we all appreciate your work here on INAV. ❤️ When I setup the fixedwing auto speed mode with the IPF. I also tried a simplified version as you have here. But found it was just too lacking in many area's of safety of operation, and efficiency. Example:
I no this was long winded. And I'm not trying to make more work for you. But I thought it might be helpful for you to know what I also tried. So the feature can be made safer and more user friendly. |
|
@Jetrell I probably should have said this is a work in progress. The initial build was just for basic testing in light wind but obviously is limited otherwise. I've made some changes in the latest commits: Added pitot Added stall protection when using ground speed Added low ground speed protection Added a Things that need further work:
I'm not sure what you mean here. The normal OSD throttle display shows the Auto Speed throttle setting the same as any other auto throttle mode. The only OSD element that's been added for this PR displays the selected speed, |
I totally agree. The wind can swing in as little as a couple of hundred meters. So 15mins seems extreme. I figured it was just set this high, so virtual wind/airspeed wouldn't become invalid and cause issues with something that was relying on it.
Max throttle is more beneficial for power efficiency. But limiting Min throttle to a value higher than zero. Has two benefits that I found.
Sorry, I could have worded that better. |
There is filtering on the throttle output that damps the rate of change so maybe it's not an issue in this case.
This PR honours motor stop where applicable, Acro, Manual etc, but it could be changed to prevent that and have Idle as the minimum allowed always. I left motor stop behaviour as is to avoid surprises, e.g. in Manual, although that could be fixed by only allowing activation when in flight.
This shows the Auto throttle OSD display whenever Auto Speed is active, so it also works for non Nav modes. |
|
The maintenance-9.x branch was damage a week back, and was retired. It would seem like this may have been built upon it. The tuning tab won't load. And when I was going to set it up on a plane. I could only find Auto Speed in the modes. But I couldn't find an activation setting or channel selection to choose between 3DSpeed, and Airspeed, while in flight. |
It was built on the maintenance 10.x branch so I don't know if that also has a problem related to 9.x. @sensei-hacker ? Edit: I just checked and I also can't get the Tuning tab to work in Configurator with the changes for this PR or the 9.0.2 version so there must be something in the firmware that's broken.
At the moment there is only the Auto Speed mode. As it is this PR will use airspeed if a pitot is active, otherwise it uses ground speed. There is no means of swapping between airspeed and ground speed and I don't think it makes sense to do this by using up a mode. Would be better to use programming probably which should be easy enough to add if not already possible, I haven't checked. |
maintenance-10.x is not affected by the same issue. The problem was that maintenance-10.x commits got leaked into maintenance-9.x.(which I then reverted, meaning there are commits add and removing the changes). |
|
It's probably an MSP issue related to the new PID this PR adds. Need to check it further. |
Using the IPF would be okay. |
IMHO people who want motor stop off can (and probably do) turn it off. Those who want it on can turn it on. I don't see any reason for this mode to override the pilot's specific instructions. |
|
It's interesting to me that some RC folks still say this "a propeller that is spinning at lower speeds creates more drag, than a propeller that has stopped spinning". NACA, the predecessor of NASA, tested this properly in the 1930s -1940s and got solid data. (The 1930s and 1940s saw a great need for advancing research on airplane performance, for -- reasons). See: NACA ARR No. L5A13a / Walter A. Bartlett Jr. (1945): "Wind-Tunnel Tests of a Dual-Rotating Propeller Having One Component Locked or Windmilling". Quoting the NACA technical memorandum "Improving the Performance of Multi-engined Airplanes by Means of Idling Propellers: The reasoning for thinking otherwise may be either using the reference frame of a person standing on the ground rather than the airplane's frame of reference, or forgetting that fighting the torque takes energy? Forgetting that you're using up energy fighting the spin (that energy coming from aileron drag fighting the torque). I've seen that in "testing" where they have the apparatus anchored to a table and forget to measure the torque applied to the table. From that testing, we can conclude that stopping the motor is better -- but only if the plane is anchored to a table while flying. Looking at it from the relevant frame of reference, that of the aircraft, perhaps we can see that a prop that is freewheeling is free-wheeling WITH the airflow? It's moving right along with the air, minus motor friction. Therefore isn't a prop "stopped" from the frame of reference of someone on the ground one that is moving AGAINST the airflow. Probably nobody thinks that having the prop go BACKWARDS against the airflow would make it more efficient, but from the point of view of the airflow, a braked prop is moving backwards relative to the flow - it's not moving with the airflow. That seems to be what the professional researchers have found? Or perhaps one could look at this way: Is applying a little bit of backwards force to make the propeller not go with the airflow but instead match the person on the ground exactly the same thing as applying a lot of backwards force to make it spin backwards relative to the guy on the ground? Does the research over the last 90 years by NACA, NASA, DLR and others indicate it's doing precisely the same thing, just in different amounts? |
It all depends on the ESC setting state. But if Active Freewheeling (synchronous rectification) is applied. The motor acts as a regenerative drag brake.. Not stopping the motor, but impeding the airflow through the propeller disc . |
|
The main reason for keeping the motor at idle is simply because a mode like this may demand max throttle regardless of throttle position (or some other control being used for speed demand for that matter). If you allow motor stop the motor will go from stop to max instantaneously as soon as the throttle is raised slightly which isn't desirable and I don't think normally happens in any other mode. I never liked the motor behaviour before Having said that you could add something to limit throttle acceleration if the motor is stopped so not an issue to fix if need be and I guess it also depends on whether or not the ESC has soft start. And the Tuning tab in Configurator should be working correctly now with the PID settings for this added. |
Did it work for you ? I tested the last commit with the Configurator build for this PR, and also with the RC1 release. And the Tuning tab still would not open for me.
Yeah true. And some ESC software's (Oxbot) have trouble with this instantaneous smash of the throttle. |
I think you'll need to use the version from actions for the last commit: https://github.com/iNavFlight/inav-configurator/actions/runs/27044501551 |
Nope, it makes no difference what the tailwind is, the throttle dictates the airspeed regardless. Once a plane is off the ground the only thing that matters is its speed relative to the airmass around it and that speed is essentially dictated by throttle. Ground references only matter if you're doing something that's related to the ground such as using ground speed or a ground position otherwise things such as head/tail winds are irrelevant to how a plane behaves.
A sailplane doesn't stall because, in the absence of lifting air, it's always descending to maintain airspeed. In fact if it tried to fly level and maintain altitude it would stall. And it doesn't matter if it's flying downwind, upwind or crosswind, all those terms are irrelevant to a plane flying in an airmass moving relative to the ground, the only thing that matters is the plane's speed relative to the airmass. Anyway I'll have a look at doing something using airspeed to aid the ground speed mode stalling problem that would avoid use of pitch2thr. If you have airspeed then I guess why not use it. But then again if you have airspeed and it's more reliable than ground speed, why use ground speed in the first place other than in certain situations where it might be beneficial such as flying into wind possibly. |
|
Latest commit changes ground speed behaviour to integrate it with airspeed if available. Changes:
If either of the above airspeed boost functions are active when using the ground speed source the OSD speed demand setting will display an alternating A and G on a 1 s cycle to indicate that ground speed is being overridden by airspeed. If no airspeed is available ground speed reverts to using The throttle filter f_cut has also been reduced to 0.25 to help smooth out throttle changes some more. Probably needs to be a setting ... to do. |
|
Thanks for persevering. Loops in 3Dspeed are also much smoother now. With the setpoint being tracked noticeably better than it was previously with pitch2thr getting in the way. The change you made to throttle filter f_cut could have also helped with this. I also tested it with the Pitot disabled, flying downwind... I left I tested it in RTH, Loiter, Acro, Manual, Cruise, Coursehold, AngleHold and WP. It work fine in them all. Now that pitch2thr is out of the way. The P and I could be tuned tighter, to reach and hold the speed setpoint even better. I would also recommend increasing If there was one last thing that I would still recommend to make this feature complete and a bit safer. It would be a bailout, by pulling the throttle stick low. |
|
Throttle smoothing setting added and also throttle stick emergency stop. Throttle smoothing allows f_cut to be adjusted from 1 to 0.1 which should be adequate. 1 will offer little smoothing and 0.1 will probably be too much with poor throttle response. Throttle stop only works if not using the throttle stick for speed demand and it doesn't latch just switches the mode off at throttle low. Also removed the ability to use this with Manual mode on after thought. Manual should be purely manual ... no auto functions allowed. |
I was thinking about this.. Not having it latch OFF could be a problem if auto speed mode is accidentally left active at a lower target speed, when making a landing approach. And the user pulls the throttle low to glide, which shuts it OFF, then they raise the throttle again because the plane fell a bit short of the landing zone.. Wouldn't this cause auto speed mode to become active again under less than ideal conditions ? And it also takes away this emergency exit safety feature for what ever percentage of users who have a spare RC channel, and prefer to place the speed target setting on that channel. EDIT: |
It's ultimately up to the user to decide how to use the modes available. I wouldn't use Auto speed when landing manually other than when some distance from hitting the ground.
I guess the mode would simply shut off when it switched out of FW profile although I haven't checked exactly how this would affect things. Although again ... would it make sense to use this mode when switching VTOL modes ? |
It wasn't so much about landing with it deliberately on, but by accident. Which it isn't too hard to do. I've almost done it a couple of times with this PR, because the OSD activation element doesn't stand out anymore than any other OSD element.
With greater VTOL automated mission support being added to 10.0 in this PR #11553. |
|
A friend and I gave this some use the other day. It worked well for us in the most part. |
Yes I noticed the D term doesn't do much but this is the same for other FW Nav PID loops also. It would be useful if you could provide your P and I terms to tune these in better taking into account the numbers @Jetrell provided above and those from some actual testing I managed to do myself (not HITL stuff).
Well this can always be changed if using logic conditions is considered too onerous. Adding another mode to cover this is a simple thing to do if need be. There will be something added to the Wiki mode description describing how to use the logic condition which once set up just behaves as a dedicated mode does although I agree it's not as convenient. |
I understand your reason for using the IPF. But I reckon another mode would make selection easier for most people. We settled at When flying, talking back and forth. We noticed how different our auto speed throttle values were, when holding the same speed target. Her airplane has a lower drag coefficient than mine. Something else we uncounted, as was raised in other comments. Is |
|
is it enought stable to test it on aircraft? |
Should be fine although you may want to change the PIDs in accordance with the comments above, i.e. increase P a little and I a lot (20 of so). Edit: I changed the PIDs so the defaults should now be inline with the comments above. The I term default of 10 is the equivalent of 20 as mentioned above because the scaling factor for I has been halved. So default of 10 is the right value to use as it is. |
That's important to keep in mind. TURN from a headwind into what is now a tailwind and we'll quickly discover inertia. When there is a sudden GUST of wind, Newton's first law is in full effect and our relative airspeed immediately drops or increases for a few seconds, until our motor overcomes inertia. So that's something to keep in mind when setting minimum throttle. It should be high enough to have margin for changes in relative wind over a few seconds. |
This is why I recommended Most users will likely use the Airspeed target for increased flight efficiency. However I more often use the 3Dspeed target, for WP missions and general flight. Because a ground based speed reference is far more useful when tracking ground based references. Or even for the speed reference between two aircraft, when flying together. I have flown with this and the IPF version many hundreds of times, over the last year. In winds up to 40km/h. |
A plane has no concept of head and tail wind though, they are ground reference terms only, so it makes no difference which way you're turning once in flight. Turning itself affects airspeed because of drag changes but this has nothing to do with general wind direction. Gusts obviously have an affect but that's a different issue. The only time wind speed and direction becomes relevant is when you're flying close enough to the ground for the topography to affect the wind but that's really no different to gusting so still a different issue. |
|
I tested auto speed today. I'm happy how it works. Tested in strong wind, 8 - 9m/s, guts up to 13m/s https://youtu.be/ClvGF0pV3Sw?si=RAIhrPtX7PaOMmhB&t=93 I use dedicated pitot tupe from flyingrc. BTW: this PR is not posible use with PR, #11553 , there is the conflight. |
|
Min speed default increased to 14m/s. This is good to merge now. Don't know why docs update is failing given settings.md was updated after setting change. @sensei-hacker ? |
bd8b9ad
into
iNavFlight:maintenance-10.x
|
@breadoven I've been using this feature continually with no issues. I have a request. Would you be willing to add the 3D speed based target to the mission planner? I figure that the When I've run long missions, I thought it would be useful to increase the ground speed, when there is a greater distance between certain waypoints. Then slow the ground speed down to a more conservative value when approaching the POI. One could raise the case for this entry to also use an air speed based target. Although I don't think that would have any benefit due to waypoints being ground based markers. With the main advantage of this entry being to allow the plane to make it to the next waypoint in a shorter period of time. |
Shouldn't be difficult to do. At the moment the WP speed settings are generally available but only applied for Multirotor use. It should be easy enough to apply them to fixed wing speed control as well. I'll have a look at it. |
Adds Auto Speed mode for fixed wing similar to #10928.
Operation is pretty simple. It is enabled as an aux mode so can be activated in the usual way. Minimum and maximum allowed speeds are set using 2 settings with a range of 5 to 50 m/s, defaults of 11m/s and 22m/s respectively. The desired speed is set between these limits using a control such as the throttle stick (default) which acts as a speed controller. The control used can be selected with a setting that defines the channel used by the control. Speeds are either Pitot airspeed or 3D GPS based (so a valid velocity estimated is required) defaulting to Pitot airspeed if installed. If airspeed isn't required it can be disabled via a new logic condition that has been added.
An OSD element has been added which displays the current set speed, this is only visible when Auto speed mode is active. The OSD element also indicates which speed source is being used, Ground or Airspeed, and whether or not Auto speed is active, displaying "OFF" if the mode is selected but not active.
Throttle is automatically controlled using PID control with P, I and D inputs with filtering to damp out rapid throttle changes. In Nav modes the normal fixed wing pitch2throttle control is bypassed when using a Pitot. Minimum ground speed throttle override is still active for Pitot and ground speed based control.
There is no maximum throttle limit set at the moment. Minimum throttle is dynamically limited in ground speed mode based on cruise throttle + pitch2throttle settings, but Pitot speed mode is always limited to Idle only. Motor stop is disabled when using Auto speed regardless of other Nav settings. In light of this, for safety reasons, Auto speed mode is included in the Nav arming blocker so must be disabled before arming and it also won't activate until the plane is detected in flight.
The mode can be activated in all cases except during during Failsafe and Emergency Landing and certain phases of Nav modes where it's not sensible to use it. So it can be used in Manual and Acro as well as navigation modes.
Currently there is no way to rapidly shut off the mode other than via the aux activation. This may need to be looked further if it's considered a problem together with other changes to improve functionality such as dealing with strong head winds etc.
HITL tested only at the moment where it works well with the default PID tune. Throttle control is smooth and responsive. Behaviour in strong wind works as expected with minimum throttle protection preventing stall when flying down wind using ground speed as the reference.
Configurator support iNavFlight/inav-configurator#2641.
Airspeed override logic condition example:
