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

Log Message:
-----------
Added enableGravity

Modified Paths:
--------------
    code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc
    code/branches/federation/gazebo/server/Model.cc
    code/branches/federation/gazebo/server/Model.hh
    code/branches/federation/gazebo/server/physics/Body.cc
    code/branches/federation/gazebo/worlds/audio.world
    code/branches/federation/gazebo/worlds/bandit.world
    code/branches/federation/gazebo/worlds/bumper.world
    code/branches/federation/gazebo/worlds/factory.world
    code/branches/federation/gazebo/worlds/laser.world
    code/branches/federation/gazebo/worlds/lights.world
    code/branches/federation/gazebo/worlds/map.world
    code/branches/federation/gazebo/worlds/openal.world
    code/branches/federation/gazebo/worlds/pioneer2at.world
    code/branches/federation/gazebo/worlds/pioneer2dx.world
    code/branches/federation/gazebo/worlds/pioneer2dx_camera.world
    code/branches/federation/gazebo/worlds/pioneer2dx_gripper.world
    code/branches/federation/gazebo/worlds/simplecar.world
    code/branches/federation/gazebo/worlds/simpleshapes.world
    code/branches/federation/gazebo/worlds/test.world
    code/branches/federation/gazebo/worlds/trimesh.world
    code/branches/federation/gazebo/worlds/wizbot.world

