GPS in FlightGear ...... but how?

classic Classic list List threaded Threaded
2 messages Options
BARANGER Emmanuel BARANGER Emmanuel
Reply | Threaded
Open this post in threaded view
|

GPS in FlightGear ...... but how?

Hello,

I think I'll look pretty silly with my questions but I try my luck ;)

The idea :

use of osgEarth in FlightGear for to have a GPS real-time directly on the panel.

Question :

1 - Is it possible to give osgEarth the coordinates, latitude and longitude of the central point of view ?

2 - can be said (for a projection plane) on which object, map projection should be done ?

3 - Can there be a zoom in the beginning. For example, the width visible on the object (20 meters or 100 meters or 2000 meters ....)

Example  :

with http://helijah.free.fr/map.png

<map name="OpenStreetMap" type="flat">
    <mapobject name="map">
    <lat value="/position/latitude-deg">         
    <lon value="/position/longitude-deg">       
    <zoom value="1000">

    <image name="OSM on Mapnik" driver="tms">
        <url>http://tile.openstreetmap.org/</url>
        <format>png</format>
        <tile_width>256</tile_width>
        <tile_height>256</tile_height>
        <tms_type>google</tms_type>
    </image>

    <north_cap_color>180 208 209 255</north_cap_color>
    <south_cap_color>255 255 255 255</south_cap_color>
</map>

This might do : http://helijah.free.fr/map2.png

of course it's missing the box containing the GPS with all its buttons and functions. But it comes later :)
You should also add the lib osgEarth used by FG. But this is not the most difficult.

But all this is too much for my modest knowledge: (If anyone here want to give a GPS that works to FG. Then he will do a lot of people happy.

Best regards. Emmanuel
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: GPS in FlightGear ...... but how?

Hi Emmanuel,

There are no silly questions, only silly answers, lets hope mine isn't too silly:)

Answers inline.


On Thu, Mar 5, 2009 at 10:09 AM, BARANGER Emmanuel (via Nabble) - No Reply <[hidden email]> wrote:
Hello,

I think I'll look pretty silly with my questions but I try my luck ;)

The idea :

use of osgEarth in FlightGear for to have a GPS real-time directly on the panel.

This would be very cool:)
 


Question :

1 - Is it possible to give osgEarth the coordinates, latitude and longitude of the central point of view ?

The scene created by osgEarth contains an osg::CoordinateSystemsNode which can be used convert geocentric coordinates to lat/lon.  You should be able to dynamic_cast the node returned by osgDB::readNodeFile to a osg::CoordinateSystemsNode* and use the methods on that CS node to go from geocentric coords to lat/lon.


2 - can be said (for a projection plane) on which object, map projection should be done ?
I believe for this case you would want to render the osgEarth scene to a texture and then texture it onto the quad.  See the osgprerender example for an example on how to do this.  Running osgprerender with a .earth file works fine and looks very cool:)
 


3 - Can there be a zoom in the beginning. For example, the width visible on the object (20 meters or 100 meters or 2000 meters ....)

I'm not sure what you are asking here.  You can control the position of the camera by setting its view matrix to whatever you want.  If you're using the osgprerender example, you can see that the osg::Camera::setViewMatrixAtLookAt is used to position the camera.  You can use whatever values you need to provide the effect you are looking for.
 


Example  :

with http://helijah.free.fr/map.png

<map name="OpenStreetMap" type="flat">
 

   


Good luck!

Let us know if you have any more questions.

Jason