Developer

Ardupilot 2.5 preview part 6

New in Ardupilot 2.5 is mission simulation/debugging. First load a mission using the config tool and make sure you select "Set Manually" in the home info area on the left.Then, in the header, set the value of Debug to 1 and upload 2.5. The mission will begin as if it's already in the air and will start outputting telemetry. If everything is OK, the plane should make each waypoint and end up back at home in a Loiter pattern.This is also a 3d simulator, so altitude will be monitored as well. In future releases, specific waypoints can have altitude requirements to meet before the plane can move to the next WP.Tweaking the SimThere are two values to make the simulation more realistic for your plane. First is turn rate. This is a basic value that indicates how fast your plan turns. Higher values means faster turning. The idea is that at 90° the plane will turn 55° per second. This isn't realistic, but if you know how fast your plane will turn at thirty degrees you can just multiply that x3 and you'll have a good value.est_turn_rate = (roll_sensor * TURNRATE * (long)deltaMiliSeconds) / 90L;The next values are#define CLIMBRATE_UP 1000 // (meters * 100) how fast we climb in simulator at 90°#define CLIMBRATE_DOWN 3000 // (meters * 100) how fast we drop in simulator at 90°Again, these values are just to make the math easy for me ;) Adjust to suit the rate of climb for your plane.Ok, that's it!Jason
E-mail me when people leave their comments –

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

Join diydrones

Comments

  • 3D Robotics
    Excellent! Works fine now.
  • Developer
    the SVN uploaded swept up a minor change to the climbrate defines. In Easystar.h there is now:

    #define CLIMBRATE_UP 1000 // (meters * 100) how fast we climb in simulator at 90°
    #define CLIMBRATE_DOWN 3000 // (meters * 100) how fast we climb in simulator at 90°

    navigation.pde has now been updated as well to use these new defines.
  • 3D Robotics
    I see my mistake. There are several print sections, depending on which groundstation setting you select. I was changing the wrong one. BTW, there is now a compile error in your latest fix: "CLIMBRATE" not declared in navigation function.
  • Developer
    I uploaded the fix to the SVN.
  • Developer
    Strange,
    I'm doing it for the other values as well.
    {                        Serial.print("!!!");
    Serial.print("LAT:");
    Serial.print(current_loc.lat/10,DEC);
    Serial.print(",LON:");
    Serial.print(current_loc.lng/10,DEC); //wp_current_lat
    Serial.print(",SPD:");
    Serial.print(ground_speed/100,DEC);
    Serial.print(",CRT:");
    Serial.print(climb_rate,DEC);
    Serial.print(",ALT:");
    Serial.print(get_altitude_above_home()/100,DEC);
    Serial.print(",ALH:");
    Serial.print(next_WP.alt/100,DEC);
    Serial.print(",CRS:");
    Serial.print(ground_course/100,DEC);
    Serial.print(",BER:");
    Serial.print(target_bearing/100,DEC);
    Serial.print(",WPN:");
    Serial.print(wp_index,DEC);//Actually is the waypoint.
    Serial.print(",DST:");
    Serial.print(wp_distance,DEC);
    Serial.print(",BTV:");
    Serial.print(battery_voltage,DEC);
    Serial.print(",RSP:");
    Serial.print(roll,DEC);
    Serial.println(",***");
    }
  • 3D Robotics
    Hmm. That didn't do it. I modified to:

    Serial.print(current_loc.lat/10,DEC);

    Can print commands do math internally?
  • Developer
    Ah, I run the internal representation at 10x for higher accuracy. That's how I can run the sim inside the ardupilot. I'll divide by 10 before I output to the GS.
    Look in the print function and add
    current_loc.lat/10
  • 3D Robotics
    Jason, is there something funky going on with the GPS output? Here's what I'm getting in the GCS when I run 2.5 in sim mode.

  • Admin
    Yep , I guess the servo output enabled will be good both for airframe R& D and safety check possibly. I guess for the safety reason either the throttle out should be disable physically( disconnecting the motor) or through soft option during simulation.
  • 3D Robotics
    I like the idea of servo output enabled. Makes for good airframe testing...
This reply was deleted.