Board index FlightGear Support Tools Atlas

Moving map via http  Topic is solved

Atlas is an addon that lets FlightGear users display a real-time "moving-map" of their flight.

Moving map via http

Postby hollingwood » Tue Feb 10, 2015 6:26 pm

Hiya,

Now I have by cockpit simulator fully functional I am spending lots more time flying and recently completed some cross country stuff in the Cessna 172.

Just started playing with the moving map by ThorstenD which I like very much. It works fine for me but if I refresh the display via the web browser (Safari on an iPad4) the location reverts from my aircraft at my airport to another aircraft at Hamburg. I guess this is the default location. I have to restart Flightgear to correct the display. Obviously I shouldn't refresh the display! But is there an easier way to encourage Flightgear to serve the correct data on refresh?

Any comment would be welcome or pointers to relevant locations for code.
Martin
FG environment: hp xw8600 2 Xeon quad core 2.66GHz
GTX760 graphics: 4 - X screens
FG v3.2 - x3 Viewsonic 2410 23" 1920 x 1080
FGPanel - x2 Samsung Syncmaster 740b 15" 1280 x 1024 as 2560 x 1024 hard cockpit
Aircraft: Cessna172sp
hollingwood
 
Posts: 21
Joined: Fri Oct 10, 2014 6:06 pm
Location: Yorkshire, UK
Version: 3.2.0
OS: Ubuntu 14.04

Re: Moving map via http

Postby Torsten » Tue Feb 10, 2015 8:14 pm

Sorry, I don't exactly understand your issue.
What do you mean with " I refresh the display via the web browser"?

If you refresh the map in the web browser, it should just work as expected: reload the content and recenter at the aircraft position.
If you restart or reset FlightGear, the internal web server get's restarted and your connection gets disconnected. Once FlightGear is up and running again, refresh the map and you are in sync again.
I can't think of any case where you have to restart FlightGear to get the map centered on the aircraft again.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 637
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Moving map via http

Postby hollingwood » Tue Feb 10, 2015 10:57 pm

Hiya,
Thanks for your response. By refresh I mean clicking on the circular arrow which is present at the end of the address window on the ipad, after the URL. Its usual action is to cause the browser to load the URL again as you say, and as I expected, but its actual effect in my case is to cause the display of the aircraft and the map centred on Hamburg. I will try it again from another machine on my network to see whether it is a Flightgear issue or an ipad issue, if that would be helpful.
The resyncing actions on restarting or resetting Flightgear are as you describe, so no problems there.

Regards, Martin
FG environment: hp xw8600 2 Xeon quad core 2.66GHz
GTX760 graphics: 4 - X screens
FG v3.2 - x3 Viewsonic 2410 23" 1920 x 1080
FGPanel - x2 Samsung Syncmaster 740b 15" 1280 x 1024 as 2560 x 1024 hard cockpit
Aircraft: Cessna172sp
hollingwood
 
Posts: 21
Joined: Fri Oct 10, 2014 6:06 pm
Location: Yorkshire, UK
Version: 3.2.0
OS: Ubuntu 14.04

Re: Moving map via http

Postby wlbragg » Tue Feb 10, 2015 11:23 pm

I've seen cases where reloading the webpage in that manner actually causes a cached page to load instead of a fresh read of the intended website. It's hard to catch and even harder to get rid of. Sometimes you can delete the browser cache and get rid of the bizarre behavior.

Torsten, it's been awhile since I have programmed websites and I haven't studied your code, but I do remember in some cases needing a no-cache meta data statement (or something similar) to keep things like this from happening.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4989
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Moving map via http

Postby hollingwood » Wed Feb 11, 2015 10:17 am

Hi again,
Just tried it using FireFox on the same computer as FlightGear is running via localhost. Behaviour is the same as described above. I have tried clearing the cache - no effect. I have looked at the index.html for the gui/map and see the initial maps are the German maps for the Hamburg area. Perhaps someone could just try starting FlightGear with --httpd=5500 at an airport other than Hamburg (or Germany), starting the moving map in their favourite browser and clicking on the refresh button after their airport comes up. That would show if its just me.
Best regards
Martin
FG environment: hp xw8600 2 Xeon quad core 2.66GHz
GTX760 graphics: 4 - X screens
FG v3.2 - x3 Viewsonic 2410 23" 1920 x 1080
FGPanel - x2 Samsung Syncmaster 740b 15" 1280 x 1024 as 2560 x 1024 hard cockpit
Aircraft: Cessna172sp
hollingwood
 
Posts: 21
Joined: Fri Oct 10, 2014 6:06 pm
Location: Yorkshire, UK
Version: 3.2.0
OS: Ubuntu 14.04

Re: Moving map via http

Postby Torsten » Wed Feb 11, 2015 1:10 pm

