Revision: 8373
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8373&view=rev
Author:   natepak
Date:     2009-11-05 22:39:29 +0000 (Thu, 05 Nov 2009)

Log Message:
-----------
Fixed a problem with custom mass matrices

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

Added Paths:
-----------
    code/gazebo/trunk/worlds/coffee_cup.world
    code/gazebo/trunk/worlds/cog.world

Modified: code/gazebo/trunk/server/physics/Body.cc
===================================================================
--- code/gazebo/trunk/server/physics/Body.cc    2009-11-05 19:07:19 UTC (rev 
8372)
+++ code/gazebo/trunk/server/physics/Body.cc    2009-11-05 22:39:29 UTC (rev 
8373)
@@ -366,9 +366,9 @@
     if (this->cgVisual)
     {
       this->cgVisual->AttachMesh("body_cg");
-      this->cgVisual->SetVisible(true);
       this->cgVisual->SetMaterial("Gazebo/Red");
       this->cgVisual->SetCastShadows(false);
+      this->cgVisual->SetVisible(true);
 
       std::map< std::string, Geom* >::iterator giter;
 
@@ -382,7 +382,6 @@
         line->AddPoint(giter->second->GetRelativePose().pos);
       }
 
-      this->cgVisual->SetVisible(false);
     }
   }
 
@@ -481,10 +480,11 @@
   std::map<std::string, Geom*>::iterator iter;
   this->mass.Reset();
 
-  for (iter = this->geoms.begin(); iter != this->geoms.end(); iter++)
-  {
-    this->mass += iter->second->GetMass();
-  }
+  if (**this->customMassMatrixP)
+    this->mass = this->customMass;
+  else
+    for (iter = this->geoms.begin(); iter != this->geoms.end(); iter++)
+      this->mass += iter->second->GetMass();
 
   // Translate all the geoms so that the CoG is at (0,0,0) in the body
   // frame

Modified: code/gazebo/trunk/server/physics/ode/ODEBody.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEBody.cc     2009-11-05 19:07:19 UTC 
(rev 8372)
+++ code/gazebo/trunk/server/physics/ode/ODEBody.cc     2009-11-05 22:39:29 UTC 
(rev 8373)
@@ -329,10 +329,14 @@
     dMass odeMass;
     dMassSetZero(&odeMass);
 
-    Vector3 cog = this->customMass.GetCoG();
+    // The CoG must always be (0,0,0)
+    Vector3 cog;
+
     Vector3 principals = this->customMass.GetPrincipalMoments();
     Vector3 products = this->customMass.GetProductsofInertia();
 
