Browse Source

SITL: added a SIM_GPS_HZ option

this allows simulation of slow GPS updates (for example, the 1Hz GPS
problem)
mission-4.1.18
Andrew Tridgell 12 years ago
parent
commit
42bc8b12df
  1. 2
      libraries/AP_HAL_AVR_SITL/sitl_gps.cpp
  2. 1
      libraries/SITL/SITL.cpp
  3. 1
      libraries/SITL/SITL.h

2
libraries/AP_HAL_AVR_SITL/sitl_gps.cpp

@ -531,7 +531,7 @@ void SITL_State::_update_gps(double latitude, double longitude, float altitude, @@ -531,7 +531,7 @@ void SITL_State::_update_gps(double latitude, double longitude, float altitude,
Vector3f glitch_offsets = _sitl->gps_glitch;
// 5Hz, to match the real config in APM
if (hal.scheduler->millis() - gps_state.last_update < 200) {
if (hal.scheduler->millis() - gps_state.last_update < 1000/_sitl->gps_hertz) {
return;
}

1
libraries/SITL/SITL.cpp

@ -43,6 +43,7 @@ const AP_Param::GroupInfo SITL::var_info[] PROGMEM = { @@ -43,6 +43,7 @@ const AP_Param::GroupInfo SITL::var_info[] PROGMEM = {
AP_GROUPINFO("MAG_ERROR", 15, SITL, mag_error, 0),
AP_GROUPINFO("SERVO_RATE", 16, SITL, servo_rate, 0),
AP_GROUPINFO("GPS_GLITCH", 17, SITL, gps_glitch, 0),
AP_GROUPINFO("GPS_HZ", 18, SITL, gps_hertz, 5),
AP_GROUPEND
};

1
libraries/SITL/SITL.h

@ -62,6 +62,7 @@ public: @@ -62,6 +62,7 @@ public:
AP_Int8 gps_type; // see enum GPSType
AP_Float gps_byteloss;// byte loss as a percent
AP_Int8 gps_numsats; // number of visible satellites
AP_Int8 gps_hertz; // GPS update rate in Hz
AP_Vector3f gps_glitch; // glitch offsets in lat, lon and altitude
// wind control

Loading…
Cancel
Save