Revision: 7391
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7391&view=rev
Author:   natepak
Date:     2009-03-08 08:46:29 +0000 (Sun, 08 Mar 2009)

Log Message:
-----------
Added ghost objects

Modified Paths:
--------------
    code/branches/federation/gazebo/server/Global.hh
    code/branches/federation/gazebo/server/Model.cc
    code/branches/federation/gazebo/server/Simulator.cc
    code/branches/federation/gazebo/server/physics/Body.cc
    code/branches/federation/gazebo/server/physics/Body.hh
    code/branches/federation/gazebo/server/physics/Geom.cc
    code/branches/federation/gazebo/worlds/pioneer2dx.world

Modified: code/branches/federation/gazebo/server/Global.hh
===================================================================
--- code/branches/federation/gazebo/server/Global.hh    2009-03-08 05:31:58 UTC 
(rev 7390)
+++ code/branches/federation/gazebo/server/Global.hh    2009-03-08 08:46:29 UTC 
(rev 7391)
@@ -49,10 +49,11 @@
 
 #ifndef GZ_COLLIDE_BITS
 
-#define GZ_ALL_COLLIDE 0xFFFFFFFF
+#define GZ_ALL_COLLIDE 0x0FFFFFFF
 #define GZ_NONE_COLLIDE 0x00000000
 #define GZ_FIXED_COLLIDE 0x00000001
 #define GZ_SENSOR_COLLIDE 0x00000002
+#define GZ_GHOST_COLLIDE 0x10000000
 
 #endif
 

Modified: code/branches/federation/gazebo/server/Model.cc
===================================================================
--- code/branches/federation/gazebo/server/Model.cc     2009-03-08 05:31:58 UTC 
(rev 7390)
+++ code/branches/federation/gazebo/server/Model.cc     2009-03-08 08:46:29 UTC 
(rev 7391)
@@ -832,7 +832,7 @@
 /// Set the collide mode of the model
 void Model::SetCollideMode( const std::string &m )
 {
-  /*Body *body;
+  Body *body;
 
   std::map<std::string, Body* >::iterator iter;
 
@@ -840,10 +840,10 @@
   {
     body = iter->second;
 
-    body->SetFrictionMode( v );
+    body->SetCollideMode( m );
   }
-  */
 }
+
 
////////////////////////////////////////////////////////////////////////////////
 // Load a renderable model (like a light source).
 void Model::LoadRenderable(XMLConfigNode *node)

Modified: code/branches/federation/gazebo/server/Simulator.cc
===================================================================
--- code/branches/federation/gazebo/server/Simulator.cc 2009-03-08 05:31:58 UTC 
(rev 7390)
+++ code/branches/federation/gazebo/server/Simulator.cc 2009-03-08 08:46:29 UTC 
(rev 7391)
@@ -303,6 +303,13 @@
     if (currTime - this->lastUpdateTime > this->runLength)
     {
       World::Instance()->ProcessMessages();
+
+      // Update the gui
+      if (this->gui)
+      {
+        this->gui->Update();
+      }
+
       continue;
     }
 
@@ -327,7 +334,6 @@
 
       this->prevPhysicsTime = this->GetRealTime();
 
-      std::cout << "Updating at[" << this->GetRealTime() << "]\n";
       World::Instance()->Update();
     }
 

Modified: code/branches/federation/gazebo/server/physics/Body.cc
===================================================================
--- code/branches/federation/gazebo/server/physics/Body.cc      2009-03-08 
05:31:58 UTC (rev 7390)
+++ code/branches/federation/gazebo/server/physics/Body.cc      2009-03-08 
08:46:29 UTC (rev 7391)
@@ -74,6 +74,7 @@
   this->dampingFactorP = new ParamT<double>("dampingFactor", 0.03, 0);
 
   Param::End();
+
 }
 
 
