Jump to content
The simFlight Network Forums

GauWin

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by GauWin

  1. Ok so my structure should look like


    typedef struct Plane
    {
    int pitch;
    int head;
    int bank;

    double lat;

    double log;

    double alt;
    } Plane;
    [/CODE]

    long long or double for altitude, longitude and latitude ?

    And if I use long long (my compiler can) how can I convert double in long long ?

    Sorry but I do not understand everything I'm a beginner ...

    Thank you so mutch for all,

    Rémi

  2. Instead of all those separate FSUIPC_Writes (which will all be processed separately in FSUIPC!), make a structure for all 6 values, set up your structure, then write it all with one (1) FSUIPC_Write of 36 bytes. Otherwise each separate write is making a change in FSX. All the vlaues need to be written at once, in one structure.

    I receive a structure with my socket, but how to write the FSUIPC_Write() ? With what offset ?

    Have you any documentation for your compiler or the language?

    Yes, but I can not translate everything. I use C for this work.

    You think the conversion (altitude,latitude,longitude) are correct ? or not optimized ?

    Thank you very much for your help

  3. My code


    double longitude;
    double latitude;
    double altitude;

    int intLogB=0;
    int intLogH=0;
    double logB=0;
    double logH=0;


    int intLatB=0;
    int intLatH=0;
    double latB=0;
    double latH=0;


    int intAltH=0;
    int intAltB=0;
    double doubleAltH=0;
    double doubleAltB=0;
    double doubleAlt=0;



    //Calcul altitude
    doubleAltB=modf(doubleAlt,&doubleAltH);
    intAltH=doubleAltH;
    doubleAltB=doubleAltB*1000;
    intAltB=doubleAltB;
    //intAltB=5;

    //Calculs longitude
    longitude=longitude/(360.0/(65536.0 * 65536.0));
    logB=modf(longitude,&logH);
    logB=logB*(65536.0*65536.0);

    v=modf(logB,&logB);

    intLogB=logB;
    intLogH=logH;

    //Calculs latitude
    latitude=latitude/(90.0/10001750.0);
    latB=modf(latitude,&latH);
    latB=latB*(65536.0*65536.0);

    v=modf(latB,&latB);

    intLatB=latB;
    intLatH=latH;

    ( ... )

    //Angles
    FSUIPC_Write(0x0578,4,&intPitch,&dwResult);
    FSUIPC_Write(0x057C,4,&intBank,&dwResult);
    FSUIPC_Write(0x0580,4,&intHead,&dwResult);

    //Latitude
    FSUIPC_Write(0x0560,4,&intLatB,&dwResult);
    FSUIPC_Write(0x0564,4,&intLatH,&dwResult);

    //Longitude
    FSUIPC_Write(0x056C,4,&intLogH,&dwResult);
    FSUIPC_Write(0x0568,4,&intLogB,&dwResult);

    //Altitude
    FSUIPC_Write(0x0570,4,&intAltB,&dwResult);
    FSUIPC_Write(0x0574,4,&intAltH,&dwResult);

    FSUIPC_Process(&dwResult);
    [/CODE]

    You should try to equal the frame rate of FS, otherwise it will certainly be jerky.

    I think I have solved this problem. But when I fly near the ground I see the plane moving from left to right in jerking. So I think the latitude, altitude and longitude are the problem.

    And in any case you should write this as one 8-byte integer. If your compiler doesn't support "long long" or 2_int64" types (64-bit integers), the make the one 64-bit value with a two DWORD array.

    Sorry but i don't understand everything, can you give me an example?

    Thank you for your help,

    Rémi

  4. Hi Pete

    Sorry for my bad English, i'm a young French student in computer science.

    I use FSUIPC for my professional training, indeed i have to replace the old visualization program of a flight simulator (FlightGear) by Flight Simulator X.

    For this work I use 2 Thread. The first thread receives data through a socket and the second write with FSUIPC.

    The server converts data and send this one with the socket.

    I use 32-bit PC and i have little problem of fluidity image. I think it's because of conversion.

    Example of latitude :


    int intLatB=0;
    int intLatH=0;
    double latB=0;
    double latH=0;
    double latitude;

    // --------------------------------------------------------------------------------

    latitude=latitude/(90.0/10001750.0);
    latB=modf(latitude,&latH);
    latB=latB*(65536.0*65536.0);

    v=modf(latB,&latB);

    intLatB=latB;
    intLatH=latH;

    ( ... )

    //Latitude
    FSUIPC_Write(0x0560,4,&intLatB,&dwResult);
    FSUIPC_Write(0x0564,4,&intLatH,&dwResult);

    // --------------------------------------------------------------------------------
    [/CODE]

    This is correct? Or you have another idea?

    Thank you in advance for your help and sorry again for my very bad English.

    Regards,

    Rémi

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.