I don't think that the browser cache has any influence on what you observe. None of the loaded files change while the map is displayed.
The position data that make the map recenter comes through a websocket. This is by definition never cached.
What might cause the map to freeze at the initiall state is that it recenters only if the flightgear instance actually sends position information. And it only sends these data when the position actually changes.
When I first started with the httpd implentation a bug prevented an initial transmit of values when the map was initially loaded. That caused exactly the behaviour you describe until the aircraft moved just a tiny little bit. I can't remember when I fixed that bug, but it should be surely fixed by 3.4.0.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 637
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Moving map via http

Postby F-JJTH » Wed Feb 11, 2015 1:13 pm

starting FG with --httpd=8080 --airport=LFNH, then I open my web browser (firefox) and navigate to 127.0.0.1:8080/gui/map:
During ~1 seconds I can see Hambourg area (it's expected because it's the default position until the first position from FG is found by Javascript) then I immediately jump to LFNH and I can see my violet aircraft icon at the right place. Then I press the refresh button (at the end of the URL bar): I see again the Hambourg area during ~1 seconds then jump again to LFNH as expected.

In other words: everything works very fine as expected.

Regards,
Clément
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: Moving map via http  

Postby hollingwood » Wed Feb 11, 2015 4:31 pm

Hi everyone,
It's just me!
I have now found it behaves precisely as Torsten describes in his last post above. The aircraft has to move just a tiny bit and then everything works as it should on refresh. Great!! Hope I havn't wasted too much of your time. Thanks for the very fast responses. Fantastic support.
Regards to all.
Martin
FG environment: hp xw8600 2 Xeon quad core 2.66GHz
GTX760 graphics: 4 - X screens
FG v3.2 - x3 Viewsonic 2410 23" 1920 x 1080
FGPanel - x2 Samsung Syncmaster 740b 15" 1280 x 1024 as 2560 x 1024 hard cockpit
Aircraft: Cessna172sp
hollingwood
 
Posts: 21
Joined: Fri Oct 10, 2014 6:06 pm
Location: Yorkshire, UK
Version: 3.2.0
OS: Ubuntu 14.04

Re: Moving map via http

Postby marksummerfield » Mon Jun 22, 2015 2:38 pm

Just read this post with interest as I have exactly the same issue as Hollingwood reported in Feb - however mine does not work whatever I seem to do. Map displays an aircraft in Germany on start up and moving the aircraft does not initiate a map update and a change of location to France where the aircraft is located (and aircraft does not move at all on the map) . I'm baffled. Flightgear is v3.4 on Linux 14.10 --httpd=8080 (or 5500) in the fgfs startup. I can see the map ok from either the localhost machine or another on the network and have tried with Firefox and Chrome. Aircraft is DC-3 and location LFAT. It just looks like Flightgear is not sending the location data. Am I missing something?. The map looks excellent and exactly what I want to replace the crumbling Atlas system. I would much appreciate any help, as I'm sure it's something simple. The rest of flightgear works brilliantly - including Atlas but I can't seem to create maps any more so need to move on.
marksummerfield
 
Posts: 27
Joined: Mon Jun 22, 2015 2:14 pm
Location: Cheltenham, UK
Version: 2016 1.2
OS: Linux

Re: Moving map via http

Postby marksummerfield » Thu Jun 25, 2015 3:58 pm

Hmmm.... I'm not much further towards solving this - however if anyone can throw some light on the problem - I have done a bit of experimenting and discovered a few clues which might give an indication to someone who understands this better than me. I have tried this out on a second installation of Flightgear (almost identical to the original one) Ubuntu 14.10 and Flightgear 3.4. It works fine - the map shows the correct location and the plane icon moves. There is no need to move the plane a tiny bit before the map updates - briefly shows Germany then the correct location as mentioned by F-JJTH. My main system remains stubbornly unresponsive although everything else appears to work fine. My guess is there is a problem somewhere in the httpd setup. The webserver is working - it displays the initial map and allows me to browse the property tree from the menu in localhost:5500/gui/ .

I have looked at the log files from the working and non working systems and identified some differences which seem to be important but I don't know enough to be sure of what they are telling me. Here are a couple of extracts from the log relating to the request to the hpptd. Basically I took simple FG startup with minimal options but included --httpd=5500 then used a browser to look at the map and refreshed it a few times. Log level is set to "Info" on both systems and I compared the logs - see extracts below