@@ -214,6 +215,35 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Set the collide mode of the body
+void Body::SetCollideMode( const std::string &m )
+{
+  std::map< std::string, Geom* >::iterator giter;
+
+  unsigned int collideBits;
+
+  if (m == "all")
+    collideBits =  GZ_ALL_COLLIDE;
+  else if (m == "none")
+    collideBits =  GZ_NONE_COLLIDE;
+  else if (m == "sensors")
+    collideBits = GZ_SENSOR_COLLIDE;
+  else if (m == "ghost")
+    collideBits = GZ_GHOST_COLLIDE;
+  else
+  {
+    gzerr(0) << "Unknown collide mode[" << m << "]\n";
+    return;
+  }
+
+  for (giter = this->geoms.begin(); giter != this->geoms.end(); giter++)
+  {
+    giter->second->SetCategoryBits(collideBits);
+    giter->second->SetCollideBits(collideBits);
+  }
+}
+
+////////////////////////////////////////////////////////////////////////////////
 // Initialize the body
 void Body::Init()
 {

Modified: code/branches/federation/gazebo/server/physics/Body.hh
===================================================================
--- code/branches/federation/gazebo/server/physics/Body.hh      2009-03-08 
05:31:58 UTC (rev 7390)
+++ code/branches/federation/gazebo/server/physics/Body.hh      2009-03-08 
08:46:29 UTC (rev 7391)
@@ -120,6 +120,9 @@
     /// \brief Set the friction mode of the body
     public: void SetFrictionMode( const bool &v );
 
+    /// \brief Set the collide mode of the body
+    public: void SetCollideMode( const std::string &m );
+
     /// \brief Set the linear velocity of the body
     public: void SetLinearVel(const Vector3 &vel);
 

Modified: code/branches/federation/gazebo/server/physics/Geom.cc
===================================================================
--- code/branches/federation/gazebo/server/physics/Geom.cc      2009-03-08 
05:31:58 UTC (rev 7390)
+++ code/branches/federation/gazebo/server/physics/Geom.cc      2009-03-08 
08:46:29 UTC (rev 7391)
@@ -108,6 +108,7 @@
 {
   XMLConfigNode *childNode = NULL;
 
+
   this->xmlNode=node;
 
   this->typeName = node->GetName();
@@ -170,6 +171,7 @@
     World::Instance()->RegisterGeom(this);
     this->ShowPhysics(false);
   }
+
 }
 
 
@@ -239,7 +241,13 @@
     this->SetCategoryBits(GZ_FIXED_COLLIDE);
     this->SetCollideBits(~GZ_FIXED_COLLIDE);
   }
+  else
+  {
+    this->SetCategoryBits(GZ_ALL_COLLIDE);
+    //this->SetCollideBits(~GZ_FIXED_COLLIDE);
+  }
 
+
   // Create a new name of the geom's mesh entity
   //std::ostringstream stream;
   //stream << "Entity[" << (int)this->geomId << "]";

Modified: code/branches/federation/gazebo/worlds/pioneer2dx.world
===================================================================
--- code/branches/federation/gazebo/worlds/pioneer2dx.world     2009-03-08 
05:31:58 UTC (rev 7390)
+++ code/branches/federation/gazebo/worlds/pioneer2dx.world     2009-03-08 
08:46:29 UTC (rev 7391)
@@ -98,7 +98,7 @@
     <rpy>0.0 0.0 90.0</rpy>
     <enableGravity>false</enableGravity>
     <enableFriction>false</enableFriction>
-    <collide>sensors</collide>
+    <collide>ghost</collide>
 
     <controller:differential_position2d name="controller1">
       <leftJoint>left_wheel_hinge</leftJoint>
@@ -112,6 +112,7 @@
     <model:physical name="laser">
       <xyz>0.15 0 0.18</xyz>
       <enableGravity>false</enableGravity>
+      <collide>ghost</collide>
 
       <attach>
         <parentBody>chassis_body</parentBody>
@@ -128,6 +129,26 @@
     </include>
   </model:physical>
 
+  <model:physical name="box1_model">
+    <xyz>0 0.5 0.5</xyz>
+    <canonicalBody>box1_body</canonicalBody>
+    <static>false</static>
+
+    <body:box name="box1_body">
+
+      <geom:box name="box1_geom">
+        <size>1 .1 1</size>
+        <mass>0.1</mass>
+        <visual>
+          <size>1 .1 1</size>
+          <mesh>unit_box</mesh>
+          <material>Gazebo/Rocky</material>
+        </visual>
+      </geom:box>
+    </body:box>
+  </model:physical>
+
+
   <!-- White Point light -->
   <model:renderable name="point_white">
     <xyz>0 2 2</xyz>


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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to