Hi Erik, I think we can go there step by step. And I have several additional patches floating around here which might be worth anyway.
ai-jump-fix.diff: 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. carrier-controls.diff: Add some controls required for carrier operations: /controls/gear/launchbar should be 1.0 if the launchbar is lowered, that means the aircraft should now be arrested at the catapult. /controls/gear/catapult-launch-cmd Should be set to 1.0 when the aircraft should be launched from tha catapult. Erik, could you please apply these? Thanks! Greetings Mathias -- Mathias FrÃhlich, email: [EMAIL PROTECTED]
Index: src/AIModel/AIBase.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIBase.cxx,v retrieving revision 1.31 diff -u -r1.31 AIBase.cxx --- src/AIModel/AIBase.cxx 16 Nov 2004 09:33:21 -0000 1.31 +++ src/AIModel/AIBase.cxx 18 Nov 2004 17:12:09 -0000 @@ -78,8 +78,8 @@ } 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, Index: src/AIModel/AIShip.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIShip.cxx,v retrieving revision 1.11 diff -u -r1.11 AIShip.cxx --- src/AIModel/AIShip.cxx 16 Nov 2004 19:48:09 -0000 1.11 +++ src/AIModel/AIShip.cxx 18 Nov 2004 17:12:09 -0000 @@ -84,9 +84,9 @@ } // 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 Index: src/Main/main.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Main/main.cxx,v retrieving revision 1.186 diff -u -r1.186 main.cxx --- src/Main/main.cxx 20 Oct 2004 08:18:29 -0000 1.186 +++ src/Main/main.cxx 18 Nov 2004 17:12:16 -0000 @@ -240,6 +240,22 @@ real_delta_time_sec = double(current_time_stamp - last_time_stamp) / 1000000.0; + // round the real time down to a multiple of 1/model-hz. + // this way all systems are updated the _same_ amount of dt. + { + static double rem = 0.0; + real_delta_time_sec += rem; + double hz = fgGetInt("/sim/model-hz"); + double nit = floor(real_delta_time_sec*hz); + rem = real_delta_time_sec - nit/hz; + real_delta_time_sec = nit/hz; + // Finally fool the _calc_multiloop function in FGInterface. + // That is, avoid roundoff problems by adding the roundoff itself. + // ... ok, two times the roundoff to have enough room for two operations. + real_delta_time_sec *= 1.0 + 2.0*DBL_EPSILON; + } + + if ( clock_freeze->getBoolValue() ) { delta_time_sec = 0; } else {
Index: src/Controls/controls.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Controls/controls.cxx,v retrieving revision 1.12 diff -u -r1.12 controls.cxx --- src/Controls/controls.cxx 10 Sep 2004 17:53:34 -0000 1.12 +++ src/Controls/controls.cxx 18 Nov 2004 17:12:10 -0000 @@ -81,6 +81,8 @@ gear_down( true ), antiskid( true ), tailhook( false ), + launchbar( false ), + catapult_launch_cmd( false ), tailwheel_lock( false ), wing_heat( false ), pitot_heat( true ), @@ -157,6 +159,8 @@ steering = 0.0; gear_down = true; tailhook = false; + launchbar = false; + catapult_launch_cmd = false; tailwheel_lock = false; set_carb_heat( ALL_ENGINES, false ); set_inlet_heat( ALL_ENGINES, false ); @@ -468,6 +473,14 @@ &FGControls::get_tailhook, &FGControls::set_tailhook); fgSetArchivable("/controls/gear/tailhook"); + fgTie("/controls/gear/launchbar", this, + &FGControls::get_launchbar, &FGControls::set_launchbar); + fgSetArchivable("/controls/gear/launchbar"); + + fgTie("/controls/gear/catapult-launch-cmd", this, + &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd); + fgSetArchivable("/controls/gear/catapult-launch-cmd"); + fgTie("/controls/gear/tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock); @@ -898,6 +911,8 @@ fgUntie("/controls/gear/gear_down"); fgUntie("/controls/gear/antiskid"); fgUntie("/controls/gear/tailhook"); + fgUntie("/controls/gear/launchbar"); + fgUntie("/controls/gear/catapult-launch-cmd"); fgUntie("/controls/gear/tailwheel-lock"); for (index = 0; index < MAX_WHEELS; index++) { char name[MAX_NAME_LEN]; @@ -1696,6 +1711,18 @@ } void +FGControls::set_launchbar( bool state ) +{ + launchbar = state; +} + +void +FGControls::set_catapult_launch_cmd( bool state ) +{ + catapult_launch_cmd = state; +} + +void FGControls::set_tailwheel_lock( bool state ) { tailwheel_lock = state; Index: src/Controls/controls.hxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Controls/controls.hxx,v retrieving revision 1.10 diff -u -r1.10 controls.hxx --- src/Controls/controls.hxx 10 Sep 2004 17:53:34 -0000 1.10 +++ src/Controls/controls.hxx 18 Nov 2004 17:12:10 -0000 @@ -163,6 +163,8 @@ bool gear_down; bool antiskid; bool tailhook; + bool launchbar; + bool catapult_launch_cmd; bool tailwheel_lock; // controls/gear/wheel[n]/ @@ -345,6 +347,8 @@ inline bool get_gear_down() const { return gear_down; } inline bool get_antiskid() const { return antiskid; } inline bool get_tailhook() const { return tailhook; } + inline bool get_launchbar() const { return launchbar; } + inline bool get_catapult_launch_cmd() const { return catapult_launch_cmd; } inline bool get_tailwheel_lock() const { return tailwheel_lock; } // controls/gear/wheel[n]/ @@ -531,6 +535,8 @@ void set_gear_down( bool gear ); void set_antiskid( bool val ); void set_tailhook( bool val ); + void set_launchbar( bool val ); + void set_catapult_launch_cmd( bool val ); void set_tailwheel_lock( bool val ); // controls/gear/wheel[n]/
_______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d