| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Review Summary by QodoPosition estimator corrections separation and velocity filtering ✨ Enhancement WalkthroughsDescription• Split XY and Z position estimator corrections into separate flags - Allows independent updates when XY or Z sensor data arrives • Improved EPH/EPV degradation logic with 200ms timeout threshold - Only degrades when no sensor updates occur for >200ms • Applied PT1 filtering to velocity estimates - Reduces noise in XY and Z velocity publications • Optimized time macro for frequency-to-seconds conversionDiagram flowchart LR
A["Sensor Updates<br/>XY & Z"] --> B["Split Correction<br/>Flags"]
B --> C["Independent<br/>XY Corrections"]
B --> D["Independent<br/>Z Corrections"]
C --> E["Apply Corrections<br/>Per Axis"]
D --> E
E --> F["PT1 Filter<br/>Velocity"]
F --> G["Publish Filtered<br/>Velocity"]
H["200ms Timeout<br/>Logic"] --> I["Degrade EPH/EPV<br/>Only on Timeout"]
I --> J["Update Estimates"]
File Changes1. src/main/common/time.h ✨ Enhancement +1/-1
2. src/main/navigation/navigation_pos_estimator.c ✨ Enhancement +57/-34
3. src/main/navigation/navigation_pos_estimator_flow.c ✨ Enhancement +1/-1
View more (1) 4. src/main/navigation/navigation_pos_estimator_private.h ⚙️ Configuration changes +4/-1
|
Sorry, something went wrong.
Code Review by Qodo🐞 Bugs (2) 📘 Rule violations (2) 📎 Requirement gaps (0) 1. Float US2MS() in timeouts 📘 Rule violation ✓ Correctness Description Code Evidence Agent prompt 2. last*SensorUpdateMs uses 0 📘 Rule violation ⛯ Reliability Description Code Evidence Agent prompt 3. Velocity filter not reset 🐞 Bug ✓ Correctness Description Code Evidence Agent prompt 4. Debug velocity now inconsistent 🐞 Bug ✧ Quality Description Code Evidence Agent prompt ⓘ The new review experience is currently in Beta. Learn more |
Sorry, something went wrong.
| const bool XYSensorUpdateTimeout = US2MS(currentTimeUs) - lastXYSensorUpdateMs > 200; | ||
| ctx.newEPH = posEstimator.est.eph + ((posEstimator.est.eph <= max_eph_epv && XYSensorUpdateTimeout) ? 100.0f * ctx.dt : 0.0f); | ||
| const bool ZSensorUpdateTimeout = US2MS(currentTimeUs) - lastZSensorUpdateMs > 200; | ||
| ctx.newEPV = posEstimator.est.epv + ((posEstimator.est.epv <= max_eph_epv && ZSensorUpdateTimeout) ? 100.0f * ctx.dt : 0.0f); |
There was a problem hiding this comment.
1. Float us2ms() in timeouts 📘 Rule violation ✓ Correctness
The new sensor-update timeout checks mix float millisecond math (US2MS) with integer timeMs_t, which can lose precision and yield incorrect timeout behavior after longer uptimes. This violates the requirement to keep consistent units/types and avoid precision-losing conversions in math-heavy code.Agent Prompt
## Issue description The new XY/Z sensor timeout checks use `US2MS(currentTimeUs)` which returns a float, then subtract `timeMs_t` integer timestamps. This mixes float and integer time units and can lose precision or behave unexpectedly over long uptimes. ## Issue Context `timeMs_t` is `uint32_t`, while `US2MS()` is a float conversion macro. Timeout checks should be done using consistent integer time units. ## Fix Focus Areas - src/main/navigation/navigation_pos_estimator.c[764-767]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Sorry, something went wrong.
|
I ran this on a few copters. They ranged from very well setup, to poorly balanced due to mildly damaged props. etc For the one that is well setup and even still held position very well using the 8.x firmware. Its position accuracy is now extremely locked in on all axis's. And held a fixed altitude as good as any Lidar I've used. But my main focus has been on poorer setup copters. i.e. ones that have some sort of vibrations from a bent prop or damaged motor bearings in a crash. Or a poorly position GNSS module. But in saying that. After assessing stacks of logs from those poorly setup copters. Its very noticeable to see that a much better accelerometer xyz weight factor is required to handle those vibrations. By scaling back the amount of input the ACC adds to the position estimator in a dynamic and intelligent way. Not the way it is at present. Which is of no use at all. I can flash back to 7.0 and reduce inav_w_xyz_acc_p to a more suitable value for the vibration a given quad is producing. And its no longer jittery on XY and Z. The jitteriness I have experienced with these less than perfect mechanically tuned copters, even occurs when the HDOP is 1.1 and below. Which means the accelerometer is doing a good deal of work, which is evident by how well my well setup test copter works. |
Sorry, something went wrong.
|
After doing more flights with these newer changes that have been implemented over the last couple of months. And more recently using a broader range of copter sizes. However, unfortunately INAV software has to work with a wide range of build qualities... From the high-end, to the not so much. I know I mentioned this in the previous comment, but never heard anything back. That could either mean Breadoven is secretly working on it in the background. Or the issue is in the too hard basket for now. Even though most users never touch inav_w_xyz_acc_p before it was removed in 7.0... It certainly allowed tune-ability for someone who knew their quad was always going to produce a certain level of vibrations that could not be gotten rid of mechanically or by filters. Accelerometer noise is also over looked more than Gyro noise. Yet its the one more susceptible to these vibrations. My take on it would be something like this - Any ACC dynamic weight control logic, would need to take an average sample for a few seconds at the beginning of the flight. Then use that as a baseline for the ACC weight feed to the position estimator. And in the case of INAV's gyro filter which can be DYNAMIC. Could such a method also be applied to the accelerometer, based on throttle position. Because the sky-rocket effect that occurs in INAV altitude controlled modes, more often occurs as the throttle is increased, on noisy copters. It would seem the original ACC clipping factor should have been able to rapidly pickup ACC noise spikes and reduce the weight accordingly. And it may do that in extreme cases. But it also dampened the data far too often when it isn't required. @breadoven @sensei-hacker I would be interested to hear you views on this ? |
Sorry, something went wrong.
I was waiting to see if the recent changes caused any problems. I did test them a fixed wing the other day and all worked as expected. Hard to say if it was any better. I'll have a look at the acc related stuff next because I don't think it works well, too unpredictable if vibration becomes an issue. Can't help but think the old method is safer given it simply cuts out acc derived estimates and reverts to sensor based estimates only which may be more sluggish in response but are far less likely to cause unrealistic/unstable estimates. It would be useful to have a log that shows unstable vertical velocity so long as it includes NavAcc data so you can see exactly how the acceleration is behaving to cause problems. |
Sorry, something went wrong.
|
It sure is a balancing act between relying more heavily on Accelerometer data than GNSS for the tightest position accuracy. I feel it maybe beneficial at some point when both data sources become poor, as it has been throughout 7.1 to recently. If the estimator just gives up, when in a mode like multicopter Poshold. And falls back to Angle mode, while displaying a comprehensive warning message on the OSD. So the user knows what the fault is. I know this would be a final fall back. But I've certainly experienced times when this would have been a welcome message. The navigation system has a hard cutoff when a satellite fix is lost. So maybe also interrogate the accelerometer data to a higher degree. After all, it's the IMU that is required for the AHRS and the Wind estimator as well for airplanes. And they also have no shortage of people experiencing attitude drift with poorly balanced hardware. I know you have Vibration Level on the multi-function display. But I've never seen it appear. Likely because its based on extremes. Rather than the intermittent amplitude spikes that cause more long term grief to the estimator over the duration of the flight, than a large couple of spikes that come and go without long term effect.
|
Sorry, something went wrong.
It's commented out in the code so not used. I have it enabled in my builds but I never really worked out what the best limits are so it pops up sometimes as a warning but probably not when vibration is really an issue. I don't think the method used to calculate vibration gives reliable results, e.g. it appears reacts to normal manoeuvring G loads which doesn't make sense. |
Sorry, something went wrong.
|
@breadoven Today @sensei-hacker and I where assisting a guy on discord with an issue he had. |
Sorry, something went wrong.
|
@Jetrell The accVib spikes towards the end of that log are caused by an overflow by the looks of it. Not sure what's wrong but something is because accVib is also -ve just before and during the large spikes which shouldn't happen given it's calculated from the squares of a value calculated from the acc values. There's some sort of numerical bug somewhere. The other thing is a pretty bad contradiction between Z velocity and Z position at the end of the log with Z pos descending and Z velocity climbing at over 5 m/s. Don't know if this has been improved or not with recent changes but something needs doing to stop this because it's clearly nonsense. |
Sorry, something went wrong.
I'm thinking it likely has been improved with the work you and Sensei have been doing in this area. |
Sorry, something went wrong.
|
On checking further the numerical bug is in Blackbox. It's only using a 16 bit integer to store the raw acc values which isn't big enough when acc.dev.acc_1G is 2048. At only 16g this overflows the 16 bit BB value. Not sure why BB needs to store the raw acc values, it would be easier to just store the G values which is what most people are interested in seeing although you'd need to store them in "centi G" to maintain some accuracy. |
Sorry, something went wrong.
…mprovement Position estimator corrections improvement and estimated velocity filtering
| Back | FazBrowse Home | New Git URL |
PR splits out handling of XY and Z position estimator corrections so the corrections are updated separately when new XY or Z sensor data is available.
Estimated EPH and EPV degradation logic also changed so EPH/EPV are only degraded if no sensor updates occur for >200ms rather than always degrading them between normal sensor update intervals.
Filtering has also been applied to the velocity estimates to remove some of the noise that seems to affect velocity in particular.
HITL tested and also on a quad without issues.