Revision: 7916
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7916&view=rev
Author:   asadat
Date:     2009-06-27 00:06:41 +0000 (Sat, 27 Jun 2009)

Log Message:
-----------
added some functionality to simIface for getting interfaces and their types

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

Modified: code/gazebo/trunk/libgazebo/SimIface.cc
===================================================================
--- code/gazebo/trunk/libgazebo/SimIface.cc     2009-06-27 00:04:46 UTC (rev 
7915)
+++ code/gazebo/trunk/libgazebo/SimIface.cc     2009-06-27 00:06:41 UTC (rev 
7916)
@@ -276,8 +276,39 @@
 
   this->Unlock();
 }
+//////////////////////////////////////////////////////////////////////////////////
+/// Get then children of a model
+void SimulationIface::GetChildInterfaces(const char *modelName)
+{
 
-////////////////////////////////////////////////////////////////////////////////
+  this->Lock(1);
+  SimulationRequestData *request = 
&(this->data->requests[this->data->requestCount++]);
+
+  request->type = gazebo::SimulationRequestData::GET_MODEL_INTERFACES;
+
+  memset(request->modelName, 0, 512);
+  strncpy(request->modelName, modelName, 512);
+  request->modelName[511] = '\0';
+
+  this->Unlock();
+
+}
+///////////////////////////////////////////////////////////////////////////////////
+/// \brief Get the Type of a model e.g. "laser" "model" "fiducial"
+void SimulationIface::GetInterfaceType(const char *modelName)
+{
+  this->Lock(1);
+  SimulationRequestData *request = 
&(this->data->requests[this->data->requestCount++]);
+
+  request->type = gazebo::SimulationRequestData::GET_INTERFACE_TYPE;
+
+  memset(request->modelName, 0, 512);
+  strncpy(request->modelName, modelName, 512);
+  request->modelName[511] = '\0';
+
+  this->Unlock();
+}
+///////////////////////////////////////////////////////////////////////////////
 // Wait for a post on the go ack semaphore
 void SimulationIface::GoAckWait()
 {

Modified: code/gazebo/trunk/libgazebo/gazebo.h
===================================================================
--- code/gazebo/trunk/libgazebo/gazebo.h        2009-06-27 00:04:46 UTC (rev 
7915)
+++ code/gazebo/trunk/libgazebo/gazebo.h        2009-06-27 00:06:41 UTC (rev 
7916)
@@ -413,6 +413,7 @@
 */
 
 #define GAZEBO_SIMULATION_MAX_REQUESTS 128
+#define GAZEBO_MAX_NUMBER_OF_CHILDREN 256
 
 class SimulationRequestData
 {
@@ -426,12 +427,15 @@
                       SET_POSE2D,
                       SET_STATE,
                       GO,
-                      GET_MODEL_TYPE,
+                     GET_MODEL_TYPE,
                       GET_NUM_MODELS,
                       GET_NUM_CHILDREN,
                       GET_CHILD_NAME,
                       GET_MODEL_NAME,
-                      GET_MODEL_EXTENT
+                      GET_MODEL_EXTENT,
+                     GET_MODEL_INTERFACES, // for getting interfaces as well 
as the models which are ancestors of interfaces
+                     GET_INTERFACE_TYPE   // if the model is not an interface 
'unknown' is returned
+                     
                    };
 
   public: Type type; 
@@ -446,6 +450,10 @@
   public: Vec3 modelLinearAccel;
   public: Vec3 modelAngularAccel;
   public: unsigned int runTime;
+  public: char childInterfaces[GAZEBO_MAX_NUMBER_OF_CHILDREN][512];
+  public: int nChildInterfaces;
+  //public: char modelType[512];
+
 };
 
 /// \brief Simulation interface data
@@ -548,6 +556,13 @@
               const Vec3 &linearVel, const Vec3 &angularVel, 
               const Vec3 &linearAccel, const Vec3 &angularAccel );
 
+
+  /// \brief Get the child interfaces of a model
+  public: void GetChildInterfaces(const char *modelName);
+
+  /// \brief Get the Type of an interface e.g. "laser" "model" "fiducial"
+  public: void GetInterfaceType(const char *modelName);
+
   /// \brief Get the type of this model
   public: bool GetModelType(const char *modelName, std::string &type);
 
@@ -567,6 +582,7 @@
   /// \brief Get the extents of a model
   public: bool GetModelExtent(const char *modelName, Vec3 &ext);
 
+
   public: void GoAckWait();
   public: void GoAckPost();
 


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

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to