Closed dxs94 closed 1 year ago
This is the code in that would have to be fixed:
@dxs94 can you please help to understand the issue better so that I can try on resolving it. Correct me if I am wrong the behaviour of osd is opposite on upright and inverted, it should be reversed?
@dxs94 Correct me if I am wrong you want the horizon also to be inverted when the craft is inverted. @IamPete1 I Think there should be a small correction in if (check_option(AP_OSD::OPTION_INVERTED_AH_ROLL)) part in the above code you have mentioned (the pitch should also be inverted). is the issue still open, Can I go ahead and make a PR?
Thanks for dev-capable people to look into this. I tried to make the post as clear as possible, please carefully check the YT video (showing incorrect behavior), and the correct behavior on the TX16S script. Below that is my proposal with some « V » to differentiate sky side from ground side of the horizon line, maybe there is a better way depending on available processing power / osd bandwidth. This shows what the OSD would depict if code was correct when aircraft is rolling upside - down (ie. making a half roll).
Fundamentally the problem lies in the fact that Ardupilot code has a pitch value of say +20° when aircraft nose is above horizon. This doesn’t take roll angle into account. And the OSD drawing routine always puts the horizon line below aircraft reference symbol in this case because pitch value hasn’t changed and is positive, even when aircraft is now flying inverted. To correct this you have to make cases for when roll angle is >90° or <-90°.
It depends on how you want to represent the display....as it is now the target mark represents the nose of the aircraft (always in the center of the OSD) and the horizon moves appropriately (and correctly even when inverted) ...AND matches the horizon you see when flying FPV (very important)...I fly inverted often (and am a full size pilot) and prefer knowing where my nose is with respect to the horizon...IF we had a color display such that earth vs sky could be depicted then a picture like the horizon in a real plane could be viable....flying FPV having the horizon move away from what is in the video view would be very distracting....since our pitch information (-90 to +90)cannot be used to determine inversion (must be calculated versus current roll angle which is -180 to 180) the above PR does not work and is wrong when flying upright also...I am not opposed to coding a display as requested as an option (like the inverted_roll option, which tried to come closer to the Russion HUD roll presentation) (but as an FPV flyer I would have no use for it)
@dxs94 sorry for not asking the right question, I mean to ask that if plane is upright then its nose should be drawn below horizon and vice versa ? Whats wrong with that? Sorry if you find my question unworthy, I am newbie here 😅
BTW...the screen shots of the Yaapu OpenTX display you show have nothing to do with ArduPilot's OSD HUD display...they are generated locally from attitude information sent over telemetry....changing the AP OSD would have absolutely no impact on the TX display you show....for that, you would need to have the Yaapu script changed....and for that option, since the Horus class TXs DO have color display, it might be a worthwhile change...I suggest you open a feature request in Yaapu's git repo
@Hwurzburg @adityaomar3 may I kindly ask you re-check the first top post? I updated it with better wording, the Yaapu screenshots ARE CORRECT and the Yaapu script certainly does NOT need to be changed. Those pictures are example of CORRECT behavior. I know it only displays telemetry data.
Here is a picture of what the OSD horizon should look like (and would like in a full size aircraft), based on the still pictures you posted just above. Because the point of the artificial horizon line is to represent the horizon when you can't see it (ie. in clouds).
—————————————————-
To make things clear please review this: The same picture, but you just entered a cloud. How do you know where earth is? How do you know if you're inverted or not? How do you know if you have to pull or push on the elevator to level the aircraft? You can't.
—————————————————-
Now check this one. Here I know I'm upside down (thanks to the chevrons on horizon line), AND I can level the aircraft by flying towards the horizon line. The fact I'm upside down doesn't matter because the horizon line on the OSD is at the same position as the REAL horizon line. Flying towards the line means if the line is below the aircraft symbol then I have to push on elevator, if the line is above I have to pull.
And yes I agree the PR which inverts pitch in osd calculation is not the fix needed. I think what is needed is a rework of the line drawing routine. I’m no programmer but what I would do is compute the coordinates of the center of the horizon line relative to the fixed aircraft reference symbol (a function of pitch and roll) (see my paint drawings top of this page). From there, compute the coordinates of the 2 end points of the line (a function of roll) and draw characters accordingly. I can guarantee that anyone flying IFR for a living would be shocked by how the OSD works at the moment, when flying inverted. First time I tried, I was. I really believe this would be a nice improvement to Ardupilot, I’m available to elaborate if the point I made is still not clear enough.
okay I have coded the mode option and verified in SITL....will post a video later today here....and I added an indication to tell when inverted....flying it under the hood without FPV I can see the advantage, although when overlaid with video it would take a little getting used to....I will have to fly it some to decide if this option should be defaulted on or off...
Nice work that was fast! Spot on. Have you tried instead of the blinking, using characters like this to depict the horizon line: « V - V - - - - V - V »? This would be with the sky at the lower tip of the « V » and the ground on the side the « V » has 2 branches. After some flights I would be more intuitive than blinking (in my opinion). Anyway thank you for your work.
Nice work that was fast! Spot on. Have you tried instead of the blinking, using characters like this to depict the horizon line: « V - V - - - - V - V »? This would be with the sky at the lower tip of the « V » and the ground on the side the « V » has 2 branches. After some flights I would be more intuitive than blinking (in my opinion). Anyway thank you for your work.
changing characters could have bad impacts on all the different MSP displays and fonts sets being used....this panel is drawn in all DisplayPort variations...the letter "v" is implemented as italics in some sets, with cursive in others, shadowed in others, customized in others......better stick with the icon number everyone uses for the horizon line rather than change it
Ok I have no knowledge about those constraints, the blinking does the job just fine. Looking forward to flying with this new option! Thanks!
option merged into master...also added blinking horizon for FPV style (default)
Feature request
Is your feature request related to a problem? Please describe. When flying inverted (ie after a 180° roll), the artificial horizon pitch indication on the osd is reversed compared to any full size aviation ADI. To reproduce: fly inverted (half roll). Push on the elevator stick so that airplane is now in a climb with the nose above horizon. Observe that the osd artificial horizon bar moves DOWN in your goggles whereas it should move UP.
Current (bad) behavior Below: link to video of arduplane behaviour. When inverted, the OSD horizon line moves opposite to real horizon line. https://www.youtube.com/watch?v=Jwwi2szEIdQ
—————————————————-
The correct behavior Below: from Yaapu telemetry script on a TX16S, correct representation of horizon line. When flying inverted, the OSD horizon line follows real horizon line.
—————————————————-
The solution: how OSD should like in Arduplane Taking into accound b/w character based OSD limitations, having something like this (below) in the OSD would be appropriate. This is an example of a half roll. The aircraft reference (say « the nose ») of the aircraft is still fixed. The horizon line is drawn differently to follow what a pilot inside the aircraft would see, this is what Ardupilot OSD should depict to conform with aviation standards. while always keeping the horizon line in view even at extreme pitch angles so that the pilot always knows it's attitude.
Describe alternatives you've considered This could be optionnal (current behaviour / new one) based on user preference but I can't think an any situation where the way horizon line is currently drawn is better (except for taking less real estate on screen being made only with " - " characters).
Platform [ ] All [ ] AntennaTracker [x] Copter [x] Plane [ ] Rover [ ] Submarine
Additional context An artificial horizon has to present the pilot a virtual horizon line from the pilot’s perspective. That and a sky/ground reference to show which side of the line is earth and which is sky. The whole point is that to level off the aircraft the pilot flies to the ADI horizon line no matter if the plane is upright or inverted. Which is impossible if the ADI is just showing « is the aircraft nose above horizon or not ? » as Ardupilot depicts (on top of not having a sky/ground reference).