Modified: 
code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc
===================================================================
--- code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc     
2009-03-08 01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc     
2009-03-08 02:34:23 UTC (rev 7378)
@@ -40,6 +40,7 @@
   {
    
     gazebo::Pose pose;
+    pose.pos.z = 1.0;
     gazebo::Vec3 linearVel(0.1, 0, 0);
     gazebo::Vec3 angularVel(0, 0, 0);
     gazebo::Vec3 linearAccel(0, 0, 0);
@@ -53,9 +54,8 @@
 
   // Example of resetting the simulator
   // simIface->Reset();
+  //usleep(1000000);
 
-  usleep(1000000);
-
   simIface->Close();
 
   delete simIface;

Modified: code/branches/federation/gazebo/server/Model.cc
===================================================================
--- code/branches/federation/gazebo/server/Model.cc     2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/server/Model.cc     2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -68,6 +68,10 @@
 
   this->rpyP = new ParamT<Quatern>("rpy", Quatern(1,0,0,0), 0);
   this->rpyP->Callback( &Model::SetRotation, this);
+
+  this->enableGravityP = new ParamT<bool>("enableGravity", true, 0);
+  this->enableGravityP->Callback( &Model::SetGravityMode, this );
+
   Param::End();
 
   this->parentBodyNameP = NULL;
@@ -118,11 +122,12 @@
   this->canonicalBodyNameP->Load(node);
   this->xyzP->Load(node);
   this->rpyP->Load(node);
+  this->enableGravityP->Load(node);
 
   this->xmlNode = node;
   this->type=node->GetName();
 
-  this->SetStatic(this->staticP->GetValue());
+  this->SetStatic( **(this->staticP) );
 
   if (this->type == "physical")
     this->LoadPhysical(node);
@@ -172,6 +177,11 @@
   // Record the model's initial pose (for reseting)
   this->SetInitPose(pose);
 
+  // This must be placed after creation of the bodies
+  // Static variable overrides the gravity
+  if (**this->staticP == false)
+    this->SetGravityMode( **(this->enableGravityP) );
+
   return 0;
 
   // Get the name of the python module
@@ -224,6 +234,7 @@
   stream << " name=\"" << this->nameP->GetValue() << "\">\n"; 
   stream << prefix << "  " << *(this->xyzP) << "\n";
   stream << prefix << "  " << *(this->rpyP) << "\n";
+  stream << prefix << "  " << *(this->enableGravityP) << "\n";
 
   if (this->type == "physical")
   {
@@ -772,7 +783,21 @@
   return this->bodies[this->canonicalBodyNameP->GetValue()];
 }
 
+////////////////////////////////////////////////////////////////////////////////
+/// Set the gravity mode of the model
+void Model::SetGravityMode( const bool &v )
+{
+  Body *body;
+  std::map<std::string, Body* >::iterator iter;
 
+  for (iter=this->bodies.begin(); iter!=this->bodies.end(); iter++)
+  {
+    body = iter->second;
+
+    body->SetGravityMode( v );
+  }
+}
+
 
////////////////////////////////////////////////////////////////////////////////
 // Load a renderable model (like a light source).
 void Model::LoadRenderable(XMLConfigNode *node)
@@ -785,7 +810,7 @@
   char lightNumBuf[8];
   sprintf(lightNumBuf, "%d", lightNumber++);
   body->SetName(this->GetName() + "_RenderableBody_" + lightNumBuf);
-  body->SetGravityMode(false);
+  //body->SetGravityMode(false);
   body->SetPose(Pose3d());
   this->bodies[body->GetName()] = body;
 

Modified: code/branches/federation/gazebo/server/Model.hh
===================================================================
--- code/branches/federation/gazebo/server/Model.hh     2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/server/Model.hh     2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -155,6 +155,9 @@
     /// \return Pointer to the body
     public: Body *GetCanonicalBody();
 
+    /// \brief Set the gravity mode of the model
+    public: void SetGravityMode( const bool &v );
+
     /// \brief Load a body helper function
     /// \param node XML Configuration node
     private: void LoadBody(XMLConfigNode *node);
@@ -205,8 +208,8 @@
     private: ParamT<Quatern> *rpyP;
     private: ParamT<std::string> *parentBodyNameP;
     private: ParamT<std::string> *myBodyNameP;
+    private: ParamT<bool> *enableGravityP;
 
-
     // Name of a light (if the model is renderable:light)
     private: std::string lightName;
 

Modified: code/branches/federation/gazebo/server/physics/Body.cc
===================================================================
--- code/branches/federation/gazebo/server/physics/Body.cc      2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/server/physics/Body.cc      2009-03-08 
02:34:23 UTC (rev 7378)
@@ -198,7 +198,7 @@
 void Body::SetGravityMode(bool mode)
 {
   if (this->bodyId)
-    dBodySetGravityMode(this->bodyId, mode);
+    dBodySetGravityMode(this->bodyId, mode ? 1: 0);
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/branches/federation/gazebo/worlds/audio.world
===================================================================
--- code/branches/federation/gazebo/worlds/audio.world  2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/audio.world  2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -18,8 +18,8 @@
   <physics:ode>
     <stepTime>0.03</stepTime>
     <gravity>0 0 -9.8</gravity>
-    <cfm>0.008</cfm>
-    <erp>0.2</erp>
+    <cfm>10e-5</cfm>
+    <erp>0.3</erp>
   </physics:ode>
 
   <rendering:gui>
@@ -87,9 +87,10 @@
     <rpy>0.0 0.0 0.0</rpy>
 
     <body:cylinder name="cylinder1_body">
-      <sensor:microphone>
+      <!--<sensor:microphone name="microphone_sensor">
         <gain>1.0</gain>
       </sensor:microphone>
+      -->
       <geom:cylinder name="cylinder1_geom">
         <size>0.5 1</size>
         <mass>1.0</mass>
@@ -135,4 +136,18 @@
     </body:empty>
   </model:physical>
 
+  <!-- White Point light -->
+  <model:renderable name="point_white">
+    <xyz>0 2 2</xyz>
+    <enableGravity>false</enableGravity>
+
+    <light>
+      <type>point</type>
+      <diffuseColor>0.8 0.8 0.8</diffuseColor>
+      <specularColor>0.1 0.1 0.1</specularColor>
+      <attenuation>20 0.5 0.1 0</attenuation>
+    </light>
+  </model:renderable>
+
+
 </gazebo:world>

Modified: code/branches/federation/gazebo/worlds/bandit.world
===================================================================
--- code/branches/federation/gazebo/worlds/bandit.world 2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/bandit.world 2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -161,6 +161,7 @@
   <!-- White Directional light -->
   <model:renderable name="point_white">
     <xyz>0 2 2</xyz>
+    <enableGravity>false</enableGravity>
     <light>
       <type>point</type>
       <diffuseColor>0.8 0.8 0.8</diffuseColor>

Modified: code/branches/federation/gazebo/worlds/bumper.world
===================================================================
--- code/branches/federation/gazebo/worlds/bumper.world 2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/bumper.world 2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -137,6 +137,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.6 -0.4</direction>

Modified: code/branches/federation/gazebo/worlds/factory.world
===================================================================
--- code/branches/federation/gazebo/worlds/factory.world        2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/factory.world        2009-03-08 
02:34:23 UTC (rev 7378)
@@ -89,6 +89,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.5 -0.5</direction>

Modified: code/branches/federation/gazebo/worlds/laser.world
===================================================================
--- code/branches/federation/gazebo/worlds/laser.world  2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/laser.world  2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -97,6 +97,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.5 -0.5</direction>

Modified: code/branches/federation/gazebo/worlds/lights.world
===================================================================
--- code/branches/federation/gazebo/worlds/lights.world 2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/lights.world 2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -56,6 +56,7 @@
   <model:renderable name="spot_red">
     <xyz>0.0 0.0 2.0</xyz>
     <rpy>0.0 0.0 0.0</rpy>
+    <enableGravity>false</enableGravity>
 
     <light>
       <type>spot</type>
@@ -70,6 +71,7 @@
   <model:renderable name="spot_green">
     <xyz>0.0 1.0 2.0</xyz>
     <rpy>0.0 0.0 0.0</rpy>
+    <enableGravity>false</enableGravity>
 
     <light>
       <type>spot</type>
@@ -98,6 +100,7 @@
     <model:renderable name="spot_blue">
       <xyz>0.0 0 0</xyz>
       <rpy>0.0 0.0 0.0</rpy>
+      <enableGravity>false</enableGravity>
 
       <light>
         <type>spot</type>
@@ -115,6 +118,8 @@
   <!-- Yellow Point light -->
   <model:renderable name="point_yellow">
     <xyz>5 5 5</xyz>
+    <enableGravity>false</enableGravity>
+
     <light>
       <type>point</type>
       <diffuseColor>0.1 0.1 0.0</diffuseColor>
@@ -125,6 +130,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -1 0</direction>

Modified: code/branches/federation/gazebo/worlds/map.world
===================================================================
--- code/branches/federation/gazebo/worlds/map.world    2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/map.world    2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -77,6 +77,7 @@
   </model:physical>
 
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.6 -0.4</direction>

Modified: code/branches/federation/gazebo/worlds/openal.world
===================================================================
--- code/branches/federation/gazebo/worlds/openal.world 2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/openal.world 2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -130,6 +130,8 @@
   <!-- White Directional light -->
   <model:renderable name="point_white">
     <xyz>0 2 2</xyz>
+    <enableGravity>false</enableGravity>
+
     <light>
       <type>point</type>
       <diffuseColor>0.8 0.8 0.8</diffuseColor>

Modified: code/branches/federation/gazebo/worlds/pioneer2at.world
===================================================================
--- code/branches/federation/gazebo/worlds/pioneer2at.world     2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/pioneer2at.world     2009-03-08 
02:34:23 UTC (rev 7378)
@@ -111,6 +111,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.8 -0.3</direction>

Modified: code/branches/federation/gazebo/worlds/pioneer2dx.world
===================================================================
--- code/branches/federation/gazebo/worlds/pioneer2dx.world     2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/pioneer2dx.world     2009-03-08 
02:34:23 UTC (rev 7378)
@@ -94,9 +94,9 @@
   -->
 
   <model:physical name="pioneer2dx_model1">
-    <xyz>0 0 0.145</xyz>
+    <xyz>0 0 1.145</xyz>
     <rpy>0.0 0.0 0.0</rpy>
-    <disableGravity/>
+    <enableGravity>false</enableGravity>
 
     <controller:differential_position2d name="controller1">
       <leftJoint>left_wheel_hinge</leftJoint>
@@ -109,6 +109,7 @@
 
     <model:physical name="laser">
       <xyz>0.15 0 0.18</xyz>
+      <enableGravity>false</enableGravity>
 
       <attach>
         <parentBody>chassis_body</parentBody>
@@ -128,6 +129,8 @@
   <!-- White Point light -->
   <model:renderable name="point_white">
     <xyz>0 2 2</xyz>
+    <enableGravity>false</enableGravity>
+
     <light>
       <type>point</type>
       <diffuseColor>0.8 0.8 0.8</diffuseColor>

Modified: code/branches/federation/gazebo/worlds/pioneer2dx_camera.world
===================================================================
--- code/branches/federation/gazebo/worlds/pioneer2dx_camera.world      
2009-03-08 01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/pioneer2dx_camera.world      
2009-03-08 02:34:23 UTC (rev 7378)
@@ -120,6 +120,8 @@
   <!-- White Directional light -->
   <model:renderable name="directional_white">
     <xyz>2.0 0 2.0</xyz>
+    <enableGravity>false</enableGravity>
+
     <light>
       <type>spot</type>
       <range>1000 1000 100</range>

Modified: code/branches/federation/gazebo/worlds/pioneer2dx_gripper.world
===================================================================
--- code/branches/federation/gazebo/worlds/pioneer2dx_gripper.world     
2009-03-08 01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/pioneer2dx_gripper.world     
2009-03-08 02:34:23 UTC (rev 7378)
@@ -104,6 +104,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.6 -0.4</direction>

Modified: code/branches/federation/gazebo/worlds/simplecar.world
===================================================================
--- code/branches/federation/gazebo/worlds/simplecar.world      2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/simplecar.world      2009-03-08 
02:34:23 UTC (rev 7378)
@@ -114,6 +114,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.8 -0.3</direction>

Modified: code/branches/federation/gazebo/worlds/simpleshapes.world
===================================================================
--- code/branches/federation/gazebo/worlds/simpleshapes.world   2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/simpleshapes.world   2009-03-08 
02:34:23 UTC (rev 7378)
@@ -115,6 +115,8 @@
   <!-- White Directional light -->
   <model:renderable name="point_white">
     <xyz>0 2 2</xyz>
+    <enableGravity>false</enableGravity>
+
     <light>
       <type>point</type>
       <diffuseColor>0.8 0.8 0.8</diffuseColor>

Modified: code/branches/federation/gazebo/worlds/test.world
===================================================================
--- code/branches/federation/gazebo/worlds/test.world   2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/test.world   2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -142,6 +142,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.6 -0.4</direction>

Modified: code/branches/federation/gazebo/worlds/trimesh.world
===================================================================
--- code/branches/federation/gazebo/worlds/trimesh.world        2009-03-08 
01:56:07 UTC (rev 7377)
+++ code/branches/federation/gazebo/worlds/trimesh.world        2009-03-08 
02:34:23 UTC (rev 7378)
@@ -74,6 +74,7 @@
 
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.5 -0.5</direction>

Modified: code/branches/federation/gazebo/worlds/wizbot.world
===================================================================
--- code/branches/federation/gazebo/worlds/wizbot.world 2009-03-08 01:56:07 UTC 
(rev 7377)
+++ code/branches/federation/gazebo/worlds/wizbot.world 2009-03-08 02:34:23 UTC 
(rev 7378)
@@ -163,6 +163,7 @@
   
   <!-- White Directional light -->
   <model:renderable name="directional_white">
+    <enableGravity>false</enableGravity>
     <light>
       <type>directional</type>
       <direction>0 -0.6 -0.4</direction>


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