Revision: 7989
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7989&view=rev
Author:   robotos
Date:     2009-07-11 02:18:03 +0000 (Sat, 11 Jul 2009)

Log Message:
-----------
GetModelFiducialID to SimulationIface. Catch closing interfaces without opening 
them

Modified Paths:
--------------
    code/gazebo/trunk/libgazebo/Client.cc
    code/gazebo/trunk/libgazebo/Iface.cc
    code/gazebo/trunk/libgazebo/SimIface.cc
    code/gazebo/trunk/libgazebo/gazebo.h

Modified: code/gazebo/trunk/libgazebo/Client.cc
===================================================================
--- code/gazebo/trunk/libgazebo/Client.cc       2009-07-11 01:08:17 UTC (rev 
7988)
+++ code/gazebo/trunk/libgazebo/Client.cc       2009-07-11 02:18:03 UTC (rev 
7989)
@@ -220,7 +220,7 @@
     // No semaphore, so no server
     if (errno == ENOENT)
     {
-      throw("No semphaore, so no server");
+      throw("No semaphore, so no server");
     }
 
     // Ooops, some kind of error

Modified: code/gazebo/trunk/libgazebo/Iface.cc
===================================================================
--- code/gazebo/trunk/libgazebo/Iface.cc        2009-07-11 01:08:17 UTC (rev 
7988)
+++ code/gazebo/trunk/libgazebo/Iface.cc        2009-07-11 02:18:03 UTC (rev 
7989)
@@ -74,6 +74,8 @@
   this->client = NULL;
 
   this->creator = false;
+
+  this->mMap = NULL;
 }
 
 
@@ -327,6 +329,11 @@
 // Close the interface (client)
 void Iface::Close()
 {
+  if (this->mMap == 0) //Closing without opening!
+  {
+    throw("mmap file not opened. Closing interface without opening it first?");
+  }
+
   ((GazeboData*)this->mMap)->openCount--;
 
   if (((GazeboData*)this->mMap)->openCount <= 0)

Modified: code/gazebo/trunk/libgazebo/SimIface.cc
===================================================================
--- code/gazebo/trunk/libgazebo/SimIface.cc     2009-07-11 01:08:17 UTC (rev 
7988)
+++ code/gazebo/trunk/libgazebo/SimIface.cc     2009-07-11 02:18:03 UTC (rev 
7989)
@@ -532,3 +532,29 @@
 
   return true;
 }
+////////////////////////////////////////////////////////////////////////////////
+/// Get the Fiducial ID of this model 
+bool SimulationIface::GetModelFiducialID(const char *modelName, unsigned int 
&id)
+{
+  this->Lock(1);
+
+  this->data->responseCount = 0;
+  SimulationRequestData *request;
+ 
+  request = &(this->data->requests[this->data->requestCount++]);
+  request->type = SimulationRequestData::GET_MODEL_FIDUCIAL_ID;
+
+  memset(request->modelName, 0, 512);
+  strncpy(request->modelName, modelName, 512);
+  request->modelName[511] = '\0';
+
+  this->Unlock();
+
+  if (!this->WaitForResponse())
+    return false;
+
+  assert(this->data->responseCount == 1);
+  id = data->responses[0].uintValue;
+
+  return true;
+}

Modified: code/gazebo/trunk/libgazebo/gazebo.h
===================================================================
--- code/gazebo/trunk/libgazebo/gazebo.h        2009-07-11 01:08:17 UTC (rev 
7988)
+++ code/gazebo/trunk/libgazebo/gazebo.h        2009-07-11 02:18:03 UTC (rev 
7989)
@@ -590,6 +590,9 @@
   /// \brief Get the extents of a model
   public: bool GetModelExtent(const char *modelName, Vec3 &ext);
 
+  /// \brief Get the model Fiducial ID (if one global ID was set)
+  public: bool GetModelFiducialID(const char *modelName, unsigned int &id);
+
   public: void GoAckWait();
   public: void GoAckPost();
 


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

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to