MC error in UDP feed + turn rate questions

Moderators: Uros, Tom, OXO

Post Reply
zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

MC error in UDP feed + turn rate questions

Post by zpqrtbnk » Wed Mar 30, 2022 8:58 am

Hey,

I am hooking to the UDP feed for an external instruments display.
I am having an issue with the MC value.
It initially is zero - fine.

Incrementing MC produces values 0.1, 0.2, 0.3, etc.
Actually it's more 0.10000365, 0.30000965, 0.2999874 due to, I assume, rounding issues.
But all in all in works.

Decrementing MC produces values 0.3, 0.2, 0.1... with the same non-important rounding issues.
So far, so good.

Now, when getting down to what would be zero,
I am getting totally weird values such +1.49 or -7.03 instead of zero.


Going back up again produces the expected 0.1, 0.2, 0.3.
Going down again produces... another random value for zero.

Anything I am doing wrong?
Bug in Condor?

User avatar
Bre901
Posts: 1790
Joined: Tue Nov 22, 2016 8:57 pm
Location: Annecy (France)
Contact:

Re: MC error in UDP feed

Post by Bre901 » Wed Mar 30, 2022 12:26 pm

I'm using the MC value in the UPD stream for CoTASA, never seen something like that

If I take a look at the UDP log, when MC goes back to 0, I see "MC=-7.3015691270939E-8" in the stream

Definitely no error/bug in Condor :roll:

What programming language are you using ?
How do you read the MC values ?

If you don't get it, I would suggest that you search for "floating point scientific notation" in a good search engine
CN: MPT — CondorUTill webpage: https://condorutill.fr/

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed

Post by zpqrtbnk » Wed Mar 30, 2022 2:17 pm

If I take a look at the UDP log, when MC goes back to 0, I see "MC=-7.3015691270939E-8" in the stream
Sigh. Code is written in C# and uses a regular expression to parse the UDP feed, with values being "=(-?[0-9.]+)" because I never thought the numbers could be in scientific notation (yup, I know what it is) and so it totally misses the "E-8" that you highlighted and now I feel so silly.

You, Sir, are very sharp :)
Thanks!
Stephan

User avatar
Bre901
Posts: 1790
Joined: Tue Nov 22, 2016 8:57 pm
Location: Annecy (France)
Contact:

Re: MC error in UDP feed

Post by Bre901 » Wed Mar 30, 2022 3:20 pm

Hint :
It is possible to activate the UDP log by setting LogToFile=1 in the Condor2\Settings\UDP.ini file
The resulting Condor2\Logs\UDPlog.txt file gets very big very quickly, activate only when needed
CN: MPT — CondorUTill webpage: https://condorutill.fr/

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed

Post by zpqrtbnk » Thu Mar 31, 2022 10:27 pm

Do you think I could use your brain again?

I am looking at the turnrate field of the UDP feed.

I thought I could use it to have an indication about... "hey, you're circling at 20s / turn" - in order to learn to better calibrate my spirals.

No, I am not entirely sure it's a good idea, I probably should learn without this hack.
But now that I have started, I would at least like to understand it.

I was under the impression that it indicated the rate of compass turn in rad/s. However, when I am getting values around .6 rad/s ... that would be 1/10th of 2Pi = 1/10th of a 360 degrees turn = 36 degrees/s = 1 turn in 10s ... I am in fact turning at about 1 turn in 60s. So... either turnrate is not what I think it is, or I am missing something obvious again.

Rings a bell?
Thanks,
Stephan

User avatar
wickid
Posts: 2429
Joined: Mon Dec 04, 2006 7:32 pm
Location: Venlo, NL
Contact:

Re: MC error in UDP feed

Post by wickid » Fri Apr 01, 2022 7:25 am

Manual apendix 3 has all the units:

https://www.condorsoaring.com/manual_en/

If you are using turnrate it is indeed rad/sec.
PH-1504, KOE

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed

Post by zpqrtbnk » Fri Apr 01, 2022 8:42 am

