Repository navigation
Add CLI setting to adjust Programming Framework update rate - #12276
KyokushinPL wants to merge 4 commits into
Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoAdd CLI setting to adjust Programming Framework update rate
AI Description
Merge Risk
|
Code Review by Qodo
1. Upgraded boards on auto-transition builds read a bogus task rate
|
|
Have you tried if 100hz is ok even for F4? If there will be many rules in programming framework? |
No, i tested on TBS Lucid Wing Mini AIO, and it does handle that easily. |
|
I use the IPF to supplement software testing, and improve safety in the testing phase. I often have all 63 lines full. @KyokushinPL I can understand your reason for adding this. There are certain functions that could do with a higher update rate.. However I think most functions don't require a faster update... In fact it would be wasting processor time. By updating the same data over and over. I thought it might be more beneficial to add a scheduler of types to the IPF. So the user can select which functions they wish to run at a higher update rate. While leaving the rest at 10Hz ? |
|
I appreciate your work on this. I wonder about certain operations that shouldn't be done 100 times per second. Increasing the rate is a possibility. I wonder about something, though. Ps also note that an option make servo movement smoother when you DO need to use IPF to control it is you don't "have* to set the rate to max. If you plan to move the servo about 120° in one second, you can set the rate for that servo to about that, rather than moving double that speed, stopping, going really fast, stopping. |
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
I will describe my exact use case. I am using the DJI Goggles 3, which provide head-tracking data (pitch, yaw, and roll) on RC channels 14, 15, and 16 through SBUS while using DJI RC FPV 3 controller. I am using a pan servo to control the yaw axis of my aircraft's camera. Normally, I use the RC yaw axis for this purpose, but since we now have head-tracking data, I would like to control it with my head. I can assign RC channel 15 directly to the servo, and that works fine. However, the DJI Goggles do not provide any kind of "re-center" command. The zero position is established only when the goggles are powered on, so I cannot simply power-cycle them during flight. I am using the Programming tab to implement a simple re-centering function. When a button is pressed, I capture the current offset, normalize it, and write the calculated value to an unused channel, for example RC channel 20. I can also store this value in a GVAR. I then use the calculated RC channel 20 as the input for the servo, allowing the servo to move while also providing a re-centering capability. The problem is that the calculation for RC channel 20 is performed at a frequency of 10 Hz. As a result, when I move my head to control the servo, the servo updates only once every 100 ms. Instead of moving smoothly, it moves in noticeable discrete steps, unlike when it is driven directly from RC channel 15 (which I cannot use because it does not support re-centering). When I increase the calculation rate from 10 Hz to 60 Hz, head movements are processed six times more frequently. This eliminates the noticeable stepping of the servo movement, both to the human eye and in recordings (especially since most 100 FPS recordings are ultimately rendered at 60 FPS). I cant use any gimbal settings here, because its not related to gimball, and there is also no 're-center' option in inav, because any "new-zero" operations are done on external headtrackers, unfortunately DJI Goggles 3 have no such options, and "new-zero / re-center" need to be performed on INAV level. Its not just about centering of the gimball, its about recalculating input data for "new zero point" for headtracker, which in my case is single-axis servo. I know the 10Hz is not without a reason, however it was set initially few years ago for much slower controllers. Feel free to take a look to my CLI if you're interested in re-centering logic. INAV_10.0.0_cli_BLACKJACK_20261203_200900.txt |
|
Okay, assuming I understood you correctly, you can do that in the mixer without any changes to the code. And without the programming framework or any gvar, if you want. I think in the end you're wanting to mix the values from two RC channels and send them to a servo. For that, we have the servo mixer. It sounds like calculation is only needed for re-calibrating the center point? And re-calibrating the new center 10 times per second would be much faster than needed. ##Option 1 ##Option 2 |
Re-center is collecting the offset only, but recalculation need to happen alltime. I also cant use GVAR, because GVAR is also recalculated at 10Hz. Its not about 'centering' the servo to mid position only, its about getting 'a new zero' point - a recalibration. For example, you're turning on the goggles, walking to throw a plane upfront to the wind, and then you're going back to you're chair, and then you're 'zero' point will be in a different rotation point that it was when you turned on the goggles, and you need to change the zero offset, and then >any< move of servo need to be related to value recalculated to new offset. |
Which happens a lot less than ten times per second.
And that's what the servo mixer does, 2000 times per second. Try it out -- put the head tracker (channel 15) and the calibration channel in the mixer and see if it doesn't do exactly what you want. I believe you're wanting to add two values and send the result to a servo output. That's exactly what the servo mixer is for.
You don't NEED to, but you absolutely COULD use a gvar to hold the calibration offset because the calibration doesn't change more than 10 times per second. Remember, the mixer exists. The mixer is what controls the servo. The mixer is what mixes the current head tracker value with the current calibration offset. (Hence the name Mixer, it's for mixing two or more values together.) |
|
It don’t want work like that, because if source for servo in the mixer is RC channel, then operating at range 1000-2000, and when source is from gvar it’s -500 - 500. (In case of doing calculation once).If calculation is at any rate, then servo start work in this rate (that’s why I am bumping up the calculation rate). I tried similar on the beginning.Wysłane z iPhone'aWiadomość napisana przez Sensei ***@***.***> w dniu 5 gru 2026, o godz. 07:39:sensei-hacker left a comment (iNavFlight/inav#12276)
Image: image (view on web)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
I think possibly you're missing the point. Not understanding the purpose of the mixer. It seems like you keep complaining about the IPF isn't a good mixer, and not quite getting that the Mixer is a good mixer. The proper tool for mixing is the mixer -- not IPF.
The mixer runs as fast as any servos can physically update, at 400 Hz. That has nothing to do with how often you adjust the calibration channel. I would again encourage you to actually try using the mixer to do the mixing, as shown in my screenshot. It seems like you have IPF stuck in your head and maybe can't put that aside and consider what the Mixer exists for. Note there are no gvars and no IPF in my screenshot. So as long as you keep talking about gvars and IPF you're ignoring what I'm telling you, staying stuck on your first idea that did not work. You do not need to create your own mixer in IPF. INAV already has a mixer. You do not need IPF to mix. For mixing, what you need is the mixer. If you set your mixer the way I showed you, I think you will discover that the mixer is good at mixing. |
I can do the seamless mixing as you wrote (and mixing will be work OK at those 10Hz), but i cant add there a logic that support wrap and normalization. Offset will work till CH15 (headtracking input) reach the border values 1000 and 2000. For example, if i 're-center' close to 2000, lets say at 1900, and move the goggles, then mixer will not provide a logic that will change the offset. Wrap and normalization need to be programmed live :/ and change of refresh rate is needed. |

Adds a new CLI setting to control the update rate of the Programming Framework task (Logic Conditions, GVARs, RC channel overrides, etc.).
The previous hardcoded 10 Hz rate is too low for use cases that require smoother response, such as:
RC channel overrides
In these scenarios the low update rate causes visible stepping or lag. Making the rate configurable allows users to raise it (up to 100 Hz) on capable flight controllers when smoother behavior is needed.