-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use course over ground as the default for fixed wing navigation "heading" #8529
Conversation
Is the reflash rate and latency enough for navigation controllers? |
Updated to add a specific course over ground position estimator variable. This uses GPS CoG directly if the GPS update rate is at least 5Hz otherwise it calculates course over ground based on change in X and Y positions between updates. This tracks GPS CoG very consistently. Odd thing noticed from testing is the GPS update rate is shown as 10Hz in the configurator GPS tab (U/blox7 used) but debugging shows message update times generally slightly longer than 200ms, i.e. < 5 Hz. EDIT: Ah, 5Hz update rate is set by HITL ... forgot about that. |
I tested using the HITL sim with wind and turbulence and it tracks accurately, course hold is very steady. Needs flight testing to be sure though. Calculating course over ground just based on X, Y position change between updates is very accurate, better than I was expecting (this is using the GPS task update rate of 50 Hz). So this method can be used instead if the GPS update rate is too low. |
I also did HITL tests just now. Looks good to me so far. No flight tests currently as weather just does not allow test flying. 6.0 FP1, Compass set to NONE. Flies like compass enabled as expected. |
got the BB log. let me know if interested, I'll upload it somewhere else. |
WP tracking accuracy doesn't have any affect on Cruise mode or normal RTH only WP mode and RTH Trackback. I'm guessing the curved Cruise track you're seeing is caused by the new AHRS affecting the heading due to wind compensation. I've noticed the wind estimator struggles when flying straight with the predicted wind drifting consistently which would account for the consistent drift in the Cruise track. Not sure why it seems to reset at regular intervals though, looks like some sort of set point has been triggered. Turning off In fact this is the reason for this PR. Fixed wing navigation really needs to use course over ground to track consistently. Trying to use true heading with wind compensation that is sluggish to respond to actual wind changes or which drifts anyway is going to cause the ground course to drift also. |
@wilco1967 can you please open a new issue and yes please also upload the blackbox logs there as a zip. |
I have had a look at the position estimator, And I feel like the ground course from the position estimator might be better if the noise level in the accelerometer is low. And the actual position control in multi-rotor also uses the position estimator data. |
Do you mean in the case the GPS update rate is < 5 Hz so ground course is calculated from position change increments ?
Right now multi-rotor wouldn't use ground course only fixed wing. Are you suggesting using it for MR also ? |
I mean we can always use data from the position estimator regardless GPS update rate or to increase the threshold for like 20 Hz
As other part of navigation controllers uses the data from the position estimator for good reason, I suggest the ground course estimation also use data from the position estimator. Data from the position estimator fuses accelerometer ,gyro ,gps velocity and gps position And, instead of increments in posEstimator.est.pos.x why not using posEstimator.est.vel . |
My reasoning in regards to the update rate is simply that ground course is only being used for fixed wing navigation and therefore doesn't require a particularly high update rate due to the inherent relatively slow heading change response expected of a fixed wing. 10Hz should be fine with 5Hz being a guesstimated minimum limit. Given that any recent GPS will work at 10Hz it seems sensible to just use the output from the GPS directly rather than have INAV process at a higher rate when it doesn't seem to offer any obvious benefit. I'm guessing that > 90% of INAV users install a GPS that will run at 10Hz. This might be different if you wanted to use ground course for Multi Rotor but that isn't the point of this PR. I think ground course perhaps would be useful for MR navigation also but that would have to be done separately because the affect isn't as obvious as it is for a fixed wing. Why do you think a higher update rate is required ? Agree about posEstimator.est.vel, I'll update to use it instead. |
Would it be worth setting the default protocol to UBLOX7? I would imagine that pretty much all modules used would support that. |
I think a higher update rate/sensor fusion is required in fixed-wing navigation. If the GPS data is enough for navigation controllers, why FW navigation controllers use the data from position estimator? perhaps position estimator can achieve better overall performance? Position estimator data for gound-course estimation might be beneficial in agile configurations, poor GPS signal, soft serial GPS. Also eliminating potential small oscillations in the internal state of navigation controllers. I know the focus of this pr is FW, but I think MR and FW should use as same code as possible. |
I think the position estimator update rates are probably more related to multi rotor use rather than fixed wing. And even if you have a fast agile fixed wing it's unlikely to be using that agility and speed flying in Nav modes. Also ground course is only used by the Nav functions which won't work if the positional accuracy is no longer trusted so problems with accuracy in regard to ground course don't seem relevant. I don't have a problem using ground course calculated from positional change only, it tracks GPS CoG smoothly. Just thought INAV could save on a morsel of number crunching by letting the GPS do it instead. Having said that this could be useful for multi rotor so perhaps it's easiest to just opt for a higher update rate ... I'll change this accordingly. Suggest setting the update rate at 20 Hz for now since it'll still only be used for fixed wing as it stands. |
Do you get a warning if the GPS doesn't support UBLOX7 ? |
@breadoven I never saw a warning but I have at least one GPS that does not support UBLOX7 but UBLOX and it seems like INAV does automatically follow back to UBLOX. This GPS (an Old M6N with a fake M7N firmware on it) then runs just at 5Hz. |
@breadoven BTW the position estimator has weights between different sensor data, But the weight will not be dynamically adjusted by gps eph or epv. if we can implement a kind of linear Kalman filter approach in the position estimator, we can depend on the position estimator solely. |
@shota3527 I think this is fine to merge as is. I can't say I've ever really noticed any appreciable degradation in GPS positional accuracy caused by manoeuvring, certainly nothing that would have any noticeable affect on fixed wing navigation control. Looking at any recent log you typically have 12+ satellites fixed for the duration of a flight. Also using log positional data to calculate ground course and comparing it to GPS CoG shows the 2 values track each other precisely so I don't think there's any really issue here. Even if the positional accuracy did degrade the worst that might happen is a bit of heading drift but if it was ever that bad the navigation mode would shut off anyway. However, feel free to improve this if you think it will provide a tangible benefit. |
Great. I will compile a master and as soon as I can fly again I will do someWP Mission tests with Compass enabled and the Path tracking updates in place as well. |
Changes fixed wing navigation "heading" to use course over ground rather than raw IMU heading. Ground course is considered a better direction parameter to use in the case of a fixed wing given the navigation "heading" parameter
posControl.actualState.yaw
represents the direction of travel over the ground rather than the actual aircraft heading.Change won't in fact make much difference unless a compass is used in which case it should prevent navigation problems in windy conditions where the difference between GPS CoG and IMU heading becomes significant.
Related to #8519.