InMotion Posted January 7, 2009 Report Posted January 7, 2009 Hi Peter, I'm writing software for a customer who has a motion simulator that has 360 degrees of pitch and I'm having an issue getting normal Euler angles for pitch. For example, address $0578 provides four quadrants of data (0..-90..0 then 0..+90..0). This makes it very difficult to get normal pitch data. Is there another work around that you can help me with? Regards, Mark Barry http://www.inmotionsimulation.com/
Pete Dowson Posted January 7, 2009 Report Posted January 7, 2009 For example, address $0578 provides four quadrants of data (0..-90..0 then 0..+90..0). This makes it very difficult to get normal pitch data. Is there another work around that you can help me with? The pitch data is complete. No more is needed. It gives all 360 degrees -- 0 to 179.999999.... pitch down and -0.000001... to -180.0 pitch up. What more could there possibly be? If your pitch reference zero is other than the horizontal it is just a matter of arithmetically adding or subtracting that reference, surely? What is the difficulty? It's only one dimension, there are no other factors. Pete
InMotion Posted January 7, 2009 Author Report Posted January 7, 2009 Hi Pete, That's not correct or there's a bug in FSUIPC (or the documentation) because that's not how the pitch data is coming out. This is what I'm seeing and this is what other people in other forums are reporting: TOP/FACING UP 0 to -90 -90 to 0 BOTTOM/FACING DOWN 0 to +90 +90 to 0 I doubt your seeing +/-180 for pitch. Have you actually confirmed this? Mark
Pete Dowson Posted January 7, 2009 Report Posted January 7, 2009 That's not correct or there's a bug in FSUIPC (or the documentation) because that's not how the pitch data is coming out. ... I doubt your seeing +/-180 for pitch. Have you actually confirmed this? Not before now, no. I just believed what I thought MS stuff told me. I never have time to check and test every value -- especially those simply passed straight through from FS, or given direct access into FS innards, like the LLAPBH values. I do check values computed or derived by my own code of course. For interpretation of the rest I am completely dependent upon feedback from those who use the data. Anyway, you are completely correct. And it is the same in all versions of FS. So my documentation has been wrong now for nearly 10 years, and you are the first to even notice it -- or maybe just the only one to bother to tell me! I will correct the documentation. I cannot change what FS provides -- it will certainly mess up existing programs if I do. The Bank angle will have to be read too, in order to compute the 0-360 pitch. The absolute value of the bank angle is between 90 and 180 when the aircraft is "upside down", and between 0 and 90 otherwise. So, the three resulting cases are: Pitch >= 0, abs(bank angle) < 90: real pitch = pitch Any pitch, abs(bank angle) >= 90: real pitch = 180 - pitch Pitch < 0, abs(bank angle) < 90: real pitch = 360 - pitch Check that for me please. If you agree, I'll include it in the documentation the next time I update it. Regards Pete
InMotion Posted January 7, 2009 Author Report Posted January 7, 2009 Hi Pete, I've been extracting data from MS Flight Simulator since 1994 and I've been using FSUIPC since about the time it came out. I have always known about the pitch data problem but I've never had to worry about it because we don't manufacture simulators that travel 360 degrees -- and I believe I did email you about it but I don't think you replied. It wasn't until I had to program another customer's simulator that I needed to address this problem and I'm glad you finally checked and confirmed what I was telling you. As for your theory on calculating pitch, I'm not real clear on what you're describing. What I need is either +/-180 for pitch or 0-360. Will you be able to fix this or provide data to calculate pitch? I'm assuming there has to be a solution using the available data from FS because otherwise how would instruments, such as the artificial horizon, work? Mark
Pete Dowson Posted January 7, 2009 Report Posted January 7, 2009 I did email you about it but I don't think you replied. I always reply to non-spam emails i receive, so either it got lost in one of the many outages I used to have (dodgy power cable, overhead ones disturbed easily by wind -- now fixed1) or it got seized and dumped by my ISP. Sorry. As for your theory on calculating pitch, I'm not real clear on what you're describing. What I need is either +/-180 for pitch or 0-360. Will you be able to fix this or provide data to calculate pitch? I'm assuming there has to be a solution using the available data from FS because otherwise how would instruments, such as the artificial horizon, work? Well, Microsoft and others seem to manage with the information supplied. I repeat what I said in my last message. I CANNOT after 10 years, change what is reported as pitch by FSUIPC. It is merely relaying what is supplied by FS to all gauges and anything else which asks. Surely the algorithm I outlined does it all for you. What IS the problem you have with it? It gives you the pitch from 0 - 360, as you asked. Your software needs to do a little computation using the Bank value as well. Please tell me what you don't understand. I am perplexed! Regards Pete
InMotion Posted January 7, 2009 Author Report Posted January 7, 2009 Hi Peter, I agree, you don't want to change FSUIPC and screw everyone up. But can you make a customer version for my customer? I'm sure he would pay you for your time. So you're saying I can get pitch 0-360 using your formula: Pitch >= 0, abs(bank angle) < 90: real pitch = pitch Any pitch, abs(bank angle) >= 90: real pitch = 180 - pitch Pitch < 0, abs(bank angle) < 90: real pitch = 360 - pitch I'll play around with this and get back with you. Mark
Pete Dowson Posted January 8, 2009 Report Posted January 8, 2009 I agree, you don't want to change FSUIPC and screw everyone up. But can you make a customer version for my customer? I'm sure he would pay you for your time. Sorry, I don't see the point. The computation to get your 0-360 is so easy, just simple arithmetic. Why would you need any change to FSUIPC? So you're saying I can get pitch 0-360 using your formula: Yes, except for the deliberate error -- the case where the pitch is < 0 should be 360 + pitch, of course, or 360 - abs(pitch). Anyway, you can test this with a simply Lua plug in. Here, copy this and save it in the FS Modules folder as "pitch.lua", then load up FS, assign a Key press to "Lua pitch" and then use that keypress to start it. Put FS into slew mode, plane horizontal (Ctrl+Space on FSX) and use the slew pitch up slow or down slow control to make it turn the whole 360 degrees and observe the values on screen: -- "Pitch" example LUA plug-in to show pitch 0-360, by Pete Dowson, January 2009 -- Loop forever: to stop this you'll have to use the LuaKill control on it. while 1 do -- Get the pitch and bank data we want to display -- (Note that it is read in one instruction, so that all values -- apply to the same FS frame) pitch, bank = ipc.readStruct(x0578, "2SD") -- and convert them from FS units to units we like pitch = pitch * 360 / (65536 * 65536) bank = bank * 360 / (65536 * 65536) -- compute 0-360 value for pitch if math.abs(bank) >= 90 then realpitch = 180 - pitch elseif pitch < 0 then realpitch = 360 + pitch else realpitch = pitch end -- display it all in an FS window ipc.display("pitch="..pitch.."\nbank="..bank.."\n\nrealpitch="..realpitch) -- Sleep for 50 mSecs so the update gets done roughly 20 times per second ipc.sleep(50) end Regards Pete
InMotion Posted January 8, 2009 Author Report Posted January 8, 2009 Hi Pete, Your simple formula seems to work okay. I converted it to Delphi: if ABS(Roll) >= 90 then Pitch := 180 - Pitch else if Pitch < 0 then Pitch := 360 + Pitch; During my testing with FSX I flew just pure pitch only and the numbers go from 0 to 360. But if you raise the nose up, let's say 20 degrees above the horizon, then roll right, as soon as you pass 90 degrees your pitch is changed by 180 degrees. Mathematically this is correct, but it's going to snap the customer's simulator around 180 degrees. I'm not sure if there's anything we can do differently in this type of simulator. What do you think? Mark
Pete Dowson Posted January 8, 2009 Report Posted January 8, 2009 Your simple formula seems to work okay. I converted it to Delphi: You didn't bother to try the Lua plug-in I supplied? In the next update for FSX (but not FS9 or before) it would be possible to have a little Lua plug-in, auto-loaded when FSX starts, which does the pitch conversion continuously and makes it available via the 0578 offset, just as if it came from FS. The facility to "mask" FS values with computed values is something I'm working on now. During my testing with FSX I flew just pure pitch only and the numbers go from 0 to 360. But if you raise the nose up, let's say 20 degrees above the horizon, then roll right, as soon as you pass 90 degrees your pitch is changed by 180 degrees. Mathematically this is correct, but it's going to snap the customer's simulator around 180 degrees. I'm not sure if there's anything we can do differently in this type of simulator. What do you think? Sorry, I'm probably not the right person to ask about how to interface such motion simulators. I always thought the range of actual motion was strictly limited, that the main point of any motion was not for real angles and attitudes, but for the accelerations, the "seat of the pants" feelings the pilots get when the aircraft is changing attitudes, speeds, whatever. In normal balanced flight there's no need for any real pitch, roll or yaw -- the eyes do it for you via the wraparound display technologies. So if I was building a motion base I'd only need small pistons, enough to give the odd jerks now and then and to provide turbulence effects. The cockpit would in reality remain almost horizontal, and after any changes to induce acceleration feelings, just "wash out" slowly back to horizontal without the occupants noticing. I would have done something like that for my 737NG cockpit, using something like the Dbox pistons, except for the fact that the cockpit weighs nearly a ton and is in an upstairs room on floorboards, and I don't trust the possible occasional near doubling of weight being sustained! ;-0 Regards Pete
InMotion Posted January 8, 2009 Author Report Posted January 8, 2009 Hi Pete, I didn't use your plugin because I have my own. My code is essentially the same as yours and works correctly. You are correct about not needing 360 degrees of motion in a simulator, but I did not build this one as I am only programming it for a customer. If you look at my website (www.inmotionsimulation.com) you'll see that we have built FAA certified flight simulators (B-737s, King Airs, Piper Cubs, etc) using very little motion (under 25 degrees). But I had no choice in this current simulator I'm working on. Thanks again for your help. Mark
Slopey Posted January 8, 2009 Report Posted January 8, 2009 Hi There, excuse my naivety, but how does a simulator with 360 degrees of pitch actually work? Not the mechanics, but the forces on the user. If I put an aircraft into a sudden climb/dive, or loop, there are G forces acting on me keeping me (or trying not to) in the seat. With a static simulator on the ground, would gravity not interfere at pitches above +/- 90 degrees to give an inappropriate sensation? Just curious! Cheers, S.
InMotion Posted January 9, 2009 Author Report Posted January 9, 2009 Hi, A simulator that has 360 degrees of motion really can't simulate g-force accelerations. That's why a 6 DOF is more appropriate. Mark
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now