Board index FlightGear Support Interfacing

Getting missile data  Topic is solved

Connecting two computers, using generic protocol, connecting with Matlab?

Getting missile data

Postby emrcnort » Mon Nov 04, 2019 9:39 pm

Hi I'm new to FG. I need GPS information of any missile launched by a fighter jet (for example f 14-b) for a simulation program I'm doing with Unity3D. I learned how to get the aircraft's GPS data with UDP packets, but i have no idea about the getting missile GPS data. Is there any way to do this?
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm

Re: Getting missile data

Postby wkitty42 » Tue Nov 05, 2019 3:06 am

that depends on how the missile is implemented... if they are using submodels, it may be as trivial as getting the location of the craft... check the ai branch of the property tree and you may find what you are looking for...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 5988
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Getting missile data

Postby Necolatis » Tue Nov 05, 2019 4:27 am

In the file Nasal/fox2.nas find this line:

# log missiles to unicsv for visualizing flightpath in Google Earth

Uncomment the first 3 logging messages following that line.

Then read this page: http://wiki.flightgear.org/Logging_properties
And log those properties. If you need to stream the data then see the link at the bottom of that page.
If you fire 2 missiles at once you will need to do logging to more than just 3 properties though, then you need to log to different properties depending on the variable me.ID as each missile fired will have a unique ID unless you reload in air.

Also if you need attitude of missile, you will need to log these also: me.pitch and me.hdg, they are both in degrees.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2047
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Getting missile data

Postby Necolatis » Tue Nov 05, 2019 4:45 am

Btw. for the other fighter jets with missile code these are the file names:

F-14: fox2.nas
F-15: fox2.nas
F-16: missile-code.nas
M2000-5: missile-code.nas
Mig21bis: guided-missiles.nas
JA37: guided-missiles.nas

They are all variants of the same code. And I think they all have those commented logging lines, else just insert them.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2047
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Getting missile data

Postby emrcnort » Tue Nov 05, 2019 6:49 pm

Necolatis wrote in Tue Nov 05, 2019 4:27 am:In the file Nasal/fox2.nas find this line:

# log missiles to unicsv for visualizing flightpath in Google Earth

Uncomment the first 3 logging messages following that line.

Then read this page: http://wiki.flightgear.org/Logging_properties
And log those properties. If you need to stream the data then see the link at the bottom of that page.
If you fire 2 missiles at once you will need to do logging to more than just 3 properties though, then you need to log to different properties depending on the variable me.ID as each missile fired will have a unique ID unless you reload in air.

Also if you need attitude of missile, you will need to log these also: me.pitch and me.hdg, they are both in degrees.


I understand that the Nasal / fox2.nas file contains the missile codes but I don't know what data should I use.
Also I can't find this line in the file:

# log missiles to unicsv for visualizing flightpath in Google Earth


You talking about a different FG version? I am using version 2.4.0
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm

Re: Getting missile data

Postby Necolatis » Tue Nov 05, 2019 7:23 pm

I am talking about latest FG version (2018.3 or 2019.1) and F-14 version 1.9
FG Version 2.4.0 must be over 10 years old.

The lines look like this:

Code: Select all
      # log missiles to unicsv for visualizing flightpath in Google Earth
      #
      #setprop("/logging/missile/latitude-deg", me.coord.lat());
      #setprop("/logging/missile/longitude-deg", me.coord.lon());
      #setprop("/logging/missile/altitude-ft", alt_ft);


And the 3 properties you then have to log/stream is:
logging/missile/latitude-deg
logging/missile/longitude-deg
logging/missile/altitude-ft

But if you use a FG thats over a decade old, I really cannot help you, as I don't even know where to download the aircraft for that old simulator.

You can get the latest simulator here (for mac and win at least): https://sourceforge.net/projects/flightgear/files/
On Linux ubuntu I think you can do this to get the package:
sudo add-apt-repository ppa:saiarcot895/flightgear
sudo apt-get update

And the latest stable F-14 from the launcher, when you start the sim, just click "add default hangar":

Image

If you want the very latest bleeding edge F-14 go to Richards Github, and choose develop branch and download:
https://github.com/Zaretto/fg-aircraft/tree/develop

Elsewise you will have to post the old fox2.nas file here, so I can take a look.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2047
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Getting missile data

Postby emrcnort » Tue Nov 05, 2019 7:52 pm

Thank you for your help. I'll update my FG version and try what I learned.
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm

Re: Getting missile data

Postby emrcnort » Mon Nov 18, 2019 11:21 pm

Necolatis wrote in Tue Nov 05, 2019 7:23 pm:The lines look like this:

Code: Select all
      # log missiles to unicsv for visualizing flightpath in Google Earth
      #
      #setprop("/logging/missile/latitude-deg", me.coord.lat());
      #setprop("/logging/missile/longitude-deg", me.coord.lon());
      #setprop("/logging/missile/altitude-ft", alt_ft);


And the 3 properties you then have to log/stream is:
logging/missile/latitude-deg
logging/missile/longitude-deg
logging/missile/altitude-ft



I have created a protocol called my-protocol.xml to getting the GPS data of the missile.
The code I wrote to get the latitude data is as follows.

Code: Select all
 
         <chunk>
           <name>latitute to go</name>
         <type>float</type>
           <format>%f</format>
         <node>logging/missile/latitude-deg</node>
         </chunk>


however, this protocol only provides GPS data at the moment the missile was fired.
I can't get GPS data along the route of the missile. Where I am making a mistake? (sorry for my bad english i hope you understand me)
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm

Re: Getting missile data

Postby Necolatis » Tue Nov 19, 2019 2:04 am

hmm, the property gets updated frequently. So something must be wrong with your protocol.

Or, maybe the property needs to be initialized to double.

Try adding this to the aircraft -set file within the PropertyTree tags:

Code: Select all
    <logging>
        <missile>
            <altitude-ft type="double">0.0</altitude-ft>
            <longitude-deg type="double">0.0</longitude-deg>
            <latitude-deg type="double">0.0</latitude-deg>
        </missile>
    </logging>
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2047
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Getting missile data

Postby emrcnort » Tue Nov 19, 2019 6:24 pm

I guess I understood the source of the error.
The missile when I fired to the target does not move. It Just staying where it is
Therefore, I am only getting GPS data of the position it was launched from.
What could be the reason why the missile didn't move?
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm

Re: Getting missile data  

Postby emrcnort » Sat Nov 23, 2019 9:30 pm

I changed the
Code: Select all
 #setprop("/logging/missile/altitude-ft", alt_ft);
part in Nasal/fox2.nas to;
Code: Select all
 #setprop("/logging/missile/altitude-ft", me.alt_ft);
and the problem has solved.
I can now get the GPS data of the Missile without any problems.
emrcnort
 
Posts: 16
Joined: Thu Oct 17, 2019 11:19 pm


Return to Interfacing

Who is online

Users browsing this forum: YandexBot [Bot] and 1 guest