If you are using turnrate it is indeed rad/sec.
Came to the same conclusion, from the same source.

But then, I'd expect that if I clock my complete circle in, say, 30 seconds, that is
360 deg/30s
= 2*Pi rad/30s
= 2*Pi/30 rad/s
~= .20 rad/s

And yet, I seem to be getting values around .6 rad/s.
I have to be wrong somewhere, either in my understanding of turnrate, or in my math, or...

I'll run more tests today.

User avatar
Bre901
Posts: 1790
Joined: Tue Nov 22, 2016 8:57 pm
Location: Annecy (France)
Contact:

Re: MC error in UDP feed

Post by Bre901 » Fri Apr 01, 2022 9:33 am

I did a quick test :
bank ~32°, IAS ~100kph > omega ~0.22 rad/s which matches 1 turn ~28s (clocked)
turn rate in the UDP stream ~0.7
It looks like there is a ~Pi factor between the turn rate written in the UDP stream and the "correct" one.

I have passed the information to the developers
CN: MPT — CondorUTill webpage: https://condorutill.fr/

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed

Post by zpqrtbnk » Fri Apr 01, 2022 9:43 am

Thanks.

User avatar
Bre901
Posts: 1790
Joined: Tue Nov 22, 2016 8:57 pm
Location: Annecy (France)
Contact:

Re: MC error in UDP feed

Post by Bre901 » Fri Apr 01, 2022 1:59 pm

Answer from the developer :

In the UDP stream "turnrate" is actually what is shown on the turn-and-slip indicator = actual turn rate x 4, dampened and limited to [-0.7,+0.7]
However this instrument is clearly intended for powered plane pilots (in French : les pousse-manettes :wink: ) and is almost useless for real (read glider) pilots : the needle hits its stop at about 100 kph, 30° bank

If you want to have the real turn rate, you need to take "yawrate", which is omega.z (rotation rate around the local z-axis) and convert it to omega.Z (rotation rate around the global Z-axis)

omega.Z=yawrate/cos(bank)

I have tested it, it works fine (not checked when bank = 90° or more, though)

I took the liberty to edit the thread title so that it reflects its content
CN: MPT — CondorUTill webpage: https://condorutill.fr/

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed + turn rate questions

Post by zpqrtbnk » Fri Apr 01, 2022 3:04 pm

Excellent :D

Just did a 50 mins flight (around Briançon*). Shows that (a) my thermalling skills are horrible and (b) the turnrate, even with the estimated Pi correction that we discussed, was totally weird indeed. Will fix it with your formula and all should be better. Thanks!!

*: yes, flying in mountains totally does not help learning to stabilize speed and bank in turns as there's practically no usable horizon, but I love this place, have flown there IRL, and love that I can recognize places. :roll:

zpqrtbnk
Posts: 17
Joined: Tue Dec 14, 2021 9:43 am

Re: MC error in UDP feed + turn rate questions

Post by zpqrtbnk » Fri Apr 01, 2022 8:36 pm

Mmm... the formula seems a bit simple. At 90 deg bank angle, the yaw rate becomes irrelevant, but the pitch rate becomes what we want, right? Maths, more maths... following pages such as http://stengel.mycpanel.princeton.edu/Quaternions.pdf I have come up with the following formula:

Code: Select all

var turnRate = Math.Cos(data.Pitch) < 1E-6
            ? data.RollRate // going vertical
            : data.PitchRate * Math.Sin(data.Bank) / Math.Cos(data.Pitch) + data.YawRate * Math.Cos(data.Bank) / Math.Cos(data.Pitch);
It produces values that seem correct, regardless of the bank. But, it is somewhat unstable, so it needs to be averaged a little to become useful. And then... I realize I practically don't look at it. Speed + bank angle + vario looks quite enough to do circles and I am wondering whether this is useful at all. I think I am about to drop that indicator entirely.

Nevermind, it was interesting.

Stephan

Post Reply