1. I downloaded ArduPilotMega_1_0_1.zip and GPS_IMU.zip to use 

 

#include <GPS_IMU.h>  // ArduPilot IMU/XPLANE GPS Library

 

and

 

#define GPS_PROTOCOL  3

 

The compile was successful.

 

 

2. I downloaded Flightgear 1.9.1b,  and copy xml protocol file into

 

C:\Program Files\FlightGear\data\Protocol

 

and I made BAT file to easy execution as follows.

 

"C:\Program Files\FlightGear\bin\Win32\fgfs" --fg-root="C:\Program Files\FlightGear\data" --generic=socket,out,50,127.0.0.1,49005,udp,ardupilot --generic=socket,in,50,127.0.0.1,49000,tcp,ardupilot --in-air --altitude=3 --vc=90 --heading=300 --timeofday=noon

 

3. Starting Flightgear, after that I started Ardupilotsim.

 

 

However problems are...

 

1. Which flightmode is recommended to perform HILS? If I choose manual mode when ardupilot turned on, ardupilot performs ground initialization process which costs lots of time.

 

2. Rudder isn't controllable. See GCS_Xplane.pde file. There is no rudder packet!

 

void output_Xplane(void)
{
 // output real-time sensor data
 Serial.print("AAA");          //   Message preamble
 output_int((int)(servo_out[CH_ROLL]*100));   //  0 bytes 0,1
 output_int((int)(servo_out[CH_PITCH]*100));   //  1 bytes 2,3
 output_int((int)(servo_out[CH_THROTTLE]/1.25));  //  2 bytes 4,5
 output_int((int)wp_distance);      //  3 bytes 6,7
 output_int((int)bearing_error);      //  4 bytes 8,9
 output_int((int)loiter_sum);     //  5 bytes 10,11
 output_int((int)loiter_total);      //  6 bytes 12,13
 output_byte(wp_index);        //  7 bytes 14
 output_byte(control_mode);       //  8 bytes 15

 // print out the buffer and checksum
 // ---------------------------------
 print_buffer();
}

 

3. Finally, I couldn't perform simulation experiment with this document (http://code.google.com/p/ardupilot-mega/wiki/FlightGear)

 

More information is needed.

 

4. I couldn't do anything with Xplane. GUI in (http://code.google.com/p/ardupilot-mega/wiki/Xplane) is different from current version of Xplane.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • http://code.google.com/p/ardupilot/wiki/FlightSim <= this is more great tutorial.

    Ardupilot mega's page should be updated.

    void output_Xplane(void)
    {
    // output real-time sensor data
    Serial.print("AAA"); // Message preamble
    output_int((int)(servo_out[CH_ROLL]*100)); // 0 bytes 0,1
    output_int((int)(servo_out[CH_PITCH]*100)); // 1 bytes 2,3
    output_int((int)(servo_out[CH_THROTTLE]/1.25)); // 2 bytes 4,5

    #if CH4_RUDDER == 1
    output_int((int)(servo_out[CH_RUDDER]*100)); // 3 bytes 6,7
    #else
    output_int(0); // 3 bytes 6,7
    #endif

    output_int((int)wp_distance); // 4 bytes 8,9
    output_int((int)bearing_error); // 5 bytes 10,11
    output_int((int)altitude_error); // 6 bytes 12,13
    output_int((int)energy_error); // 7 bytes 14,15
    output_byte(wp_index); // 8 bytes 16
    output_byte(control_mode); // 9 bytes 17

    // print out the buffer and checksum
    // ---------------------------------
    print_buffer();
    }
This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…