View Full Version : ok, who wants to play "Interfacing to fs2002 with FSUIPC" ???
01-08-2002, 02:01 PM
if you have the following, and want to learn - or share your experiences, let give it a shot..
you will need...
and, a sense of fun... :-lol
I am happy to present a series of articles here in this thread, with images, of how to use the FSUIPC SDK with VB for fs2002 to interface to the outside world..
anyone interested ;-)
Joe.. Captn S.
01-08-2002, 02:11 PM
YEAH YEAH YEAH!! Keep it comin Slarty!
01-08-2002, 03:07 PM
ok ... have you got VB ??
01-08-2002, 05:17 PM
I have Visual Basic 5, FSUIPC SDK 9 and FSUIPC.dll V 2.80..
01-12-2002, 06:23 PM
I've done a couple small projects with fsuipc with microsoft visual C++ V6.0. Mr Dawson was very helpful in responding to Qs. I'd love to see more on it. Is vb fast enough for flightsim?
01-14-2002, 12:14 PM
We exchanged a couple emails, but this is probably a better place for a few general questions, so that others can benefit from the discussion also.
First question: Trying to retrieve current airplane data. I seem to have the LAT, LON and HDG conversions working, but the Altitude is giving me a fit. The docs say:
Altitude, in metres and fractional metres. The units are in the high 32-bit integer (at 0574) and the fractional part is in the low 32-bit integer (at 0570).
In VB6, I've Dim'd both as LONG
FS shows current altitude of 3500.3 feet
0574 == 1066 ( * 3.281 = 3497.546 )
0570 == -522125312 ????
Obviously, I'm confused... 3500.3 feet should equal 1066.88 meters (I think), and I'm stuck on how to get the .88 part.
01-14-2002, 10:37 PM
so what you doing??
01-15-2002, 12:53 AM
Right now I'm just playing around, trying to get a feel for the FSUIPC interface.
I'm currently playing with VB6, since it's so easy to slap together input screens.
Since I like to chase the A.I. traffic, the first task I thought I'd tackle is writing a little utility which would: list the A.I. traffic, let me select one of the planes, and then set the Autopilot to track the selected A.I.
I'm getting most of the needed offsets figured out (reading and writing), but I'm having a little trouble with some of the conversions.
Then, I need to get out an old Geometry 101 textbook to try and remember how to calculate bearing and distance and what-not.
Actually, I also need to learn how to translate pairs of Lat/Lon coords into distances.
Any tips would be appreciated.
01-15-2002, 05:48 AM
me thinks the value is an ABS(xxx) value...
when you multiply it as aaa.bbb it seems ok. ??
what you are seeing is a 2's compliment return from vb cos the msb is set, vb is treating it as a negative number.
01-15-2002, 06:22 AM
Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159):
R = 6367000
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c
Where R is the radius of the earth. I used earthradius=6367000 meters. The earth actually varies from 6336 km to 6399 km.
This will give mathematically and computationally exact results. The intermediate result c is the great circle distance in radians. The great circle distance d will be in meters.
be aware that vb trig functions work in Radians !!!!!
To convert degrees to radians, multiply degrees bypi/180. To convert radians to degrees, multiply radians by 180/pi.
Have fun. !
01-15-2002, 03:12 PM
LAST EDITED ON Jan-15-02 AT 04:00PM (EDT)[p]Have fun!
Ummmm... not sure I could call it "fun" just yet... Going crazy trying to figure this out might be a better description.
I *believe* I have the distance calculation working. Now, to find the correct way to calculate Bearing. I know this is a simple task - well, standard anyway... maybe I should go back to school...
Nevermind... I figured out how to calc the Bearing. Pretty close to my goal now. Although, the Altitude numbers are still off by a bit. I know I'm not reading the decimal portion correctly, and I can't get it right using the 'C++' code either. Arrrgh.
01-16-2002, 02:50 AM
Well... a little more digging and I worked-out the Altitude issue - for anyone else who may be trying this.
The Low 32-bit integer, for the fractional part, is a fraction of 0x100000000 ... and I assume that everyone else already knows this. In VB, of course, one must convert the signed-long to an unsigned-long (actually a double) in order to perform the calculation.
Now, on to the hard part ;)
01-16-2002, 09:05 PM
reason I asking was that I, for a long while, was trying to get my garmin gps av gps to interface with fs2kx. I wrote most of the fsuipc code to extract long/lat/alt info and had wrote the garmin protocol software to transfer that real time to the GPS. I had *thought* that I had read that there was garmin protocol commands to dump this data to the GPS in simulator mode but when I went back to reread the docs, it was not so. I've been on the phone with garmin several times trying to talk them in to giving me the access method (they gotta have it for testing and validation). In either case, the code now sits idle awaiting either another project and/or a breakthrough from garmin. I think garmin was nuts not to do this since it would have made a great demo and training tool. such is life.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.