On Thu, 2009-04-23 at 11:56 -0400, Patrice Poly wrote:
> > nope, same behaviour!!
> >
> > i think that on my "slow" PC, your ridge lift is sometimes initialised a
> > little to early (while position is 0,0,0 maybe), resulting in some nan
> > in the result of terrain scan, wich lead to a "nan" in
> > /environment/ridge-lift-fps.
> >
> > and as it's used to compute the next aircraft position, nan go all along
> > the calculs...
> >
> > i tested :
> > _ridge_lift_fps_node->setDoubleValue( 0 );
> >
> > and no more nan, all the properties in ridge-lift are now valid.
> >
> > jano
> 
> Jano, may I ask you to do a little experiment ?
> 
> As you have a machine which triggers the error, maybe you could try this:
> 
> comment out all the formulas, and replace them by a nice constant, all over 
> the file.
> Then, from bottom to top, and one by one, put the original calculations back.
> 
> Maybe that could help focus on the one that produces the bad thing ?
> 
> 
> Then, you could also try the following ?
> 
> line 231 :    if (timer >= 1.0 ) {
> 
> this waits 1 second before doing a scan, maybe
> * this could be raised to a longer time ?
> * this could be replaced by something that tells us for sure the scenery is 
> here,the plane is placed,  and that get_elevation_m is ready to work ?
> 
> I'm blind here for these experiments...

Adding a test for NaN will prevent (or at least mask) the problem:

  strength = lift_mps * SG_METER_TO_FEET ;
  if(isnan(strength)) strength=0; 
  _ridge_lift_fps_node->setDoubleValue( strength );


We could add some debug printing, too perhaps:

  strength = lift_mps * SG_METER_TO_FEET ;
  if(isnan(strength)){
     strength=0; 
     cout << /* whatever variables we need */ << endl;
  } 
  _ridge_lift_fps_node->setDoubleValue( strength );

Ron




------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to