Hi all,

Following the integration of the last version of JSBSim in Flight
Gear, some bugs have been reported to the JSBSim dev ML :

1. Resetting a JSBSim aircraft crashed Flight Gear
2. Aircrafts were incorrectly positioned on carriers

The attached patch seems to fix both of them. Could someone apply it
to the Flight Gear git repository ?

Thanks.

Bertrand.

---------- Forwarded message ----------
From: grth_team <grtht...@gmail.com>
Date: 2011/9/17
Subject: Re: [Jsbsim-devel] Integrating the new JSBSim with FlightGear
To: Development issues <jsbsim-de...@lists.sourceforge.net>


Le samedi 17 septembre 2011 15:42:02, Bertrand Coconnier a écrit :
> 2011/9/17 grth_team <grtht...@gmail.com>:
> > Hi, Bertrand,
> >
> > We have tried out the first patch, it does work.
> > Thus, the reset working, help  to explain ( partly ) the wrong
> > position of Aircraft at start on Carrier.
> > At least with the case at heading   160 or 200  ( Nimitz ,Foch )
> > the Aircraft is sliding on the deck before "grabbing"
> > definitively the deck.
> > however, with other heading     285 , 315  ( Vinson, Clemenceau )
> > the Aircraft is out of the deck in water , we can't see it
> > sliding or falling.
> >
> > The first case can be explained with the speed of the Carrier and
> > some delay within the groundcache processing ( which is not with
> > FG 24 ).
> >
> > The second case is not carrier speed related , isn' it due to
> >  the earth rotation ?
> >
> > Thanks
> >
> > Josh and the team
>
> Hi Josh,
>
> Attached is a patch that fix the issue you described (at least
> according to my tests).
> Could you please test it and tell if it works on your side as well
> ?
>
> Cheers,
>
> Bertrand.

Hi, Bertrand,

Your patch does it fully,  carrier and reset
Thanks a lot.

David


--
GrthTeam
https://sites.google.com/site/grtuxhangar/home
diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx
index eed3c68..77b006f 100644
--- a/src/FDM/JSBSim/JSBSim.cxx
+++ b/src/FDM/JSBSim/JSBSim.cxx
@@ -311,7 +311,6 @@ FGJSBsim::FGJSBsim( double dt )
     temperature = fgGetNode("/environment/temperature-degc",true);
     pressure = fgGetNode("/environment/pressure-inhg",true);
     pressureSL = fgGetNode("/environment/pressure-sea-level-inhg",true);
-    density = fgGetNode("/environment/density-slugft3",true);
     ground_wind = fgGetNode("/environment/config/boundary/entry[0]/wind-speed-kt",true);
     turbulence_gain = fgGetNode("/environment/turbulence/magnitude-norm",true);
     turbulence_rate = fgGetNode("/environment/turbulence/rate-hz",true);
@@ -368,7 +367,6 @@ void FGJSBsim::init()
       Winds->SetProbabilityOfExceedence(0.0);
     }
 
-    fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
     fgic->SetWindNEDFpsIC( -wind_from_north->getDoubleValue(),
                            -wind_from_east->getDoubleValue(),
                            -wind_from_down->getDoubleValue() );
@@ -376,9 +374,9 @@ void FGJSBsim::init()
     //Atmosphere->SetExTemperature(get_Static_temperature());
     //Atmosphere->SetExPressure(get_Static_pressure());
     //Atmosphere->SetExDensity(get_Density());
-    SG_LOG(SG_FLIGHT,SG_INFO,"T,p,rho: " << fdmex->GetAtmosphere()->GetTemperature()
-     << ", " << fdmex->GetAtmosphere()->GetPressure()
-     << ", " << fdmex->GetAtmosphere()->GetDensity() );
+    SG_LOG(SG_FLIGHT,SG_INFO,"T,p,rho: " << Atmosphere->GetTemperature()
+     << ", " << Atmosphere->GetPressure()
+     << ", " << Atmosphere->GetDensity() );
 
 // deprecate egt_degf for egt-degf to have consistent naming
 // TODO: remove this for 2.6.0
@@ -394,7 +392,9 @@ void FGJSBsim::init()
 
     FCS->SetDfPos( ofNorm, globals->get_controls()->get_flaps() );
 
+    needTrim = startup_trim->getBoolValue();
     common_init();
+    fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
 
     copy_to_JSBsim();
     fdmex->RunIC();     //loop JSBSim once w/o integrating
@@ -407,7 +407,7 @@ void FGJSBsim::init()
       }
     }
 
