hks76 Posted February 3, 2013 Report Posted February 3, 2013 Hello, I want to read the Pitch, Roll and the Yaw out of fsuipc. I made a program that reed the value out of FSX. this is a part of my program; Public Class MotionBase Private Const AppTitle As String = "MotionBase" ' Register the Offsets we're interesing in for this application Dim Pitch As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3078) Dim Roll As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3080) Dim Yaw As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3088) ' Basic integer read example Private serialPort As New IO.Ports.SerialPort _____________________________________________________________________________________ ' FSUIPC documentation for this offset and display the result. Dim PitchDegrees = (Pitch.Value * 360.0# / (65536.0# * 65536.0#)) Me.TextPitch.Text = PitchDegrees Dim RollDegrees As Double = (Roll.Value * 360.0# / (65536.0# * 65536.0#)) Me.TextRoll.Text = RollDegrees Dim YawDegrees As Double = (Yaw.Value * 360.0# / (65536.0# * 65536.0#)) Me.TextYaw.Text = YawDegrees _____________________________________________________________________________________ Private Function PitchDegrees() As String Throw New NotImplementedException End Function Private Function RollDegrees() As String Throw New NotImplementedException End Function Private Function YawDegrees() As String Throw New NotImplementedException End Function I get stranges values (zie picture) the jump from a minus and maxium number will the plane is flying horizontal (pitch has to be zero than). The 3078, 3080 and the 3088 acceleration in radians/sec/sec relative to the body axes in double floating point format. If have try to translate the value to defrees like this; DimYawDegrees As Double= (Yaw.Value /3.14159265# * 180#) but it doesn't seem to help. I want the value in a range of -50 degrees to +50 degrees to juse for a servo. How can I do that??? (I'm sorry I'm still learning the programm language) :oops:
Pete Dowson Posted February 3, 2013 Report Posted February 3, 2013 I want to read the Pitch, Roll and the Yaw out of fsuipc. I made a program that reed the value out of FSX. ' Register the Offsets we're interesing in for this application Dim Pitch As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3078) Dim Roll As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3080) Dim Yaw As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H3088) You do realise these are accelerations, not the actual current pitch, roll and yaw values? Also they are 64-bit ("double") floating point numbers, not integers. You are only reading the least significant 32-bits as if they are integers, which will give you rubbish. Please do actually read the details provided in the Offsets list which tell you all this. I want the value in a range of -50 degrees to +50 degrees to juse for a servo. Accelerations are NEVER "in degrees", degrees per second per second maybe. Velocities are in radians or degrees per second, only the actual angles can be measured in degrees. Pete
hks76 Posted February 4, 2013 Author Report Posted February 4, 2013 Hello Pete, Thanks for the reply. I thought I read in a topic that I have to juse the acceleration value? And yes you are right it is given in rad/sec/sec. I want to built a 6 DOF motionbase, but I have little knowledge of programming. Thats why I try to read the value first to visual basic. I have also thried the 0578 (fsuipc offset) but I can't get a decent value out of it. So thanks for your reply. I will try to find the the actual current pitch, roll and yaw values Thanks and greeting, Henk (Holland)
Pete Dowson Posted February 5, 2013 Report Posted February 5, 2013 I thought I read in a topic that I have to juse the acceleration value? For a motion platform, yes, the aceleration values are the best source, because the pilot only feels accelerations, not velocities or angles. But you said you were expecting it to be between -50 and +50 degrees. Accelerations are not angular measurements like that. I want to built a 6 DOF motionbase, but I have little knowledge of programming. Such a project seems rather advanced for someone without programming experience. I have also thried the 0578 (fsuipc offset) but I can't get a decent value out of it. 0578 is the pitch value, and that is an angle, and furthermore it is an integer. it represents the pitch in FS's own internal units. The conversion formula is provided in the offsets list. I will try to find the the actual current pitch, roll and yaw values They are Pitch, Bank and Heading, in offsets 0578, 057C and 0580, and all in the same units. So that is easy. but I don't know what you think you'd do with them to drive a platform. If you want the platform merely to adopt those angles, then it will be much like one of those toy motion devices which are designed to amuse children rather than a proper motion simulator. I'm pretty sure that the correct way is to use scaled versions of the accelerations to determine speed and direction of lift and drop, follwed by a period of "wash-out" to let things level out again without the pilot noticing, ready for the next accelerations. However, I'm certainly no expert on the matter, only explaining what i believe and have read. You need to do your own research. But I do know it isn't easy, and can involve some sophisticated programming. Regards Pete
hks76 Posted February 5, 2013 Author Report Posted February 5, 2013 Hi Pete, Thanks for the information. Yes, you're right Ineed more information. That's why I looking on Google and this forum. I'm trying to understand the language of visuel basic and the Arduin Uno. With every little step forwart I as happy as a child :mrgreen: . So Thanks for your time and information. I'm verry pleased with the registerd FSUIPC. I't a wonderful program. Thanks!!!
Blackhawk29 Posted March 13, 2014 Report Posted March 13, 2014 Hello, I'm a new programmer with FSUIPC :razz: But I've some problems or questions.I try to read pitch, bank and heading value.I've done that : private Offset<float> heading = new Offset<float>(0x0580); //Read the heading value private Offset<float> bank = new Offset<float>(0x057C);//Read the Bank(Roll) value private Offset<float> pitch = new Offset<float>(0x0578);//Read the Pitch value But when I read the value of the pitch, for example, I've this result : PITCH OFFSET VALUE : -2.26553752912112E+304 and with the convertion : pitch.Value * 360f / (65536f * 65536f); I've this result : PITCH VALUE : -1.89895162005816E+297 I don't understand what can I do with this big value :???: My project is :Make a Communication between FSX and Unity3d, with your dll, FSUIPC.dll Thank you in advance for your answer.
Blackhawk29 Posted March 13, 2014 Report Posted March 13, 2014 Hello again, I try with one of your answer, with a floating variable like this : float newNewPitch = pitch.Value; newPitch = newNewPitch * 360f / (65536f * 65536f); newPitch is a float variable. This time my result is PITCH OFFSET VALUE : 9.232419E-38 without conversion with conversion8.407791E-45 Have you an idea ?Thank you again.
mgh Posted March 13, 2014 Report Posted March 13, 2014 the offsets (0x0578, 0x057C, and 0x0580) are integers and not floats. The SDK shows that they have only 4 bits
Paul Henty Posted March 13, 2014 Report Posted March 13, 2014 Blackhawk, The offsets are declared with a type according to the offset size, not the data type you will eventually convert the raw data into. Please review my UserGuide.pdf that comes in the zip file, especially page 7 which explains which c# types you need to use with different offset sizes. If you don't understand this you'll never be able to use the DLL properly. If you need more help, you can ask in my sub-forum under this one. Paul
Blackhawk29 Posted March 13, 2014 Report Posted March 13, 2014 Thank you Paul and mgh.I will test that tomorow.For my program, I think I've just need 12 offsets.I will read more carefully the document UserGuide.pdf Thank you again. BlackHawk
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