Revision: 7660
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7660&view=rev
Author:   robotos
Date:     2009-05-14 13:50:38 +0000 (Thu, 14 May 2009)

Log Message:
-----------
we are not using integers as error detectors but exceptions so change functions 
to return void

Modified Paths:
--------------
    code/gazebo/trunk/server/Model.cc
    code/gazebo/trunk/server/Model.hh
    code/gazebo/trunk/server/Simulator.cc
    code/gazebo/trunk/server/Simulator.hh
    code/gazebo/trunk/server/World.cc
    code/gazebo/trunk/server/World.hh
    code/gazebo/trunk/server/XMLConfig.cc
    code/gazebo/trunk/server/XMLConfig.hh
    code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc
    code/gazebo/trunk/server/gui/Gui.cc
    code/gazebo/trunk/server/main.cc

Modified: code/gazebo/trunk/server/Model.cc
===================================================================
--- code/gazebo/trunk/server/Model.cc   2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/Model.cc   2009-05-14 13:50:38 UTC (rev 7660)
@@ -151,7 +151,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Load the model
-int Model::Load(XMLConfigNode *node, bool removeDuplicate)
+void Model::Load(XMLConfigNode *node, bool removeDuplicate)
 {
   XMLConfigNode *childNode;
   Pose3d pose;
@@ -249,7 +249,6 @@
   this->graphicsHandler = new GraphicsIfaceHandler();
   this->graphicsHandler->Load(this->GetName(), this);
 
-  return 0;
 
   // Get the name of the python module
   
/*this->pName.reset(PyString_FromString(node->GetString("python","",0).c_str()));
@@ -363,7 +362,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Initialize the model
-int Model::Init()
+void Model::Init()
 {
   std::map<std::string, Body* >::iterator biter;
   std::map<std::string, Controller* >::iterator contIter;
@@ -385,12 +384,12 @@
   this->sceneNode->attachObject(this->mtext);
   */
 
-  return this->InitChild();
+  this->InitChild();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Update the model
-int Model::Update()
+void Model::Update()
 {
   std::map<std::string, Body* >::iterator bodyIter;
   std::map<std::string, Controller* >::iterator contIter;
@@ -466,21 +465,21 @@
             << tmpT5-tmpT4 << ")" << std::endl;
   std::cout << "      Models::Update() (" << this->GetName() 
             << ") Total DT (" << tmpT5-tmpT1 << ")" << std::endl;
-  return update_error;
+  gzthrow( update_error );
 #else
-     return this->UpdateChild();
+     this->UpdateChild();
 #endif
 
 
 
 
 
-  return this->UpdateChild();
+  this->UpdateChild();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Finalize the model
-int Model::Fini()
+void Model::Fini()
 {
   std::map<std::string, Body* >::iterator biter;
   std::map<std::string, Controller* >::iterator contIter;
@@ -502,7 +501,7 @@
     this->graphicsHandler = NULL;
   }
 
-  return this->FiniChild();
+  this->FiniChild();
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/Model.hh
===================================================================
--- code/gazebo/trunk/server/Model.hh   2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/Model.hh   2009-05-14 13:50:38 UTC (rev 7660)
@@ -71,32 +71,32 @@
   
     /// \brief Load the model
     /// \param removeDuplicate Remove existing model of same name
-    public: int Load(XMLConfigNode *node, bool removeDuplicate);
+    public: void Load(XMLConfigNode *node, bool removeDuplicate);
   
     /// \brief Save the model
     public: void Save(std::string &prefix, std::ostream &stream);
 
     /// \brief Initialize the model
-    public: int Init();
+    public: void Init();
   
     /// \brief Update the model
     /// \param params Update parameters
-    public: int Update();
+    public: void Update();
   
     /// \brief Finalize the model
-    public: int Fini();
+    public: void Fini();
 
     /// \brief Reset the model
     public: void Reset();
   
     /// \brief Initialize the child model
-    protected: virtual int InitChild() {return 0;}
+    protected: virtual void InitChild() {}
   
     /// \brief Update the child model
-    protected: virtual int UpdateChild() {return 0;}
+    protected: virtual void UpdateChild() {}
   
     /// \brief Finilaize thie child model
-    protected: virtual int FiniChild() {return 0;}
+    protected: virtual void FiniChild() {}
     
     /// \brief Get the type of the model
     public: const std::string &GetType() const;

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2009-05-14 13:35:55 UTC (rev 
7659)
+++ code/gazebo/trunk/server/Simulator.cc       2009-05-14 13:50:38 UTC (rev 
7660)
@@ -245,15 +245,20 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Initialize the simulation
-int Simulator::Init()
+void Simulator::Init()
 {
   this->startTime = this->GetWallTime();
 
   //Initialize the world
-  if (gazebo::World::Instance()->Init() != 0)
-    return -1;
+  try
+  {
+    gazebo::World::Instance()->Init();
+  }
+  catch (GazeboError e)
+  {
+    gzthrow("Failed to Initialize the World\n"  << e);
+  }
 
-  return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/Simulator.hh
===================================================================
--- code/gazebo/trunk/server/Simulator.hh       2009-05-14 13:35:55 UTC (rev 
7659)
+++ code/gazebo/trunk/server/Simulator.hh       2009-05-14 13:50:38 UTC (rev 
7660)
@@ -77,7 +77,7 @@
     public: void Save(const std::string& filename=std::string());
 
     /// \brief Initialize the simulation
-    public: int Init( );
+    public: void Init( );
 
     /// \brief Finalize the simulation
     public: void Fini( );

Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc   2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/World.cc   2009-05-14 13:50:38 UTC (rev 7660)
@@ -187,7 +187,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Initialize the world
-int World::Init()
+void World::Init()
 {
   std::vector< Model* >::iterator miter;
 
@@ -212,12 +212,11 @@
 
   this->graphics->Init();
 
-  return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Update the world
-int World::Update()
+void World::Update()
 {
 
   if (this->simPauseTime > 0)
@@ -270,7 +269,6 @@
   std::cout << " World::Update() Physics engine DT(" << tmpT4-tmpT2 << ")" << 
std::endl;
 #endif
 
-  return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -282,7 +280,7 @@
 
 
////////////////////////////////////////////////////////////////////////////////
 // Finilize the world
-int World::Fini()
+void World::Fini()
 {
   std::vector< Model* >::iterator miter;
 
@@ -303,7 +301,7 @@
     this->simIface->Destroy();
   }
   catch (std::string e)
-  {
+  { 
     gzmsg(-1) << "Problem destroying simIface[" << e << "]\n";
   }
 
@@ -320,8 +318,6 @@
 #ifdef HAVE_OPENAL
   OpenAL::Instance()->Fini();
 #endif
-
-  return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -341,7 +337,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 // Load a model
-int World::LoadEntities(XMLConfigNode *node, Model *parent, bool 
removeDuplicate)
+void World::LoadEntities(XMLConfigNode *node, Model *parent, bool 
removeDuplicate)
 {
   XMLConfigNode *cnode;
   Model *model = NULL;
@@ -358,12 +354,9 @@
   // Load children
   for (cnode = node->GetChild(); cnode != NULL; cnode = cnode->GetNext())
   {
-    if (this->LoadEntities( cnode, model, removeDuplicate ) != 0)
-      return -1;
+    this->LoadEntities( cnode, model, removeDuplicate );
   }
 
-
-  return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -393,8 +386,7 @@
 
   //model->SetParent(parent);
   // Load the model
-  if (model->Load( node, removeDuplicate ) != 0)
-    return NULL;
+  model->Load( node, removeDuplicate );
 
   // Set the model's pose (relative to parent)
   this->SetModelPose(model, model->GetInitPose());

Modified: code/gazebo/trunk/server/World.hh
===================================================================
--- code/gazebo/trunk/server/World.hh   2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/World.hh   2009-05-14 13:50:38 UTC (rev 7660)
@@ -74,16 +74,13 @@
   public: void Save(std::string &prefix, std::ostream &stream);
 
   /// Initialize the world
-  /// \return 0 on success
-  public: int Init();
+  public: void Init();
 
   /// Update the world
-  /// \return 0 on success
-  public: int Update();
+  public: void Update();
 
   /// Finilize the world
-  /// \return 0 on success
-  public: int Fini();
+  public: void Fini();
 
   /// Retun the libgazebo server
   /// \return Pointer the the libgazebo server
@@ -117,8 +114,7 @@
   /// \param node XMLConfg node pointer
   /// \param parent Parent of the model to load
   /// \param removeDuplicate Remove existing model of same name
-  /// \return 0 on success
-  public: int LoadEntities(XMLConfigNode *node, Model *parent, bool 
removeDuplicate);
+  public: void LoadEntities(XMLConfigNode *node, Model *parent, bool 
removeDuplicate);
 
   /// \brief Delete an entity by name
   /// \param name The name of the entity to delete

Modified: code/gazebo/trunk/server/XMLConfig.cc
===================================================================
--- code/gazebo/trunk/server/XMLConfig.cc       2009-05-14 13:35:55 UTC (rev 
7659)
+++ code/gazebo/trunk/server/XMLConfig.cc       2009-05-14 13:50:38 UTC (rev 
7660)
@@ -88,14 +88,17 @@
 
 ////////////////////////////////////////////////////////////////////////////
 //  Save config back into file
-int XMLConfig::Save(const std::string &filename )
+void XMLConfig::Save(const std::string &filename )
 {
   int result=0;
   if (filename == std::string())
     result=xmlSaveFileEnc(this->filename.c_str(), this->xmlDoc, "UTF-8");
   else
     result=xmlSaveFileEnc(filename.c_str(), this->xmlDoc, "UTF-8");
-  return result;
+  if ( result != 0)
+  {
+     gzthrow( "Error saving the XML file back to the disk " );
+  }
 }
 
 

Modified: code/gazebo/trunk/server/XMLConfig.hh
===================================================================
--- code/gazebo/trunk/server/XMLConfig.hh       2009-05-14 13:35:55 UTC (rev 
7659)
+++ code/gazebo/trunk/server/XMLConfig.hh       2009-05-14 13:50:38 UTC (rev 
7660)
@@ -63,7 +63,7 @@
   
     /// \brief Save config back into file
     ///        Set filename to NULL to save back into the original file
-    public: int Save(const std::string &filename );
+    public: void Save(const std::string &filename );
   
     /// \brief Get the root node
     public: XMLConfigNode *GetRootNode() const;

Modified: code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc
===================================================================
--- code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc     2009-05-14 
13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/controllers/imu/Generic_Imu.cc     2009-05-14 
13:50:38 UTC (rev 7660)
@@ -30,7 +30,6 @@
 
 #include "Global.hh"
 #include "XMLConfig.hh"
-#include "Model.hh"
 #include "World.hh"
 #include "gazebo.h"
 #include "GazeboError.hh"

Modified: code/gazebo/trunk/server/gui/Gui.cc
===================================================================
--- code/gazebo/trunk/server/gui/Gui.cc 2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/gui/Gui.cc 2009-05-14 13:50:38 UTC (rev 7660)
@@ -97,6 +97,9 @@
   OgreCreator::Instance()->CreateWindow(this, 1, 1);
 
   this->hasFocus = true;
+
+  Fl::check();
+  Fl::wait(0.3);
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/trunk/server/main.cc
===================================================================
--- code/gazebo/trunk/server/main.cc    2009-05-14 13:35:55 UTC (rev 7659)
+++ code/gazebo/trunk/server/main.cc    2009-05-14 13:50:38 UTC (rev 7660)
@@ -297,7 +297,7 @@
   {
     std::cerr << "Error Loading Gazebo" << std::endl;
     std::cerr << e << std::endl;
-    gazebo::Simulator::Instance()->Fini();
+    gazebo::Simulator::Instance()->Close();
     return -1;
   }
 


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

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to