Revision: 8279
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8279&view=rev
Author:   natepak
Date:     2009-10-06 13:58:48 +0000 (Tue, 06 Oct 2009)

Log Message:
-----------
Cleaned up the trimesh loading

Modified Paths:
--------------
    code/gazebo/trunk/server/GazeboConfig.cc
    code/gazebo/trunk/server/MeshLoader.cc
    code/gazebo/trunk/server/MeshLoader.hh
    code/gazebo/trunk/server/Model.cc
    code/gazebo/trunk/server/Simulator.cc
    code/gazebo/trunk/server/physics/Geom.cc
    code/gazebo/trunk/server/physics/TrimeshGeom.cc
    code/gazebo/trunk/server/rendering/UserCamera.cc
    code/gazebo/trunk/worlds/trimesh.world

Modified: code/gazebo/trunk/server/GazeboConfig.cc
===================================================================
--- code/gazebo/trunk/server/GazeboConfig.cc    2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/server/GazeboConfig.cc    2009-10-06 13:58:48 UTC (rev 
8279)
@@ -100,7 +100,7 @@
       node = rc.GetRootNode()->GetChild("gazeboPath");
       while (node)
       {
-        gzmsg(1) << "Gazebo Path[" << node->GetValue() << "]\n";
+        gzmsg(2) << "Gazebo Path[" << node->GetValue() << "]\n";
         this->gazeboPaths.push_back(node->GetValue());
         node = node->GetNext("gazeboPath");
       }
@@ -112,7 +112,7 @@
       node = rc.GetRootNode()->GetChild("ogrePath");
       while (node)
       {
-        gzmsg(1) << "Ogre Path[" << node->GetValue() << "]\n";
+        gzmsg(2) << "Ogre Path[" << node->GetValue() << "]\n";
         this->ogrePaths.push_back( node->GetValue() );
         node = node->GetNext("ogrePath");
       }

Modified: code/gazebo/trunk/server/MeshLoader.cc
===================================================================
--- code/gazebo/trunk/server/MeshLoader.cc      2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/server/MeshLoader.cc      2009-10-06 13:58:48 UTC (rev 
8279)
@@ -11,6 +11,18 @@
 using namespace gazebo;
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Constructor
+MeshLoader::MeshLoader()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Destructor
+MeshLoader::~MeshLoader()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
 // Load a mesh from file
 void MeshLoader::Load(const std::string &filename)
 {

Modified: code/gazebo/trunk/server/MeshLoader.hh
===================================================================
--- code/gazebo/trunk/server/MeshLoader.hh      2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/server/MeshLoader.hh      2009-10-06 13:58:48 UTC (rev 
8279)
@@ -62,6 +62,12 @@
   /// \brief This class will load vertex information for a mesh
   class MeshLoader
   {
+    /// \brief Constructor
+    public: MeshLoader();
+
+    /// \brief Destructor
+    public: virtual ~MeshLoader();
+
     /// \brief Load a mesh from file
     public: void Load(const std::string &filename);
 
@@ -94,7 +100,7 @@
                if (id == 0x1000)
                {
                  std::string version = ReadString(file);
-                 printf("Version %s\n",version.c_str());
+                 //printf("Version %s\n",version.c_str());
                  return true;
                }
   
@@ -163,14 +169,17 @@
               return sizeof(this->id) + sizeof(this->length);
             }
   
-    public: void Read(FILE *file)
+    public: bool Read(FILE *file)
             {
               if (!feof(file) && 
                   fread(&this->id, sizeof(this->id), 1, file) < 1)
-                printf("Error in Read\n");
+                return false;
+                
               if (!feof(file) && 
                   fread(&this->length, sizeof(this->length), 1, file) < 1)
-                printf("Error in Read\n");
+                return false;
+
+              return true;
             }
   };
 }

Modified: code/gazebo/trunk/server/Model.cc
===================================================================
--- code/gazebo/trunk/server/Model.cc   2009-10-06 13:09:14 UTC (rev 8278)
+++ code/gazebo/trunk/server/Model.cc   2009-10-06 13:58:48 UTC (rev 8279)
@@ -414,9 +414,6 @@
 
   Pose3d bodyPose, newPose, oldPose;
 
