Frédéric-O DUCHEMIN Posted February 20, 2018 Author Report Posted February 20, 2018 Hi Paul, here my function Public gps_next_lat As Offset(Of Double) = New Offset(Of Double)(&H60AC) Public gps_next_lon As Offset(Of Double) = New Offset(Of Double)(&H60B4) Private Sub ShowDistanceToGPS() ' Setup info for GPS Dim lat As FsLatitude = New FsLatitude(gps_next_lat.Value) Dim lon As FsLongitude = New FsLongitude(gps_next_lon.Value) GPS = New FsLatLonPoint(lat, lon) ' get current plane position lon = New FsLongitude(playerLongitude.Value) lat = New FsLatitude(playerLatitude.Value) Dim currentPosition As FsLatLonPoint = New FsLatLonPoint(lat, lon) ' Get the distance between here and GPS Dim distanceNM = Math.Round(currentPosition.DistanceFromInNauticalMiles(GPS), 0) ' Get the bearing (True) 'Dim bearing As Double = currentPosition.BearingTo(GPS) ' Write the distance to the text box formatting to 2 decimal places ' FrmMain.gps_ident.Text = distance.ToString("N2") FrmMain.gps_ident.Text = gps_id.Value.ToString() & ": " & distanceNM.ToString() + "NM" ' Display the bearing in whole numbers and tag on a degree symbol 'FrmMain.txtBearing.Text = bearing.ToString("F0") & Chr(&HB0) End Sub FSUIPCConnection.Process() ShowDistanceToGPS() The code is good :) Thanks Regards Fred
Paul Henty Posted February 20, 2018 Report Posted February 20, 2018 Yes the code looks fine, and works for me with FSX. Have you checked what values you are getting for these two lines? Dim lat As FsLatitude = New FsLatitude(gps_next_lat.Value) Dim lon As FsLongitude = New FsLongitude(gps_next_lon.Value) Is sounds like gps_next_lat and gps_next_lon.Value might be 0. If so then it's the same problem as the distance offset. It's not working in P3DV4. I've attached a new version of the DLL. This should load your AirportsDatabase now. Paul FSUIPCClient3.0_RC8.zip 1
Frédéric-O DUCHEMIN Posted February 20, 2018 Author Report Posted February 20, 2018 (edited) 29 minutes ago, Paul Henty said: Yes the code looks fine, and works for me with FSX. Have you checked what values you are getting for these two lines? Dim lat As FsLatitude = New FsLatitude(gps_next_lat.Value) Dim lon As FsLongitude = New FsLongitude(gps_next_lon.Value) Is sounds like gps_next_lat and gps_next_lon.Value might be 0. If so then it's the same problem as the distance offset. It's not working in P3DV4. I've attached a new version of the DLL. This should load your AirportsDatabase now. Paul FSUIPCClient3.0_RC8.zip Thanks for the dll yes I have correct my code give me ID and NM all it's OK. But need a flight plan loaded in p3DV4 to work Sad news I would like read for any aircraft using FMC or FMS and not only basic plane... There is a way with form to load flight plan ? I make a try with the latest version Regards Fred Edited February 20, 2018 by Frédéric-O DUCHEMIN Add feedbacks
Frédéric-O DUCHEMIN Posted March 18, 2018 Author Report Posted March 18, 2018 Hi Paul, I have issues with GPS return. It's not the GPS the problem, it's how the waypoints are read. Even the plane is near the closest navaids after return me the good ID and distance seems it's doesn't where it is and take the first point of pln even this point are already passed. There is a way to look the ID index before and after to avoid this situation ? Here the code: Public gps_next_lat As Offset(Of Double) = New Offset(Of Double)(&H60AC) Public gps_next_lon As Offset(Of Double) = New Offset(Of Double)(&H60B4) Private Sub ShowDistanceToGPS() ' Setup info for GPS Dim lat As FsLatitude = New FsLatitude(gps_next_lat.Value) Dim lon As FsLongitude = New FsLongitude(gps_next_lon.Value) GPS = New FsLatLonPoint(lat, lon) ' get current plane position lon = New FsLongitude(playerLongitude.Value) lat = New FsLatitude(playerLatitude.Value) Dim currentPosition As FsLatLonPoint = New FsLatLonPoint(lat, lon) ' Get the distance between here and GPS Dim distanceNM = Math.Round(currentPosition.DistanceFromInNauticalMiles(GPS), 0) ' Get the bearing (True) 'Dim bearing As Double = currentPosition.BearingTo(GPS) ' Write the distance to the text box formatting to 2 decimal places ' FrmMain.gps_ident.Text = distance.ToString("N2") FrmMain.gps_ident.Text = gps_id.Value.ToString() & ": " & distanceNM.ToString() + "NM" ' Display the bearing in whole numbers and tag on a degree symbol 'FrmMain.txtBearing.Text = bearing.ToString("F0") & Chr(&HB0) End Sub FSUIPCConnection.Process() ShowDistanceToGPS() Regards Fred
Paul Henty Posted March 18, 2018 Report Posted March 18, 2018 These offsets work fine in FSX and FSUIPC4. They always return the next waypoint id and the lon/lat of the next waypoint. The code you posted also works. I used it to follow a flightplan from waypoint to waypoint. It always gave the correct next waypoint and the correct distance and heading. Check your code to make sure you're not constantly reloading the flight plan. If you keep writing to &H130 you'll keep restarting the flightplan from the beginning. Make sure offset &H130 is in it's own group and that it's only processed when you need to load the flight plan. If that's not the problem then it looks like a bug in P3D. Paul
Frédéric-O DUCHEMIN Posted March 18, 2018 Author Report Posted March 18, 2018 Hi Paul, I don't think so here the code only call when I click on load *.pln Private Sub RefreshFlightPlans() Me.cbxFlightPlans.Items.Clear() FSUIPCConnection.Process("plnFolder") Dim folder As String = FSUIPCDATA.simDocsPath.Value Dim flightPlans As String() = IO.Directory.GetFiles(folder, "*.pln") For Each flightPlan As String In flightPlans Me.cbxFlightPlans.Items.Add(IO.Path.GetFileName(flightPlan)) Next End Sub Private Sub LoadplnToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadplnToolStripMenuItem.Click RefreshFlightPlans() End Sub So I use PMDG aircraft's works fine with PMDG 737-X and ProATC/X and don't need to load pln, I think ProATC/X makes the job in flight planner in Sim But with PMDG 777-X works at the beginning return me good ID & Distance after a while return me ICAO & Distance, on approach give me current legs No idea why. Regards Fred
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