inav icon indicating copy to clipboard operation
inav copied to clipboard

"Heading Hold" not working for flying wings?

Open Schalonsus opened this issue 9 years ago • 27 comments

Have two planes where i have "Heading Lock" active with "Angle" and "Alt Hold" but it wont hold the heading...

Schalonsus avatar Mar 15 '17 21:03 Schalonsus

I'm going to remove heading lock and change MAG mode to work on compass-less airplanes.

digitalentity avatar Mar 16 '17 01:03 digitalentity

Good to hear. Can it be that enabling heading lock atm makes stabilization worse or does it have no effect at all?

Schalonsus avatar Mar 16 '17 09:03 Schalonsus

@digitalentity , what about a 'cruise' mode with 'true GPS' heading? I guess we talked on this some time ago. Could be done? (for fpv it would be a nice feature).

sppnk avatar Mar 16 '17 09:03 sppnk

Cruise, Alt + Heading locks is a better name for aeroplanes, I agree

Redshifft avatar Mar 16 '17 10:03 Redshifft

I'm going to remove heading lock and change MAG mode to work on compass-less airplanes.

It would be nice to have multiple mode options like heading hold relative to north or track hold. A more sophisticated feature could be to let the plane fly a straight track in the direction of heading at the time of activation. In other words: point the plane at e.g. a landmark, activate the feature/mode and it will undertake the necessary corrections to possibly fly there on a straight path.

course

Dronek avatar Mar 16 '17 13:03 Dronek

What Dronek suggests could be done estimating a waypoint (whe know speed and heading) and fly towards it, and re estimating a new waypoint once it has been reached. Or perhaps estimating a waypoint as far as possible to be sure that the plane wont reach it.

raul-ortega avatar Mar 19 '17 22:03 raul-ortega

What Dronek suggests could be done estimating a waypoint (whe know speed and heading) and fly towards it, and re estimating a new waypoint once it has been reached. Or perhaps estimating a waypoint as far as possible to be sure that the plane wont reach it.

I'm not familiar with the details how taveling from one WP to another is handled in iNav but in the worst case "just" trying to reach a point won't result in a straight path when crosswind is involved. Refering to the picture above, a straight track could be realized by minimizing crosstrack error / lateral deviation from the original course.

Also, please note that setting a distant waypoint based on FPV sight (e.g. by using OSD center crosshair) would heavily rely on aircraft orientation (compass heading), rather than GPS heading.

Dronek avatar Mar 20 '17 07:03 Dronek

Please keep in mind that there is no distinct "compass heading" or "GPS heading" in INAV. There is just one "heading" which is assumed to be where aircraft nose is pointing.

digitalentity avatar Mar 20 '17 09:03 digitalentity

Please keep in mind that there is no distinct "compass heading" or "GPS heading" in INAV. There is just one "heading" which is assumed to be where aircraft nose is pointing.

Does that have implications on the choice of heading used in mwosd? I noticed that in strong headwind situation my OSD heading stayed steady while Olivier C. at RCG reported flipping of the OSD heading in such case. I deliberately chose to use MAG heading in mwosd config.h and am now wondering whether iNav is using "one heading" for autopilot or in general "one heading" that is also sent to the OSD regardless of OSD settings.

Dronek avatar Mar 20 '17 10:03 Dronek

@Dronek , in my mwosd the home 'arrow' points crazy. I dont know if mwosd has problem with this.

Not the same as osd, but similar problem: I am testing lately a DIY LTM telemetry reader in planes. As far as I have tested it, the result of 'home_heading - uav_heading' is not working for me (should be zero when plane comes to home position), because uav_heading (coming from LTM telemetry, frame 'A') is just the attitude heading of the plane, i.e. the direction the nose is pointing, not the course, so it is useless for this.

So..I guess I should calculate the 'course over ground' in my system taking two consecutive GPS reads.

May be mwosd has a similar problem.

sppnk avatar Mar 29 '17 10:03 sppnk

Aframe heading is heading, typically from the compass. If you want course over the ground, then you must calculate it (as mwp does for 'bearing', in mwp terms the compass direction between the vehicle and home)

stronnag avatar Mar 29 '17 10:03 stronnag

Hmmm... I will steal your code for that. :-)

sppnk avatar Mar 29 '17 10:03 sppnk

@Dronek , for MWOSD issue see here: https://github.com/ShikOfTheRa/scarab-osd/issues/404

sppnk avatar Mar 29 '17 15:03 sppnk

@sppnk : interesting discussion, also at scarab-osd repo. I'm actually using the mentioned define USEMAGHEADING option in mwosd. @digitalentity : can we be sure that iNav will pass MAG heading to mwosd when using the mentioned option?

Dronek avatar Mar 30 '17 07:03 Dronek

@Dronek there is no "mag heading" or "gps heading" in INAV. There is only "estimated heading" which is essentially "mag heading" if compass is available, "gps heading" if compass is not available but there is GPS or "random heading" if neither is/was available.

digitalentity avatar Mar 30 '17 10:03 digitalentity

There is only "estimated heading" which is essentially "mag heading" if compass is available, "gps heading" if compass is not available

OK, so apparently it makes no difference if define USEMAGHEADING option is set in mwosd or not but at least I can be relatively certain that my OSD compass is mainly based on compass sensor, when I understand you correctly.... unless mwosd is calculating heading based on GPS data on its own, when the option is not set, then it would make a difference.

However, it would be of more value when compass data (MAG heading) and course over ground (GPS heading) were available for OSD to indicate crosswind, as I commented here.

Dronek avatar Mar 30 '17 10:03 Dronek

@Dronek , as I use cc3d, I dont have mag, so the value sent in LTM is not what I need to compute a reliable "direction to home", becasue I guess that value is an 'attitude heading'.

@digitalentity , I guess that 'GPS heading' (compass not available) is not equal to course over ground, but plane attitude heading.

If I move the plane sttoped in the ground that value moves, but the plane is at the same point.

I guess that value comes from gyros, not GPS (please correct me if I am wrong).

So I am testing this week the calculation of that 'course over ground' value in my own LTM oled arduino reader. I hope this will work. I will report on results.

sppnk avatar Mar 30 '17 11:03 sppnk

Gyros are always used to estimate heading. In absense of compass sensor GPS course is used as a reference = gyro estimated attitude heading is aligned with GPS course over ground. If GPS is temporary lost we still have valid heading because gyros will cover the gap.

digitalentity avatar Mar 30 '17 11:03 digitalentity

@digitalentity ,then, with the plane flying, 'Heading' value from LTM frame 'A' should be aproximately equal to 'course over ground'? (I cannot find easily that in the sources of inav).

sppnk avatar Mar 30 '17 12:03 sppnk

@sppnk if you don't have compass sensor - yes. If you have compass - it will show true heading (azimuth)

digitalentity avatar Mar 30 '17 12:03 digitalentity