Results 31 to 40 of 55
-
06-11-2011, 11:28 AM #31
- Join Date
- Jul 2013
- Posts
- 917
Re: Scaling Localiser and Glideslope Needles for HSI
Jack
I mean splitting your code into seperate functional elements, testing and when satisfied add the next function. Test that and so on. If you encounter a problem then you can identify the area. I would deal with the calc variables v gs first and then and positioning - it is up to you but please do not radically change your logic flow when something does not work - that is a recipe for anarchy
Regards
David
-
06-11-2011, 01:12 PM #32
Re: Scaling Localiser and Glideslope Needles for HSI
Hi David,
I removed the position part of the code, and also added a switch trigger to move the motor (and, therefore, the Pot) up and down.
This is essential because, should the Pot not ever change value, Calc/Calc2 will always be the same number and therefore impossible to test.
So, I did a test of my flying around the glideslope whilst moving the motor up and down. This was the results:
Code:12=1 - Switch 1=120 - Motor_1 58=98 - Pot 12=0 - Switch 58=97 - Pot 58=98 - Pot 13=1 - Switch2 1=250 - Motor_1 13=0 - Switch2 58=99 - Pot 58=100 - Pot 58=101 - Pot 58=102 - Pot 58=103 - Pot 58=104 - Pot 58=105 - Pot 58=106 - Pot 58=107 - Pot 58=108 - Pot 58=109 - Pot 58=110 - Pot 58=111 - Pot 58=112 - Pot 58=113 - Pot 58=114 - Pot 58=115 - Pot 58=116 - Pot 58=117 - Pot 58=118 - Pot 58=119 - Pot 58=120 - Pot 58=121 - Pot 58=122 - Pot 58=123 - Pot 58=124 - Pot 58=125 - Pot 58=126 - Pot 58=127 - Pot 58=128 - Pot 58=129 - Pot 58=130 - Pot 58=131 - Pot 58=132 - Pot 58=133 - Pot 58=134 - Pot 58=135 - Pot 58=136 - Pot 58=137 - Pot 58=138 - Pot 58=139 - Pot 58=140 - Pot 58=141 - Pot 58=142 - Pot 58=143 - Pot 58=145 - Pot 58=146 - Pot 58=147 - Pot 58=148 - Pot 58=149 - Pot 58=150 - Pot 58=151 - Pot 58=152 - Pot 58=153 - Pot 58=154 - Pot 58=155 - Pot 58=156 - Pot 58=157 - Pot 58=158 - Pot 58=159 - Pot 58=160 - Pot 58=161 - Pot 58=162 - Pot 58=163 - Pot 58=164 - Pot 58=165 - Pot 58=166 - Pot 58=167 - Pot 58=168 - Pot 58=169 - Pot 58=170 - Pot 58=171 - Pot 58=172 - Pot 58=171 - Pot 58=172 - Pot 58=171 - Pot 58=172 - Pot 58=171 - Pot 58=172 - Pot 5=117 - GS 30=135 - Calc 31=-151 - Calc2 58=171 - Pot 58=172 - Pot 5=115 - GS 5=114 - GS 5=112 - GS 5=111 - GS 5=109 - GS 5=108 - GS 5=107 - GS 5=106 - GS 5=105 - GS 5=104 - GS 12=1 - Switch 1=120 - Motor_1 12=0 - Switch 58=171 - Pot 58=170 - Pot 58=169 - Pot 58=168 - Pot 58=167 - Pot 58=166 - Pot 58=165 - Pot 58=164 - Pot 58=163 - Pot 58=162 - Pot 58=161 - Pot 58=160 - Pot 58=159 - Pot 58=158 - Pot 5=105 - GS 30=175 - Calc 31=-101 - Calc2 58=157 - Pot 58=156 - Pot 58=155 - Pot 58=154 - Pot 58=153 - Pot 58=152 - Pot 58=151 - Pot 58=150 - Pot 58=149 - Pot 58=148 - Pot 5=106 - GS 30=203 - Calc 31=-65 - Calc2 58=147 - Pot 58=146 - Pot 58=145 - Pot 58=143 - Pot 5=107 - GS 30=217 - Calc 31=-47 - Calc2 58=142 - Pot 58=141 - Pot 58=140 - Pot 58=139 - Pot 58=138 - Pot 58=137 - Pot 5=108 - GS 30=234 - Calc 31=-25 - Calc2 58=136 - Pot 58=135 - Pot 58=134 - Pot 58=133 - Pot 58=132 - Pot 58=131 - Pot 5=109 - GS 30=251 - Calc 31=-3 - Calc2 58=130 - Pot 58=129 - Pot 58=128 - Pot 58=127 - Pot 58=126 - Pot 58=125 - Pot 58=124 - Pot 5=110 - GS 30=271 - Calc 31=22 - Calc2 58=123 - Pot 58=122 - Pot 58=121 - Pot 58=120 - Pot 58=119 - Pot 58=118 - Pot 58=117 - Pot 5=111 - GS 30=291 - Calc 31=47 - Calc2 58=116 - Pot 58=115 - Pot 58=114 - Pot 58=113 - Pot 58=112 - Pot 58=111 - Pot 58=110 - Pot 5=112 - GS 30=311 - Calc 31=72 - Calc2 58=109 - Pot 58=108 - Pot 58=107 - Pot 58=106 - Pot 58=105 - Pot 58=104 - Pot 58=103 - Pot 58=102 - Pot 58=101 - Pot 58=100 - Pot 5=113 - GS 30=339 - Calc 31=108 - Calc2 58=99 - Pot 58=98 - Pot 5=114 - GS 30=345 - Calc 31=115 - Calc2 58=97 - Pot 58=98 - Pot 5=113 - GS 5=112 - GS 13=1 - Switch2 1=250 - Motor_1 13=0 - Switch2 5=111 - GS 58=99 - Pot 58=100 - Pot 58=101 - Pot 58=102 - Pot 58=103 - Pot 58=104 - Pot 58=105 - Pot 58=106 - Pot 58=107 - Pot 58=108 - Pot 58=109 - Pot 58=110 - Pot 58=111 - Pot 58=112 - Pot 58=113 - Pot 58=114 - Pot 58=115 - Pot 5=110 - GS 30=296 - Calc 31=54 - Calc2 58=116 - Pot 58=117 - Pot 58=118 - Pot 58=119 - Pot 58=120 - Pot 58=121 - Pot 58=122 - Pot 58=123 - Pot 58=124 - Pot 58=125 - Pot 58=126 - Pot 58=127 - Pot 58=128 - Pot 58=129 - Pot 58=130 - Pot 58=131 - Pot 5=109 - GS 30=251 - Calc 31=-3 - Calc2 58=132 - Pot 58=133 - Pot 58=134 - Pot 58=135 - Pot 58=136 - Pot 58=137 - Pot 58=138 - Pot 58=139 - Pot 58=140 - Pot 58=141 - Pot 58=142 - Pot 58=143 - Pot 58=145 - Pot 58=146 - Pot 58=147 - Pot 58=148 - Pot 5=108 - GS 30=203 - Calc 31=-65 - Calc2 58=149 - Pot 58=150 - Pot 58=151 - Pot 58=152 - Pot 58=153 - Pot 58=154 - Pot 58=155 - Pot 58=156 - Pot 58=157 - Pot 5=107 - GS 30=178 - Calc 31=-97 - Calc2 58=158 - Pot 58=159 - Pot 58=160 - Pot 58=161 - Pot 58=162 - Pot 58=163 - Pot 5=106 - GS 30=161 - Calc 31=-119 - Calc2 58=164 - Pot 58=165 - Pot 58=166 - Pot 5=105 - GS 30=152 - Calc 31=-129 - Calc2 58=167 - Pot 58=168 - Pot 58=169 - Pot 5=104 - GS 30=144 - Calc 31=-140 - Calc2 58=170 - Pot 58=171 - Pot 58=172 - Pot 5=103 - GS 30=135 - Calc 31=-151 - Calc2 58=171 - Pot 58=172 - Pot 5=101 - GS 5=100 - GS 5=98 - GS 5=96 - GS 5=93 - GS 5=91 - GS 5=89 - GS 5=86 - GS 58=171 - Pot 58=172 - Pot 5=83 - GS 5=80 - GS 5=77 - GS 58=171 - Pot 58=172 - Pot 5=74 - GS 5=71 - GS 5=68 - GS 5=67 - GS 58=171 - Pot 58=172 - Pot 58=171 - Pot 58=172 - Pot
- When GS = 117 (That's right at the very, very bottom of the GS needle)
Pot = 172
Calc = 172*2.83 = 486.76 - 621.86 = -135.1 * -1 = 135.1 = 135
Calc2 = 172*3.60 = 619.2 - 468.2 = 151
Now, you'll notice these are both nonsense readings; due to a problem I tried to explain earlier but couldn't explain correctly.
Pot = 172 means that my GS needle is at the very top
But... GS = 117 means that the FSX needle is at the very bottom.
Therefore, Calc2, which handles the bottom half, is getting its information from a Pot that is not in its zone. Calc, however, is getting information from the correct zone, but cannot reference it to the FSX needle as the "GS" variable is in Calc2's half.
Here, we have a contradiction. Both Calcs are trying to do each other's job.
In other words, Calc is trying to scale my Pot to a FSX needle ABOVE the middle line (of which it isn't), and Calc2 is trying to scale my Pot to a FSX needle BELOW the middle line (which it is, but my Pot is above the top line).
Jack
-
06-11-2011, 01:49 PM #33
- Join Date
- Jul 2013
- Posts
- 917
Re: Scaling Localiser and Glideslope Needles for HSI
Jack
"Here, we have a contradiction. Both Calcs are trying to do each other's job."
That is why I suggested a long way back that you do a test to see which calc or calc2 that you need. Not both together
Regards
David
-
06-11-2011, 04:13 PM #34
Re: Scaling Localiser and Glideslope Needles for HSI
Hi David,
We obviously need two different calculations, as FSX has two segments.
The first, from 138 to 254, and then from 0 to 119.
Jack
-
06-11-2011, 09:04 PM #35
Re: Scaling Localiser and Glideslope Needles for HSI
If it were me, i would try this, but not knowing the actual numbers this is a guess. Docs say output for glideslope is -127 to 127. Is this what SIOC see's? If so, easy, add 127 to the fsuipc output so now you have a range of 0 to 254 with 127 being the middle. Lets say GS Pos 0=40 Pot pos and 127 GS Pos = 155 Pot and GS Pos 254 = 220 Pot pos Now you have enough info to do some slope and intercept math to get an "adjusted" number to drive your motor's just like a servo. Make sense? Here is the site explaining the math for this. i used this method when driving all the real gauges I have/had. Your method is a little harder due to extra coding for the motor position but it is do-able. http://www.baron58.com/Servo_Calc.htm
Rob
-
06-12-2011, 06:03 AM #36
Re: Scaling Localiser and Glideslope Needles for HSI
HI Rob,
Indeed, whatever SIOC sees is not what the FSUIPC SDK manual says.
The GS offset seems to go from 138-254, and then from 0 to 119. I am using offset $0C49.
The manual says it should go from -119 to +119. Maybe you're thinking of the localiser offset? That definitely runs from -117 to +117.
Jack
-
06-12-2011, 09:50 AM #37
Re: Scaling Localiser and Glideslope Needles for HSI
Hi Rob,
I have posted on Pete Dowson's forum and asked him about the glideslope offsets.
Jack
-
06-12-2011, 12:51 PM #38
Re: Scaling Localiser and Glideslope Needles for HSI
I am getting similar results with the localiser needle offset, 048C.
The SDK states that they should range from -117 to +117... But my results are nothing like that. Instead, I get 138-254, and 0-119.
Weird.
Jack
-
06-12-2011, 01:25 PM #39
-
06-12-2011, 01:58 PM #40
Re: Scaling Localiser and Glideslope Needles for HSI
HI everyone,
Fantastic news.
I have managed to get the GS needle fully working.
I had to do two things...
Firstly, I had to define Offset 049C as Type 1. Without this definition, I get nonsense results which make it impossible to work with.
Secondly, I had to rework the potentiometer values. As the GS values increase as it goes down, my Pot does the opposite. So, I rectified this, and now they both increase as they move down.
This is the script:
Code:Var 0005, name GS, Link FSUIPC_IN, Offset $0C49, Length 1, Type 1 // FSUIPC GS Source { L0 = &GS + 119 &New_GS = L0 } Var 0097, name Potentiometer, Link SUBRUTINE { L0 = &Pot_Orig * -1 L0 = L0 + 171 &Pot = L0 CALL &Value_Calc } Var 0001, name Motor_1, Link USB_DCMOTOR, Output 1 // Motor Var 0058, name Pot_Orig, Link USB_ANALOGIC, Input 2, PosL 0, PosC 127, PosR 250 // Potentiometer { CALL &Potentiometer } Var 9991, name New_GS Var 8754, name Pot Var 0003, name Value_Calc, Link SUBRUTINE // Provides a scale between GS and Pot { L0 = &Pot * 3.260 &Calc = L0 CALL &Position } Var 0030, name Calc // Calculation holding variable Var 0002, name Position, Link SUBRUTINE // The Calculations for driving the motor { IF &Calc > &New_GS { &Motor_1 = 250 } ELSE { IF &Calc < &New_GS { &Motor_1 = 120 } ELSE { IF &Calc = &New_GS { &Motor_1 = 128 } } } }
Thank you so much,
Jack
Candid connections: Platform for casual relationships Live Women Prime Сasual Dating
Super Сasual Dating - Genuine...