Revision: 7774
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7774&view=rev
Author:   natepak
Date:     2009-06-03 14:11:22 +0000 (Wed, 03 Jun 2009)

Log Message:
-----------
Added friction enable flag to ContactParams

Modified Paths:
--------------
    code/gazebo/trunk/server/physics/ContactParams.cc
    code/gazebo/trunk/server/physics/ContactParams.hh
    code/gazebo/trunk/server/physics/Geom.cc
    code/gazebo/trunk/server/physics/ode/ODEPhysics.cc

Modified: code/gazebo/trunk/server/physics/ContactParams.cc
===================================================================
--- code/gazebo/trunk/server/physics/ContactParams.cc   2009-06-03 13:51:30 UTC 
(rev 7773)
+++ code/gazebo/trunk/server/physics/ContactParams.cc   2009-06-03 14:11:22 UTC 
(rev 7774)
@@ -52,6 +52,8 @@
   this->mu2 = dInfinity;
   this->slip1 = 0.01;
   this->slip2 = 0.01;
+
+  this->enableFriction = true;
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/physics/ContactParams.hh
===================================================================
--- code/gazebo/trunk/server/physics/ContactParams.hh   2009-06-03 13:51:30 UTC 
(rev 7773)
+++ code/gazebo/trunk/server/physics/ContactParams.hh   2009-06-03 14:11:22 UTC 
(rev 7774)
@@ -78,6 +78,8 @@
   
     /// \brief soft constraint force mixing
     public: double softCfm;
+
+    public: bool enableFriction;
             
     public: boost::signal< void (Geom*, Geom*)> contactSignal;
   };

Modified: code/gazebo/trunk/server/physics/Geom.cc
===================================================================
--- code/gazebo/trunk/server/physics/Geom.cc    2009-06-03 13:51:30 UTC (rev 
7773)
+++ code/gazebo/trunk/server/physics/Geom.cc    2009-06-03 14:11:22 UTC (rev 
7774)
@@ -636,20 +636,5 @@
 /// Set the friction mode of the geom
 void Geom::SetFrictionMode( const bool &v )
 {
-  if (v == false)
-  {
-    this->contact->mu1 = 0;
-    this->contact->mu2 = 0;
-    this->contact->slip1 = 0;
-    this->contact->slip2 = 0;
-  }
-  else
-  {
-    this->contact->mu1 = dInfinity;
-    this->contact->mu2 = dInfinity;
-    this->contact->slip1 = 0.1;
-    this->contact->slip2 = 0.1;
-
-  }
+  this->contact->enableFriction = v;
 }
-

Modified: code/gazebo/trunk/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEPhysics.cc  2009-06-03 13:51:30 UTC 
(rev 7773)
+++ code/gazebo/trunk/server/physics/ode/ODEPhysics.cc  2009-06-03 14:11:22 UTC 
(rev 7774)
@@ -372,17 +372,29 @@
         contact.surface.soft_erp = h * kp / (h * kp + kd);
         contact.surface.soft_cfm = 1.0 / (h * kp + kd);
 
-        contact.surface.mu = std::min(geom1->contact->mu1, 
geom2->contact->mu1);
-        contact.surface.mu2 = std::min(geom1->contact->mu2, 
geom2->contact->mu2);
+        if (geom1->contact->enableFriction && geom2->contact->enableFriction)
+        {
+          contact.surface.mu = std::min(geom1->contact->mu1, 
+              geom2->contact->mu1);
+          contact.surface.mu2 = std::min(geom1->contact->mu2, 
+              geom2->contact->mu2);
+          contact.surface.slip1 = std::min(geom1->contact->slip1, 
+              geom2->contact->slip1);
+          contact.surface.slip2 = std::min(geom1->contact->slip2, 
+              geom2->contact->slip2);
+        }
+        else
+        {
+          contact.surface.mu = 0; 
+          contact.surface.mu2 = 0;
+          contact.surface.slip1 = 0.1;
+          contact.surface.slip2 = 0.1;
+        }
+
         contact.surface.bounce = std::min(geom1->contact->bounce, 
                                      geom2->contact->bounce);
         contact.surface.bounce_vel = std::min(geom1->contact->bounceVel, 
                                          geom2->contact->bounceVel);
-        contact.surface.slip1 = std::min(geom1->contact->slip1, 
-                                    geom2->contact->slip1);
-        contact.surface.slip2 = std::min(geom1->contact->slip2, 
-                                    geom2->contact->slip2);
-
         dJointID c = dJointCreateContact (self->worldId,
                                           self->contactGroup, &contact);
 


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