-    if ( startup_trim->getBoolValue() ) {
+    if ( needTrim ) {
       FGLocation cart(fgic->GetLongitudeRadIC(), fgic->GetLatitudeRadIC(),
                       get_Sea_level_radius() + fgic->GetAltitudeASLFtIC());
       double cart_pos[3], contact[3], d[3], vel[3], agl;
@@ -785,8 +785,8 @@ bool FGJSBsim::copy_from_JSBsim()
 
     // Positions of Visual Reference Point
     FGLocation l = Auxiliary->GetLocationVRP();
-    _updateGeocentricPosition( l.GetLatitude(), l.GetLongitude(),
-                               l.GetRadius() - get_Sea_level_radius() );
+    _updatePosition(SGGeoc::fromRadFt( l.GetLongitude(), l.GetLatitude(),
+                                       l.GetRadius() ));
 
     _set_Altitude_AGL( Propagate->GetDistanceAGL() );
     {
@@ -1006,26 +1006,26 @@ bool FGJSBsim::ToggleDataLogging(bool state)
 void FGJSBsim::set_Latitude(double lat)
 {
   static SGConstPropertyNode_ptr altitude = fgGetNode("/position/altitude-ft");
-  double alt;
+  double alt = altitude->getDoubleValue();
   double sea_level_radius_meters, lat_geoc;
 
-  if ( altitude->getDoubleValue() > -9990 )
-    alt = altitude->getDoubleValue();
-  else
-    alt = 0.0;
+  if ( alt < -9990 ) alt = 0.0;
 
   SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
   SG_LOG(SG_FLIGHT,SG_INFO," cur alt (ft) =  " << alt );
 
   sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
                     &sea_level_radius_meters, &lat_geoc );
-  _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET  );
+
+  double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
+  _set_Sea_level_radius( sea_level_radius_ft );
 
   if (needTrim) {
-    fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET  );
+    fgic->SetSeaLevelRadiusFtIC( sea_level_radius_ft );
     fgic->SetLatitudeRadIC( lat_geoc );
   }
   else {
+    Propagate->SetSeaLevelRadius( sea_level_radius_ft );
     Propagate->SetLatitude(lat_geoc);
     FGInterface::set_Latitude(lat);
   }
diff --git a/src/FDM/JSBSim/JSBSim.hxx b/src/FDM/JSBSim/JSBSim.hxx
index a0294d5..1e6e093 100644
--- a/src/FDM/JSBSim/JSBSim.hxx
+++ b/src/FDM/JSBSim/JSBSim.hxx
@@ -274,7 +274,6 @@ private:
     SGPropertyNode_ptr temperature;
     SGPropertyNode_ptr pressure;
     SGPropertyNode_ptr pressureSL;
-    SGPropertyNode_ptr density;
     SGPropertyNode_ptr ground_wind;
     SGPropertyNode_ptr turbulence_gain;
     SGPropertyNode_ptr turbulence_rate;
diff --git a/src/FDM/JSBSim/models/FGPropagate.cpp b/src/FDM/JSBSim/models/FGPropagate.cpp
index 9654510..0be0b0e 100644
--- a/src/FDM/JSBSim/models/FGPropagate.cpp
+++ b/src/FDM/JSBSim/models/FGPropagate.cpp
@@ -552,10 +552,10 @@ void FGPropagate::bind(void)
 
   PropertyManager->Tie("position/h-sl-ft", this, &FGPropagate::GetAltitudeASL, &FGPropagate::SetAltitudeASL, true);
   PropertyManager->Tie("position/h-sl-meters", this, &FGPropagate::GetAltitudeASLmeters, &FGPropagate::SetAltitudeASLmeters, true);
-  PropertyManager->Tie("position/lat-gc-rad", this, &FGPropagate::GetLatitude, &FGPropagate::SetLatitude);
-  PropertyManager->Tie("position/long-gc-rad", this, &FGPropagate::GetLongitude, &FGPropagate::SetLongitude);
-  PropertyManager->Tie("position/lat-gc-deg", this, &FGPropagate::GetLatitudeDeg, &FGPropagate::SetLatitudeDeg);
-  PropertyManager->Tie("position/long-gc-deg", this, &FGPropagate::GetLongitudeDeg, &FGPropagate::SetLongitudeDeg);
+  PropertyManager->Tie("position/lat-gc-rad", this, &FGPropagate::GetLatitude, &FGPropagate::SetLatitude, false);
+  PropertyManager->Tie("position/long-gc-rad", this, &FGPropagate::GetLongitude, &FGPropagate::SetLongitude, false);
+  PropertyManager->Tie("position/lat-gc-deg", this, &FGPropagate::GetLatitudeDeg, &FGPropagate::SetLatitudeDeg, false);
+  PropertyManager->Tie("position/long-gc-deg", this, &FGPropagate::GetLongitudeDeg, &FGPropagate::SetLongitudeDeg, false);
   PropertyManager->Tie("position/lat-geod-rad", this, &FGPropagate::GetGeodLatitudeRad);
   PropertyManager->Tie("position/lat-geod-deg", this, &FGPropagate::GetGeodLatitudeDeg);
   PropertyManager->Tie("position/geod-alt-ft", this, &FGPropagate::GetGeodeticAltitude);
------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to