+    std::cout << "Custom Mass[" << this->customMass << "]\n";
+
     dMassSetParameters(&odeMass, this->customMass.GetAsDouble(),
                        cog.x, cog.y, cog.z,
                        principals.x, principals.y, principals.z,
@@ -344,8 +348,6 @@
 
     this->physicsEngine->ConvertMass(&this->mass, &odeMass);
     this->physicsEngine->UnlockMutex();
-
-    this->cgVisual->SetPosition(cog);
   }
   else
   { 

Added: code/gazebo/trunk/worlds/coffee_cup.world
===================================================================
--- code/gazebo/trunk/worlds/coffee_cup.world                           (rev 0)
+++ code/gazebo/trunk/worlds/coffee_cup.world   2009-11-05 22:39:29 UTC (rev 
8373)
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+
+<gazebo:world 
+  xmlns:xi="http://www.w3.org/2001/XInclude";
+  xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"; 
+  xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"; 
+  xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"; 
+  xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"; 
+  xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"; 
+  xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"; 
+  
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface";
 
+  
xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering";
 
+  
xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable";
 
+  
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller";
+  xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics"; 
>
+
+  <verbosity>1</verbosity>
+
+  <physics:ode>
+    <stepTime>0.0001</stepTime>
+    <gravity>0 0 -9.80665</gravity>
+    <cfm>10e-8</cfm>
+    <erp>0.3</erp>
+    <quickStep>true</quickStep>
+    <quickStepIters>50</quickStepIters>
+    <quickStepW>1.3</quickStepW>
+    <contactMaxCorrectingVel>100.0</contactMaxCorrectingVel>
+    <contactSurfaceLayer>0.001</contactSurfaceLayer>
+
+    <updateRate>0</updateRate>
+  </physics:ode>
+
+  <rendering:gui>
+    <type>fltk</type>
+    <size>800 600</size>
+    <pos>0 0</pos>
+  </rendering:gui>
+
+  <rendering:ogre>
+    <ambient>0.1 0.1 0.1 1.0</ambient>
+    <sky>
+      <material>Gazebo/CloudySky</material>
+    </sky>
+    <grid>false</grid>
+  </rendering:ogre>
+
+  <model:physical name="plane1_model">
+    <xyz>0 0 0</xyz>
+    <rpy>0 0 0</rpy>
+    <static>true</static>
+
+    <body:plane name="plane1_body">
+      <geom:plane name="plane1_geom">
+        <normal>0 0 1</normal>
+        <size>2000 2000</size>
+        <segments>10 10</segments>
+        <uvTile>1000 1000</uvTile>
+        <material>Gazebo/GrayGrid</material>
+      </geom:plane>
+    </body:plane>
+  </model:physical>
+
+  <model:physical name="coffee_cup">
+    <xyz>0 0 1.0</xyz>
+    <rpy>90 0 0</rpy>
+    <static>false</static>
+    <body:trimesh name="coffee_cup_body">
+      <geom:trimesh name="coffee_cup_geom">
+        <mesh>cup.mesh</mesh>
+        <scale>.1 .1 .1</scale>
+        <mass>0.1</mass>
+
+        <visual>
+          <scale>.1 .1 .1</scale>
+          <mesh>cup.mesh</mesh>
+          <material>Gazebo/PioneerBody</material>
+        </visual>
+      </geom:trimesh>
+    </body:trimesh>
+  </model:physical>
+
+  <!-- White Point light -->
+  <model:renderable name="point_white">
+    <xyz>0 0 10</xyz>
+    <static>true</static>
+
+    <light>
+      <castShadows>false</castShadows>
+      <type>point</type>
+      <diffuseColor>0.5 0.48 0.5</diffuseColor>
+      <specularColor>.1 .1 .1</specularColor>
+      <range>50</range>
+
+      <!-- Constant(0-1) Linear(0-1) Quadratic -->
+      <attenuation>0.1 0.01 0.00</attenuation>
+    </light>
+  </model:renderable>
+  
+
+</gazebo:world>

Added: code/gazebo/trunk/worlds/cog.world
===================================================================
--- code/gazebo/trunk/worlds/cog.world                          (rev 0)
+++ code/gazebo/trunk/worlds/cog.world  2009-11-05 22:39:29 UTC (rev 8373)
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+
+<gazebo:world 
+  xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"; 
+  xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"; 
+  xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"; 
+  xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"; 
+  xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"; 
+  xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"; 
+  
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface";
 
+  
xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering";
 
+  
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller";
+  xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics"; 
>
+
+  <verbosity>5</verbosity>
+
+  <physics:ode>
+    <stepTime>0.00001</stepTime>
+    <gravity>0 0 -9.8</gravity>
+    <cfm>10e-2</cfm>
+    <erp>0.2</erp>
+    <updateRate>0</updateRate>
+  </physics:ode>
+
+  <rendering:gui>
+    <type>fltk</type>
+    <size>1024 768</size>
+    <pos>0 0</pos>
+    <frames>
+      <row height="100%">
+        <camera width="100%">
+          <xyz>-3.15 4 2.55</xyz>
+          <rpy>0 15 -55.1</rpy>
+        </camera>
+      </row>
+    </frames>
+  </rendering:gui>
+
+  <rendering:ogre>
+    <ambient>.1 .1 .1 1</ambient>
+    <sky>
+      <material>Gazebo/Grey</material>
+    </sky>
+    <shadowTechnique>stencilAdditive</shadowTechnique>
+    <grid>false</grid>
+  </rendering:ogre>
+
+  <!-- Ground Plane -->
+   <model:physical name="plane1_model">
+    <xyz>0 0 0</xyz>
+    <rpy>0 0 0</rpy>
+    <static>true</static>
+
+    <body:plane name="plane1_body">
+      <geom:plane name="plane1_geom">
+        <normal>0 0 1</normal>
+        <size>100 100</size>
+        <segments>10 10</segments>
+        <uvTile>100 100</uvTile>
+        <material>Gazebo/GrayGrid</material>
+        <mu1>109999.0</mu1>
+        <mu2>1000.0</mu2>
+      </geom:plane>
+    </body:plane>
+  </model:physical>
+
+  <model:physical name="base_model">
+    <xyz>0 0 0.1</xyz>
+
+    <!-- Bottom & Upright of the pendulum -->
+    <body:box name="base_body">
+      <massMatrix>true</massMatrix>
+      <cx>1.0</cx>
+      <cy>0.0</cy>
+      <cz>1.0</cz>
+      <ixx>0.1</ixx>
+      <ixy>0.0</ixy>
+      <ixz>0.0</ixz>
+      <iyy>1.1</iyy>
+      <iyz>0.0</iyz>
+      <izz>0.1</izz>
+      <mass>1.0</mass>
+     <geom:box name="upright_geom">
+        <xyz>0 0 1.1</xyz>
+        <size>0.2 0.2 2.0</size>
+        <mass>0.2</mass>
+        <visual>
+          <scale>0.2 0.2 2.0</scale>
+          <mesh>unit_box</mesh>
+          <material>Gazebo/Red</material>
+        </visual>
+      </geom:box>
+    </body:box>
+  </model:physical>
+
+ <model:renderable name="point_white">
+    <xyz>-1 -1 10</xyz>
+    <static>true</static>
+
+    <light>
+      <type>point</type>
+      <diffuseColor>0.4 0.4 0.4</diffuseColor>
+      <specularColor>.1 .1 .1</specularColor>
+      <range>20</range>
+
+      <attenuation>0.5 0.01 0.001</attenuation>
+    </light>
+  </model:renderable>
+
+  <model:renderable name="point_white2">
+    <xyz>-1 2 10</xyz>
+    <static>true</static>
+
+    <light>
+      <type>point</type>
+      <diffuseColor>0.2 0.2 0.2</diffuseColor>
+      <specularColor>.1 .1 .1</specularColor>
+      <range>20</range>
+
+      <attenuation>0.5 0.01 0.001</attenuation>
+      <castShadows>false</castShadows>
+    </light>
+  </model:renderable>
+ 
+</gazebo:world>


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to