Board index FlightGear Development AI Traffic

Populate AI Traffic with real traffic

Intelligent, computer controlled vehicles that drive/fly over the planet!

Re: Populate AI Traffic with real traffic

Postby wlbragg » Mon Oct 15, 2012 5:48 pm

Yes Hooray, I understand, we need to taxi before we fly.
I think that it is a crucial piece, maybe crucial enough to some to cause doubt if not resolved.
Just multitasking! Sorry my two cents worth were out of order.
Carry on, I'll leave it alone and think about it. If the time comes maybe I can provide solutions.

As far as F-JJTH is concerned, I feel the pain. No answers here! It's a lot to absorb for someone new to c let alone the entire fg system. But you guy's certainly have the skill to help em get it done.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Populate AI Traffic with real traffic

Postby Hooray » Mon Oct 15, 2012 5:59 pm

I think that it is a crucial piece, maybe crucial enough to some to cause doubt if not resolved.

not sure about it - personally, I don't mind it being an "airborne traffic"-only system in the beginning, which would already be a huge improvement.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby wlbragg » Mon Oct 15, 2012 6:28 pm

Agreed!
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Populate AI Traffic with real traffic

Postby polly » Mon Oct 15, 2012 6:45 pm

And how much 'airborne' traffic do we usually see, looking out of the window on an eight hour flight, compared with how many planes we see in the fifteen minutes or so between push-back and roll ?
As far as I can remember, AI models already have the facility to drop the gear and pitch up when certain airspeeds and altitudes are met; maybe the right approach is to let the transmitted data stay as lean as possible and let the local models look after such detail.
User avatar
polly
 
Posts: 956
Joined: Thu Nov 04, 2010 3:45 pm

Re: Populate AI Traffic with real traffic

Postby F-JJTH » Mon Oct 15, 2012 9:49 pm

After some paper reading and a little bit a lot of patience I'm able to do something with FGMS.
Finally I have clone FGMS because I think that my work is just an "add-on" for FGMS and if FGMS author is interested he could be merge it.

@Hooray & stuart : you have commiter right on it, you can have a look at it here : https://gitorious.org/~f-jjth/fgms/f-jjths-fgms-0-x

