Atlas First Run - FG(3)

FG Index -|- ATLAS Index -|- End

Atlas is next!

Here is its HELP page, in code ;=)) -
void print_help() {
printf("ATLAS - A map browsing utility for FlightGear\n\nUsage:\n");
printf(" --lat=x Start browsing at latitude xx (deg. south i neg.)\n");
printf(" --lon=x Start browsing at longitude xx (deg. west i neg.)\n");
printf(" --airport=icao Start browsing at an airport specified by ICAO code icao\n");
printf(" --path=xxx Set path for map images\n");
printf(" --fg-root=path Overrides FG_ROOT environment variable\n");
printf(" --glutfonts Use GLUT bitmap fonts (fast for software rendering)\n");
printf(" --geometry=[width]x[height] Set initial window size\n");
printf(" --softcursor Draw mouse cursor using OpenGL (for fullscreen Voodoo cards)\n\n");
printf(" --udp=x Input read from UDP socket at specified port (defaults to 5500)\n");
printf(" --serial=dev Input read from serial port with specified device\n");
printf(" --baud=x Set serial port baud rate (defaults to 4800)\n");}

Reading through this help suggests my command line should be -
--fg-root=C:\FG098\FlightGear\data --airport=YSSY
Try it and see ... remember, this is using a GL (glut) window, thus, while you can 'initially' place a debug trap in the 'main' CONSOLE function, you will probably also need to trap in the GL CALLBACKS, like in say the glutKeyboardFunc callback, 'keyPressed', or others ... I have not decided on the 'protocol' to use to get the position information from FlightGear ...

I quickly trace through to the warning -
Warning: path C:\FG098\FlightGear\data/Atlas/ doesn't exist. Maps won't be loaded!
Ok, I know where it is looking ... of course, I should run Map first, in 'atlas' mode, to get my 'Sydney' png files in this folder ... but I continue on, running the application, and am rewarded with an 'interesting' display ... lots of information ... missing the 'fabric' of the earth, the terrain, but still a great first image ... of YSSY, Sydney International ...


Ok, but I want to 'see' the terrain ... 

Wow, while 'playing', I found a big bug in GL windows, or maybe GL API code - After I iconised the above gl window, I could not get the 'window' to re-appear ... when I clicked on it on the status line, I got nothing ... the CONSOLE window correctly 'opens' and 'closes', but the GL window is 'stuck' iconised, or at least no re-paint ... at one stage I had to use 'kill atlas process' to get back XP control ... hmm ... must remember to look into this further ... at some time ;=(( to try to repeat the 'freeze' ...

But I want to get the 'moving' part working, as well, so must consider how to 'communicate' between running FlightGear, and Atlas ... I look at what it has set up, as the default 'protocol' ... but on the next trace, I 'see' what it is trying to find ... the code has been commented out -
//printf("Loading tile %s...\n", mpath);, and in this instance the mpath is -
+ mpath 0x003f5e5c "C:\FG098\FlightGear\data/Atlas/e150s35.png"
It is clear that I should go back to, and get the Map utility to generate these ... but, an 'idea', why not get map to 'generate' the needed 1x1 'map_tile' on the fly? I only need to call it with a command line of --lon=150.0 --lat=-35.0 --fg-root=C:\FG098\FlightGear\data --fg-scenery=C:\FG098\FlightGear\data --enable-airports --output=C:\FG098\FlightGear\data/Atlas/e150s35.png, and I have the png ... add some code ;=))

While 'experimenting' with MapBrowser.cxx, I drop the following 'switched' block, before anything else ...
#ifdef MSVC6
#pragma warning( disable:4786 ) // debug truncation of label - non event!
#pragma warning( disable:4800 ) // unsigned int forcing value to bool
#endif // #ifdef MSVC6
so I can get a 'clean' build ...
atlas.exe - 0 error(s), 0 warning(s)
a nice feeling ...

In reading through Map.cxx, the only 'bits' required are some gl (glut) setup in end of 'main', and 'reshapMap', and 'redrawMap', and some 'global' setup variables ... is this a class or not ... ;=)) Decide on AtlasMap ... but getting TWO GL windows running using the GL (glut) API, turns out to be 'big trouble' ;=)) The window 'create' function does give back a window number, and it seems you could have code to 'ensure' the common API was output to the correct 'context' ... aside from the 'massive' problem of getting back 'control' after the never-to-return glutMainLoop(); call ...