This one from the system that works:
Code: Select all
RegularConnection::request for /gui/map/
RegularConnection::request for /gui/3rdparty/jquery/jquery.min.js
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/leaflet.css
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/leaflet.js
RegularConnection::request for /gui/3rdparty/flot/jquery.flot.js
RegularConnection::request for /gui/lib/props.js
RegularConnection::request for /gui/lib/jquery.flot.prop.js
RegularConnection::request for /gui/map/images/aircraft.svg
RegularConnection::request for /gui/map/images/followAircraft.svg
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/images/layers.png
RegularConnection::request for /navdb
FGPositioned::typeFromName: couldn't match:om
RegularConnection::request() responding 10819 Bytes, done=1
RegularConnection::request for /json/ai/models
JsonUriHandler: request is '/json/ai/models'
RegularConnection::request() responding 35764 Bytes, done=1
RegularConnection::request for /gui/map/images/ndb.svg
RegularConnection::request for /gui/map/images/dme.svg
RegularConnection::request for /gui/map/images/airport-unpaved.svg
RegularConnection::request for /gui/map/images/airport-paved.svg
WebsocketConnection::request for /PropertyListener
new PropertyChangeWebsocket for: /PropertyListener
httpd: addListener '/position/latitude-deg' success
WebsocketConnection::request for /PropertyListener
WebsocketConnection::request for /PropertyListener
httpd: addListener '/position/longitude-deg' success
WebsocketConnection::request for /PropertyListener
WebsocketConnection::request for /PropertyListener
httpd: addListener '/orientation/heading-deg' success
WebsocketConnection::request for /PropertyListener
WebsocketConnection::request for /PropertyListener
httpd: addListener '/velocities/groundspeed-kt' success
WebsocketConnection::request for /PropertyListener
RegularConnection::request for /gui/map/images/vor.svg
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/images/marker-icon.png
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/images/marker-shadow.png


And this from the one that does not work:
Code: Select all
RegularConnection::request for /gui/map/
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/leaflet.css
RegularConnection::request for /gui/3rdparty/jquery/jquery.min.js
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/leaflet.js
RegularConnection::request for /gui/3rdparty/flot/jquery.flot.js
RegularConnection::request for /gui/lib/props.js
RegularConnection::request for /gui/lib/jquery.flot.prop.js
RegularConnection::request for /gui/map/images/aircraft.svg
RegularConnection::request for /gui/map/images/followAircraft.svg
RegularConnection::request for /gui/3rdparty/leaflet-0.7.3/images/layers.png


It looks like there is a lot of stuff missing in the log in response to a browser refresh of the one that does not work, and the one that does work responds with some bytes (10819 in one case).
I would be very grateful if someone who knows a bit about how this works could give me a clue as to what might be wrong. I'm reluctant to copy bits of Flightgear from one system to the other without some basic understanding of what has happened. I do not think there are significant errors in the rest of the log that point to a failure in setting up the httpd system or anything else.

Regards

Mark
Last edited by Johan G on Fri Jun 26, 2015 9:17 am, edited 1 time in total.
Reason: Please use [code] tags for longer listings. They can be added manually or by using the [>_ ] button.
marksummerfield
 
Posts: 27
Joined: Mon Jun 22, 2015 2:14 pm
Location: Cheltenham, UK
Version: 2016 1.2
OS: Linux

Re: Moving map via http

Postby marksummerfield » Thu Jun 25, 2015 8:02 pm

OK its amazing how useful it is to write things in this forum - it really makes you think. The problem is solved! For anyone else who experiences the same issue with the moving map - here is the solution to my problem.

See above for the symptoms - just the default map and no aircraft movement.
On comparing files in the system that worked with the system that didn't, I noticed that in the system, that did not work the directory /usr/share/games/flightgear/webgui/3rdparty contained two directories which should have had symlinks to the system javascript files in /usr/share/javascript but did not, although the directories existed. The directories were .../3rdparty/flot and /3rdparty/jquery. I was able to see from the working system what these should be -
..../3rdparty/flot -----> /usr/share/javascript/jquery-flot
..../3rdparty/jquery -----> /usr/share/javascript/jquery .
I remade these symlinks and all worked. I think the links must have failed during the original build as it is very unlikely I would have removed them by mistake (the directories were present but the link was absent) and actually I don't know how to remove a link without deleting the directory! I guess it is possible that other people will have this issue as I have a standard build, but may not be aware of it unless they try to implement the map feature so hopefully this note will help solve the problem.
marksummerfield
 
Posts: 27
Joined: Mon Jun 22, 2015 2:14 pm
Location: Cheltenham, UK
Version: 2016 1.2
OS: Linux

Re: Moving map via http

Postby Torsten » Fri Jun 26, 2015 1:49 pm

That looks like an issue with your installer.
Those directories you mentioned actually contain files (look here: http://sourceforge.net/p/flightgear/fgd ... rty/jquery and here: http://sourceforge.net/p/flightgear/fgd ... party/flot).
I have no clue what created your symlinks on the working system.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 637
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Moving map via http

Postby marksummerfield » Mon Jun 29, 2015 1:13 pm

Thanks Torsten - just for anyone else with this problem, the software came from this repository http://ppa.launchpad.net/saiarcot895/flightgear/ubuntu and was installed through the Ubuntu software Centre. Thank you for the tip about looking in the sourceforge folders I should have thought of that, actually I just copied the files from the system that worked. Anyway all is well and the map system works perfectly.
marksummerfield
 
Posts: 27
Joined: Mon Jun 22, 2015 2:14 pm
Location: Cheltenham, UK
Version: 2016 1.2
OS: Linux


Return to Atlas

Who is online

Users browsing this forum: No registered users and 0 guests