1
0
Fork 0

Mathias Frhlich:

The moving ai models will jump around realtive to the moving aircraft model.
I can see that with the carrier but others have noticed that too with ai
aircraft before.
The reason is that all SGSystems are called with a dt value which is not
necessarily a multiple of 1/hz.
In contrast, most FDM's use the _calc_multiloop function from FGInterface
which forces the time update to be a multiple of 1/hz for the FDM aircraft.
As a result, in the worst case, the FDM aircraft has moved nearly 1/hz seconds
further than the rest of flightgear (1/120sec*300kts that is about 1.3m).
That patch forces the time update to be a multiple of 1/hz.
This commit is contained in:
ehofman 2004-11-19 12:33:08 +00:00
parent 4214cd6c10
commit 3c0ab43b43
2 changed files with 4 additions and 4 deletions

View file

@ -78,8 +78,8 @@ FGAIBase::~FGAIBase() {
}
void FGAIBase::update(double dt) {
ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()/SG_RADIANS_TO_DEGREES);
ft_per_deg_lon = 365228.16 * cos(pos.lat() / SG_RADIANS_TO_DEGREES);
ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()*SGD_DEGREES_TO_RADIANS);
ft_per_deg_lon = 365228.16 * cos(pos.lat()*SGD_DEGREES_TO_RADIANS);
// Calculate rho at altitude, using standard atmosphere
// For the temperature T and the pressure p,

View file

@ -84,9 +84,9 @@ void FGAIShip::Run(double dt) {
}
// convert speed to degrees per second
speed_north_deg_sec = cos( hdg / SG_RADIANS_TO_DEGREES )
speed_north_deg_sec = cos( hdg / SGD_RADIANS_TO_DEGREES )
* speed * 1.686 / ft_per_deg_lat;
speed_east_deg_sec = sin( hdg / SG_RADIANS_TO_DEGREES )
speed_east_deg_sec = sin( hdg / SGD_RADIANS_TO_DEGREES )
* speed * 1.686 / ft_per_deg_lon;
// set new position