Add to that the fact that, in Atlas, you are on a GL callback, when you discover that you do not have the 'appropriate' map tiles generated yet, and this is decidedly NOT a good time to open another window for rendering, to be able to 'write' the png file ... It is far, far easier to run Map, separately, with say 'atlas=C:/FG098/FlightGear/data/Atlas' ... In running Map and Atlas many times I add some code the 'create' the 'Atlas' folder, on the fly ...

Now I have a 'great' set of files in data/Atlas, like -
17/01/2005 09:04 PM 9,035 e140s31.png
17/01/2005 09:05 PM 7,875 e140s32.png
17/01/2005 09:05 PM 19,643 e140s33.png
... and onwards, until ...
17/01/2005 10:00 PM 869 e158s22.png
17/01/2005 10:10 PM 3,704 e159s32.png
17/01/2005 10:11 PM 98,864 w122n37.png
17/01/2005 10:11 PM 55,000 w123n37.png
some 154 files 4 MB ... that is, with only the default SFO (w130n30), and 3 Australian (10x10) 'chunks' of e140s40, e150s30, e150s40 ...

I run Atlas, and am rewarded with a fantastic image -

A bit 'confused', but beautiful ... I ran the Map tool 'set' at one scale, then re-mapped just the Sydney Map tile (e151s32) ... but this is great ... the FlightGear vector data, has been converted to a 'visual' .. (FG)BGL->png->GL(display). Must go back and re-map for a while ... ;=))

That should be enough to get Atlas flying along with FlightGear ... so time to consider, what one-machine, process to process communications protocol I should/can use? Can I use UDP sockets? Let's try ...

Have run into problems getting FlightGear to open a udp socket ... at present FG aborts, with 'can not open' errors ... ok, that was just getting the command options 'exactly' correct ... this worked -
... now to get Atlas to 'read' the socket data ... and display the map-tiles prepared ... I note that FG aborts if my ADSL modem is off ... not sure why ... I want it all run in-one-machine ... why does the LAN have to be 'active' ... on the positive side, I note the LINK light flashes when FG is running, which seems to indicate some 'packets' (user datagram, actually) are being 'broadcast' ... All I should need to do is run Atlas ...

So I run FlightGear, with the command line -
Debug\FlightGear.exe --aircraft=ufo --fg-root=c:\FG098\FlightGear\data --airport=YSSY but remember, I have a 'lot' of other options 'set' in  c:\FG098\FlightGear\data\system.fgfsrc, given below ...
note the '--atlas=socket,out,5,<broadcast>,5500,udp' bit ;=))

Then run Atlas in the MSVC7 IDE ... Command Arguments:
--fg-root=c:\FG098\FlightGear\data --airport=YSSY --udp=5500

It worked perfectly!
The FlightGear-Atlas combination communicated!
I 'flew' the ufo from Sydney,
up to Newcastle and back,
just using the 'view' in Atlas
Thank you to the creators, and maintainers.

Some things to look at -
- The 'change' I did in glut.h, to get the compile, came back to bite ... no exit() ... have now 'fixed' this ...
- The movement of the map was 'jerky'. Probably something to do with the '5' parameter ...
- Regenerate, and try other map scales, text ... the text 'seemed' too large ...
- If you zoom out in Atlas, the grid text becomes 'too busy' ... reduce text output if zoomed out ...

*** to be continued ***
under construction

FG Index -|- ATLAS Index -|- Top -|- End

FlightGear Options -
There are soooo many wonderful options, I generally use a system.fgfsrc file, in the fg-root folder ... below is a copy of one of my 'test' scenarios. One recent 'problem' encountered, is, if the 'aircraft', is not given on the command line, by the time the syste.fgfsrc is read, if that aircraft has 'no panel' (yet ;=))), then the c172 panel remains ... blocking the view, so to speak ...

# system.fgfsrc
# set TIME
#// Atlas.cxx - in FG to output ...
#char port[256] = "5500";

# set aircraft/FDM to run
### presently MUST be put on the command line --aircraft=ufo
###later --aircraft=dhc2F
# set airport - KSFO default

# log-level order = debug info warn alert


# in metres

### not-needed --disable-clouds3d
# does NOT work for markers !!!
# effect?


Previous -|- FG Index -|- ATLAS Index -|- Top -|- End -|- Next

checked by tidy  Valid HTML 4.01 Transitional