Another "problem" that I have no idea how to solve it is the "out of range" limit :
- When a new client is connected I can know his position (I don't know the format... is it x=46.01548, y=2.2154, z=556.21 format ? or lat=46.25, long=6.40, alt=6500 format ? )
- The provider send lat=46.25, long=6.40, alt=6500 format
The question is : How can I know the limit of min-lat/max-lat, min-long/max-long distance for 100nm ? For example :

Image

How to know the lat and long of A and C point ? I need it in order to send only AI traffic in area of the client.

Do you have an idea ?
User avatar
F-JJTH
 
Posts: 696
Joined: Fri Sep 09, 2011 12:02 pm

Re: Populate AI Traffic with real traffic

Postby Hooray » Mon Oct 15, 2012 9:56 pm

I suggest to have a look at https://gitorious.org/fgms/fgms-0-x/blo ... ometry.cxx
Also, SimGear has spatial data structures to deal with the problem of finding all 3D positions within a certain range.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby Hooray » Mon Oct 15, 2012 11:51 pm

F-JJTH wrote in Mon Oct 15, 2012 9:49 pm:(I don't know the format... is it x=46.01548, y=2.2154, z=556.21 format ? or lat=46.25, long=6.40, alt=6500 format ? )


I think you are making this more difficult than it needs to be, this is also already done by fgms, just see: https://gitorious.org/fgms/fgms-0-x/blo ... xx#line546 to learn how to access the player's current lat/lon/alt fields.

So, it's really just:
  • PlayerPosGeod[Lat]
  • PlayerPosGeod[Lon]
  • PlayerPosGeod[Alt]

To learn more about how the PlayerPosGeod is computed, just search for "PlayerPosGeod" in fg_server.cxx (sgCartToGeod).

To see how it's used in fgms to drop "out of range" players, see: https://gitorious.org/fgms/fgms-0-x/blo ... x#line1459
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby wlbragg » Tue Oct 16, 2012 2:30 am

I'm not sure how much this helps you but the distance of nm to lat/long can be found here http://www.coastalnavigation.com/samples/sec_1/1_pages/1_2.htm.
I already computed the straight line distant in nm of 100lat and 100long from client (a and c) and it is about 141 nm.

EDIT:
141.42135
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Populate AI Traffic with real traffic

Postby Hooray » Tue Oct 16, 2012 11:15 am

This sort of thing is already done by the previously mentioned SimGear sources, which are based on: http://williams.best.vwh.net/avform.htm
So there's really no need to re-write any code here - the C++ routines in the geometry helpers do exactly that.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby stuart » Tue Oct 16, 2012 12:54 pm

Hi Guys,

I've been out for a couple of days. Great to see so much progress!

One comment winding all the way back to the architecture discussion: I'm not convinced that adding this as an additional feature to the fgms is necessarily the right way forward. Rather, I'd suggest that it should be a specialized FGAIS server (based heavily on the fgms code itself) that connects to the other FGMS servers as a relay (so it receives all player positions), but doesn't have any local clients connected. To my eyes, this has a couple of advantages:
- Keeps the core fgms code nice and clean. The fgais server will be at most a singletone in any MP network, while there may be >10 FGMS instances.
- Take advantage of a (fairly) sensible interface into the rest of the FGMP network. The actual MP protocol is extremely unlikely to change, particularly at the level we are interested in.
- You can rip out a lot of redundant relay transmission code, simplifying the code massively.
- No performance/capacity concerns. This might be a big issue, as unless you want to faff around with threads, there's a big risk that the FGMS server will stop processing player positions for quite some time while it makes and processes the JSON request every 10 seconds.

On a different note, to avoid having to calculate the distance between every aircraft in the JSON request and the MP players, I'd suggest having a big boolean two-dimensional array indexed by integer lat/lon. This can then be populated when player position information is received, setting the 9 lat/lon positions around the player to catch aircraft right at the edge of a lat/long square. Then, when you make a JSON request, you can simply discard all aircraft that aren't within the populated array. After processing the JSON request, the array can be reset, as player positions are transmitted much more regularly than you would make a JSON request. Pretty simple.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1629
Joined: Wed Nov 29, 2006 10:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Populate AI Traffic with real traffic

Postby Hooray » Tue Oct 16, 2012 1:13 pm

Like I mentioned earlier, I fully agree with the architecture that you suggest, i.e. "fgais" should work like a "fgms relay". The idea was never to run FGAIS and FGMS in the process.

However, I am not sure if adding it as a separate "fork"/code base is a good idea: fgms (and the whole MP network) is really only being maintained by very few developers. Also, the fgms code base is far from being "nice and clean" - in other words, it would make sense that the fgms maintainer also maintain the "fgais" feature, which could be ensured by adding it as a "mode" to the main code base. Unless of course anybody here volunteers to maintain FGAIS despite all of this.
Personally, I am convinced that a special type of relay server is ideally maintained by the fgms maintainers, too.

Regarding your capacity/performance concerns: This could also be addressed without any threading, just by forking fgms in a separate "FGAIS" mode, so that the "FGAIS" part of the code runs in a separate process. Which is something already supported by the fgms code base.

That said, I fully agree that most of the fgms code wouldn't be required just for an FGAIS relay server.
Now, as to the "big boolean 3x3 grid array indexed by lat/lon", that sounds like a feasible simplifcation to deal with the problem, even without introducing spatial data structures like octrees.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby F-JJTH » Tue Oct 16, 2012 3:09 pm

To be honset I don't understand what kind of architecture you want...
The problem with relay is that FGMS is only able to relay MP traffic and not AI traffic.
User avatar
F-JJTH
 
Posts: 696
Joined: Fri Sep 09, 2011 12:02 pm

Re: Populate AI Traffic with real traffic

Postby Hooray » Tue Oct 16, 2012 6:38 pm

To fgms it really doesn't matter, as long as "fgais" behaves like a valid "relay server", it really doesn't care where the traffic is coming from, so it will deal with the fgais traffic like conventional "multiplayer" traffic, without being aware of its origin/source - and it won't matter at all.

Now, as to filtering/marking, fgais traffic - that would be a separate issue. But overall, the powerful idea is that fgais acts like a conventional fgms relay server - so that our fgms network considers it just another fgms instance, even though it really injects data from web/json feeds.

We need to stop thinking in terms of "AI traffic" here: the AI system has *nothing* to do with it, it's really multiplayer traffic that comes from a different source, i.e. not other fgfs client, but instead web feeds. And the AI/MP systems don't care about it, because they internally leverage each other anyhow.

Again: Let's try to walk before we run - personally, I wouldn't mind seeing thousands of multiplayer clients being injected by fgais into the fgais network, we can optimize things once the basic idea is working.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby F-JJTH » Tue Oct 16, 2012 8:53 pm

I continue to add FGAIS feature into FGMS in order to setup FGMS as relay server but I have a problem with Cmake compilation.

Code: Select all
clement@clement-desktop ~/dev_fgfs/fgms/build $ cmake ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- *** set CXX FLAGS [ -Wall  -D_REENTRANT] C FLAGS [ -Wall  -D_REENTRANT]
-- *** Building static library STATIC
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- *** target_link_libraries( fgms -lfg_server;-lMultiPlayer;-lPlib;-lSGdebug;-lpthread )
-- *** Will install binary to /usr/local/sbin
-- *** Will read config from /usr/local/etc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/clement/dev_fgfs/fgms/build
clement@clement-desktop ~/dev_fgfs/fgms/build $ make
Scanning dependencies of target MultiPlayer
[ 10%] Building CXX object CMakeFiles/MultiPlayer.dir/src/flightgear/MultiPlayer/tiny_xdr.cxx.o
Linking CXX static library libMultiPlayer.a
[ 10%] Built target MultiPlayer
Scanning dependencies of target Plib
[ 20%] Building CXX object CMakeFiles/Plib.dir/src/plib/netSocket.cxx.o
Linking CXX static library libPlib.a
[ 20%] Built target Plib
Scanning dependencies of target SGdebug
[ 30%] Building CXX object CMakeFiles/SGdebug.dir/src/simgear/debug/logstream.cxx.o
Linking CXX static library libSGdebug.a
[ 30%] Built target SGdebug
Scanning dependencies of target fg_server
[ 40%] Building CXX object CMakeFiles/fg_server.dir/src/server/fg_server.cxx.o
[ 50%] Building CXX object CMakeFiles/fg_server.dir/src/server/fg_tracker.cxx.o
[ 60%] Building CXX object CMakeFiles/fg_server.dir/src/server/fg_config.cxx.o
[ 70%] Building CXX object CMakeFiles/fg_server.dir/src/server/fg_player.cxx.o
[ 80%] Building CXX object CMakeFiles/fg_server.dir/src/server/daemon.cxx.o
[ 90%] Building CXX object CMakeFiles/fg_server.dir/src/server/fg_geometry.cxx.o
Linking CXX static library libfg_server.a
[ 90%] Built target fg_server
Scanning dependencies of target fgms
[100%] Building CXX object CMakeFiles/fgms.dir/src/server/main.cxx.o
Linking CXX executable fgms
./libfg_server.a(fg_server.cxx.o): In function `receiveAircraftJson(double, double)':
fg_server.cxx:(.text+0x1e9): undefined reference to `curl_easy_init'
fg_server.cxx:(.text+0x233): undefined reference to `curl_easy_setopt'
fg_server.cxx:(.text+0x25a): undefined reference to `curl_easy_setopt'
fg_server.cxx:(.text+0x266): undefined reference to `curl_easy_perform'
fg_server.cxx:(.text+0x279): undefined reference to `curl_easy_strerror'
fg_server.cxx:(.text+0x2a1): undefined reference to `curl_easy_cleanup'
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [fgms] Erreur 1
make[1]: *** [CMakeFiles/fgms.dir/all] Erreur 2
make: *** [all] Erreur 2


As you can see it seems that curl is badly defined, but cmake command is clear : Found CURL
I don't know why cmake say that CURL is correctly found but make say that curl references are undefined...

Who is able to give me the solution ?

Here is my last commit : https://gitorious.org/~f-jjth/fgms/f-jj ... 79cd91bdfe

Cheers,
Clément
User avatar
F-JJTH
 
Posts: 696
Joined: Fri Sep 09, 2011 12:02 pm

Re: Populate AI Traffic with real traffic

Postby Hooray » Tue Oct 16, 2012 8:58 pm

I am sure we can get that sorted, but why exactly do you want to use curl here?
Do you have any finished code that uses curl already?
Otherwise, the SimGear HTTPRequest class could be used just as well.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

PreviousNext

Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 2 guests