Hi Diego,

On Tuesday 19 May 2009 03:32:53 Diogo Kastrup wrote:
> I am sorry for the delay, finally I could get back to this. Besides
> moving to a new city/job, I have also bought a model airplane, so I feel
> like a child again with my new toy wasting all my free time playing.
Have fun :)

> I am changing the friction code to use the new API, but I am having some
> trouble. It looks like the velocities returned by the get_body method
> are always zero. Maybe the problem is in the
> void BodyFinder::apply(BVHMotionTransform& transform)
> method as even when it finds the right ID it returns before the
> velocities are set.
I have not tested that part of the api. So testers and comments welcome.

Hmm, ok. I see.
Does the attached patch help?
With your code, you might have a better test bed than I have.

> Also I am having some trouble to synchronize the stuck point with the
> carrier movement again. I saw that there are some changes to the time
> offset passed to the "Ground Callback" in YASim.cxx. What should I
> expect to be already taken care by get_body? Is it compensating for the
> delay between the AI update and the FDM iterations? And what about the
> Integrator iterations? This was the hardest part of the friction patch
> so any tip would be very helpful.
*In* *theory* the groundcache expects times that corespond to the simulation 
time. FGInterface accounts for the difference between the start of the FDM 
instance and the simulation time (that is the cache_time_offset in 
FGInterface).
I believe that YASim did not track the simulation time itself, so I added 
that? True? Also, YASim internal integration steps do not know about the exact 
time they are for. You might need to take care of them.

There should be no delay between the FDM and AI iterations. The groundcache is 
valid for a specific time interval. And when you start integration, you should 
be at the start of that interval. Once you are ready for that timeslice, you 
should be no further than the end of the caches validity.
This is not checked.

You may enable the ground cache debug code be defining the GROUNDCACHE_DEBUG in 
groundcache.hxx. Then you can play with /fdm/groundcache-debug-level in the 
property tree and see what the groundcache contains. That helped me to 
understand the timeslicing in flightgear.

Greetings

Mathias
Index: groundcache.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/groundcache.cxx,v
retrieving revision 1.43
diff -u -r1.43 groundcache.cxx
--- groundcache.cxx	16 Mar 2009 09:48:18 -0000	1.43
+++ groundcache.cxx	22 May 2009 13:50:00 -0000
@@ -474,11 +474,10 @@
 
         if (_id == transform.getId()) {
             _foundId = true;
-            return;
+        } else {
+            transform.traverse(*this);
         }
         
-        transform.traverse(*this);
-        
         if (_foundId) {
             SGMatrixd toWorld = transform.getToWorldTransform(_time);
             SGVec3d referencePoint = _bodyToWorld.xformPt(SGVec3d::zeros());
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to