SITL: added SIM_RATE_HZ

this allows the physics step size to be changed while flying the
internal models, which allows for lower CPU usage
This commit is contained in:
Andrew Tridgell 2020-06-03 14:34:23 +10:00
parent 43bef1ac9e
commit e4596efe9b
3 changed files with 6 additions and 0 deletions

View File

@ -598,6 +598,9 @@ void Aircraft::update_dynamics(const Vector3f &rot_accel)
}
}
}
// allow for changes in physics step
adjust_frame_time(constrain_float(sitl->loop_rate_hz, rate_hz-1, rate_hz+1));
}
/*

View File

@ -257,6 +257,8 @@ const AP_Param::GroupInfo SITL::var_info3[] = {
// vicon velocity glitch in NED frame
AP_GROUPINFO("VICON_VGLI", 21, SITL, vicon_vel_glitch, 0),
AP_GROUPINFO("RATE_HZ", 22, SITL, loop_rate_hz, 1200),
AP_GROUPEND
};

View File

@ -194,6 +194,7 @@ public:
AP_Float mag_scaling; // scaling factor on first compasses
AP_Int32 mag_devid[MAX_CONNECTED_MAGS]; // Mag devid
AP_Float buoyancy; // submarine buoyancy in Newtons
AP_Int16 loop_rate_hz;
// EFI type
enum EFIType {