Posted by Jason Short on December 27, 2009 at 3:00pm
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
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.
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.
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
That's exactly right. The gps is not used at all. Home position from the config tool is used instead. The whole point is that, as missions and modes get more complex, you'll need to debug them. All of the other debugging functions have moved into the Airframe tester.
BTW, if you try this today, the servo output is enabled. Let me know if that is desirable or should I set this up more like REM sleep.
Comments
#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.
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(",***");
}
Serial.print(current_loc.lat/10,DEC);
Can print commands do math internally?
Look in the print function and add
current_loc.lat/10
BTW, if you try this today, the servo output is enabled. Let me know if that is desirable or should I set this up more like REM sleep.
-
1
-
2
of 2 Next