-  if (this->GetName() == "wood_pallet")
-    std::cout << "Pose[" << this->GetPose().pos << "]\n";
-
 #ifdef TIMING
   double tmpT1 = Simulator::Instance()->GetWallTime();
 #endif

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/server/Simulator.cc       2009-10-06 13:58:48 UTC (rev 
8279)
@@ -74,8 +74,6 @@
   selectedBody(NULL)
 {
   this->mutex = new boost::recursive_mutex();
-
-  printf("Simulator Init\n");
   this->startTime = this->GetWallTime();
 }
 

Modified: code/gazebo/trunk/server/physics/Geom.cc
===================================================================
--- code/gazebo/trunk/server/physics/Geom.cc    2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/server/physics/Geom.cc    2009-10-06 13:58:48 UTC (rev 
8279)
@@ -137,8 +137,6 @@
 
   this->contact->Load(node);
 
-  std::cout << "Loading geom[" << this->GetName() << "]\n";
-
   this->LoadChild(node);
 
   this->body->AttachGeom(this);

Modified: code/gazebo/trunk/server/physics/TrimeshGeom.cc
===================================================================
--- code/gazebo/trunk/server/physics/TrimeshGeom.cc     2009-10-06 13:09:14 UTC 
(rev 8278)
+++ code/gazebo/trunk/server/physics/TrimeshGeom.cc     2009-10-06 13:58:48 UTC 
(rev 8279)
@@ -95,6 +95,8 @@
 /// Load the trimesh
 void TrimeshGeom::LoadChild(XMLConfigNode *node)
 {
+  MeshLoader *meshLoader;
+
   unsigned int numVertices = 0;
   unsigned int numIndices = 0;
   float *vertices = NULL;
@@ -102,21 +104,18 @@
 
   this->meshNameP->Load(node);
   this->scaleP->Load(node);
-  
-  if (!Simulator::Instance()->GetRenderEngineEnabled())
-    gzthrow("Trimesh objects are not supported when running Gazebo without 
rendering engine");
 
-  MeshLoader meshLoader;
-  meshLoader.Load( this->meshNameP->GetValue() );
+  meshLoader = new MeshLoader();
+  meshLoader->Load( this->meshNameP->GetValue() );
 
-  numIndices = meshLoader.GetNumIndices();
-  numVertices = meshLoader.GetNumVertices();
+  numIndices = meshLoader->GetNumIndices();
+  numVertices = meshLoader->GetNumVertices();
 
   // Create the vertex and index arrays
   vertices = new float[numVertices*3];
   indices = new unsigned int[numIndices];
 
-  meshLoader.FillArrays(&vertices, &indices);
+  meshLoader->FillArrays(&vertices, &indices);
 
   for (unsigned int i=0; i < numVertices; i++)
   {
@@ -142,6 +141,8 @@
 
   memset(this->matrix_dblbuff,0,32*sizeof(dReal));
   this->last_matrix_index = 0;
+
+  delete meshLoader;
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/rendering/UserCamera.cc
===================================================================
--- code/gazebo/trunk/server/rendering/UserCamera.cc    2009-10-06 13:09:14 UTC 
(rev 8278)
+++ code/gazebo/trunk/server/rendering/UserCamera.cc    2009-10-06 13:58:48 UTC 
(rev 8279)
@@ -89,7 +89,6 @@
 
   this->renderTarget = this->window;
 
-  printf("User Camera Init\n");
   this->lastUpdate = Simulator::Instance()->GetRealTime();
 }
 

Modified: code/gazebo/trunk/worlds/trimesh.world
===================================================================
--- code/gazebo/trunk/worlds/trimesh.world      2009-10-06 13:09:14 UTC (rev 
8278)
+++ code/gazebo/trunk/worlds/trimesh.world      2009-10-06 13:58:48 UTC (rev 
8279)
@@ -14,7 +14,7 @@
   
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller";
   xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics"; 
>
 
-  <verbosity>5</verbosity>
+  <verbosity>1</verbosity>
 
   <physics:ode>
     <stepTime>0.0001</stepTime>


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to