Revision: 8898
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8898&view=rev
Author:   hsujohnhsu
Date:     2010-09-13 07:45:52 +0000 (Mon, 13 Sep 2010)

Log Message:
-----------
locking physics engine when cameras are updating, since we don't have camera 
synchronizer in sim.

Modified Paths:
--------------
    code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc
    code/gazebo/branches/wg/server/rendering/OgreCamera.cc

Modified: code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc     2010-09-11 
09:41:25 UTC (rev 8897)
+++ code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc     2010-09-13 
07:45:52 UTC (rev 8898)
@@ -52,6 +52,8 @@
 #include "OgreCreator.hh"
 #include "RTShaderSystem.hh"
 #include "OgreAdaptor.hh"
+#include "World.hh"
+#include "PhysicsEngine.hh"
 
 #include "Timer.hh"
 
@@ -474,12 +476,17 @@
   // Draw all the non-user cameras
   {
     DIAGNOSTICTIMER(timer("UpdateCameras: Non-UserCamera update",6));
-    boost::recursive_mutex::scoped_lock 
mr_lock(*Simulator::Instance()->GetMRMutex());
+    //boost::recursive_mutex::scoped_lock 
mr_lock(*Simulator::Instance()->GetMRMutex());
+    //boost::recursive_mutex::scoped_lock 
md_lock(*Simulator::Instance()->GetMDMutex());
+    //printf("locking physics\n");
+    World::Instance()->GetPhysicsEngine()->LockMutex();
     for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
     {
       if (dynamic_cast<UserCamera*>((*iter)) == NULL)
         (*iter)->Render();
     }
+    //printf("unlocking physics\n");
+    World::Instance()->GetPhysicsEngine()->UnlockMutex();
   }
 
   // Must update the user camera's last.

Modified: code/gazebo/branches/wg/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/branches/wg/server/rendering/OgreCamera.cc      2010-09-11 
09:41:25 UTC (rev 8897)
+++ code/gazebo/branches/wg/server/rendering/OgreCamera.cc      2010-09-13 
07:45:52 UTC (rev 8898)
@@ -348,7 +348,7 @@
 
     if (this->captureData)
     {
-      boost::recursive_mutex::scoped_lock 
mr_lock(*Simulator::Instance()->GetMRMutex());
+      //boost::recursive_mutex::scoped_lock 
mr_lock(*Simulator::Instance()->GetMRMutex());
 
       Ogre::HardwarePixelBufferSharedPtr pixelBuffer;
       Ogre::RenderTexture *rTexture;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to