Revision: 7776
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7776&view=rev
Author:   hsujohnhsu
Date:     2009-06-03 18:28:48 +0000 (Wed, 03 Jun 2009)

Log Message:
-----------
use ode built-in damping.
preset to 0.

Modified Paths:
--------------
    code/gazebo/trunk/server/physics/Body.cc

Modified: code/gazebo/trunk/server/physics/Body.cc
===================================================================
--- code/gazebo/trunk/server/physics/Body.cc    2009-06-03 18:18:02 UTC (rev 
7775)
+++ code/gazebo/trunk/server/physics/Body.cc    2009-06-03 18:28:48 UTC (rev 
7776)
@@ -86,7 +86,7 @@
 
   this->rpyP = new ParamT<Quatern>("rpy", Quatern(), 0);
   this->rpyP->Callback( &Body::SetRotation, this );
-  this->dampingFactorP = new ParamT<double>("dampingFactor", 0.03, 0);
+  this->dampingFactorP = new ParamT<double>("dampingFactor", 0.0, 0);
 
   // option to turn gravity off for individual body
   this->turnGravityOffP = new ParamT<bool>("turnGravityOff", false, 0);
@@ -382,6 +382,16 @@
   {
     (*siter)->Init();
   }
+
+  // global-inertial damping is implemented in ode svn trunk
+  if(this->GetId() && this->dampingFactorP->GetValue() > 0)
+  {
+    this->physicsEngine->LockMutex();
+    dBodySetLinearDamping(this->GetId(),this->dampingFactorP->GetValue()); 
+    dBodySetAngularDamping(this->GetId(),this->dampingFactorP->GetValue()); 
+    this->physicsEngine->UnlockMutex();
+  }
+
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -449,23 +459,6 @@
     (*sensorIter)->Update();
   }
 
-  if(this->GetId())
-  {
-    this->physicsEngine->LockMutex();
-
-         force = this->dampingFactorP->GetValue() * this->mass.mass;
-         vel = this->GetLinearVel();
-         dBodyAddForce(this->GetId(), -((vel.x * fabs(vel.x)) * force), 
-                  -((vel.y * fabs(vel.y)) * force), 
-                  -((vel.z * fabs(vel.z)) * force));
-
-         avel = this->GetAngularVel();
-         dBodyAddTorque(this->GetId(), -avel.x * force, -avel.y * force, 
-                   -avel.z * force);
-
-    this->physicsEngine->UnlockMutex();
-  }
-
 #ifdef TIMING
   double tmpT5 = Simulator::Instance()->GetWallTime();
   std::cout << "               ALL Sensors Update DT (" << tmpT5-tmpT4 << ")" 
<< std::endl;


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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to