Revision: 7892
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7892&view=rev
Author:   rtv
Date:     2009-06-24 22:54:06 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
reverted to 3-part URI scheme. added some identification API

Modified Paths:
--------------
    code/gazebo/trunk/webgazebo/WebGazebo.cc
    code/gazebo/trunk/webgazebo/WebGazebo.hh
    code/gazebo/trunk/webgazebo/http.cc
    code/gazebo/trunk/webgazebo/main.cc

Modified: code/gazebo/trunk/webgazebo/WebGazebo.cc
===================================================================
--- code/gazebo/trunk/webgazebo/WebGazebo.cc    2009-06-24 22:39:26 UTC (rev 
7891)
+++ code/gazebo/trunk/webgazebo/WebGazebo.cc    2009-06-24 22:54:06 UTC (rev 
7892)
@@ -38,11 +38,13 @@
 #include "Quatern.hh"
 
 WebGazebo::WebGazebo(const std::string& fedfile,
-                     const std::string& host, unsigned short port,
-                     double dtol, double atol) :
-        websim::WebSim(host, port), 
-        sq_dist_tol(dtol*dtol), 
-       sq_ang_tol(atol*atol)
+                     const std::string& host, 
+                    unsigned short port,
+                     double dtol, 
+                    double atol) :
+  websim::WebSim(host, port), 
+  sq_dist_tol(dtol*dtol), 
+  sq_ang_tol(atol*atol)
 {
   // Hook up to Gazebo
   printf("[webgazebo] Opening Gazebo simulation interface...");
@@ -55,8 +57,8 @@
   // Open the Simulation Interface; let exceptions leak out
   this->simIface->Open(this->client, "default");
   puts( "(opened sim interface)" );
-  //this->factoryIface->Open(this->client, "factory_iface");
-  //puts( "(opened factory interface)" );
+  this->factoryIface->Open(this->client, "factory_model::factory_iface");
+  puts( "(opened factory interface)" );
   puts("Done.");
 
   puts("[webgazebo] Ready");
@@ -68,6 +70,7 @@
   delete this->simIface;
   delete this->client;
 }
+  
 
 /** Get the current simulation time */
 websim::Time 

Modified: code/gazebo/trunk/webgazebo/WebGazebo.hh
===================================================================
--- code/gazebo/trunk/webgazebo/WebGazebo.hh    2009-06-24 22:39:26 UTC (rev 
7891)
+++ code/gazebo/trunk/webgazebo/WebGazebo.hh    2009-06-24 22:54:06 UTC (rev 
7892)
@@ -25,18 +25,9 @@
  * SVN: $Id: gazebo.h 7398 2009-03-09 07:21:49Z natepak $
  */
 
-#include <string>
-#include <map>
+#include <gazebo.h>
+#include <websim.hh>
 
-// These headers must be included prior to the libevent headers
-#include <sys/types.h>
-#include <sys/queue.h>
-
-// libgazebo;
-#include "gazebo.h"
-
-#include "websim.hh"
-
 class WebGazebo : public websim::WebSim
 {
 public:
@@ -45,19 +36,29 @@
            double dtol, double atol);
   virtual ~WebGazebo();
 
-  bool Go(double t);
-    
-  // Interface to be implemented by simulators
+    bool Go(double t);
+  
+  // start WebSim Interface 
============================================================
+  
+  virtual std::string IdentificationString()
+  { return "WebGazebo"; }
+  
+  virtual std::string VersionString()
+  {  return "0.1"; }
+
   virtual bool CreateModel(const std::string& name, 
                           const std::string& type,
                           std::string& error);
+
   virtual bool DeleteModel(const std::string& name,
                           std::string& error);
+
   virtual bool SetModelPVA(const std::string& name, 
                           const websim::Pose& p,
                           const websim::Velocity& v,
                           const websim::Acceleration& a,
                           std::string& error);
+
   virtual bool GetModelPVA(const std::string& name, 
                           websim::Time &t,
                           websim::Pose& p,
@@ -65,42 +66,46 @@
                           websim::Acceleration& a,
                           std::string& error);
 
-  virtual bool GetModelType(const std::string& name, std::string& type){return 
true;}
+  virtual bool GetModelType(const std::string& name, std::string& type)
+  {return true;}
 
-  
-
   virtual bool GetModelData(const std::string& name, 
-                                                                       
std::string& response,
-                                                                       
websim::Format format,
-                                                                       void* 
xmlnode );
-
+                           std::string& response,
+                           websim::Format format,
+                           void* xmlnode );
   
-  
   virtual bool GetModelChildren(const std::string& model, 
-                                                                       
std::vector<std::string>& children){return true;}
+                               std::vector<std::string>& children)
+  {return true;}
   
   virtual bool GetModelExtent(const std::string& name,
                              double& bx,
                              double& by,
                              double& bz,
                              websim::Pose& center,
-                             std::string& response) {return true;}
-
-  virtual bool GetNumberOfRobots(unsigned int& n) {return true;}
+                             std::string& response) 
+  {return true;}
   
-  virtual bool GetSayStrings(std::vector<std::string>& sayings) {return true;}
-
-
+  virtual bool GetNumberOfRobots(unsigned int& n)
+  {return true;}
+  
+  virtual bool GetSayStrings(std::vector<std::string>& sayings) 
+  {return true;}
+    
   /** Get the current simulation time */
   virtual websim::Time GetTime();
 
-private:
+  // end WebSim Interface 
============================================================
+
+
+private: // all private members are specific to WebGazebo
+
   double sq_dist_tol;
   double sq_ang_tol;
-
+  
   boost::mutex goMutex;
   boost::condition goCond;
-
+  
   gazebo::Client *client;
   gazebo::SimulationIface *simIface;
   gazebo::FactoryIface *factoryIface;

Modified: code/gazebo/trunk/webgazebo/http.cc
===================================================================
--- code/gazebo/trunk/webgazebo/http.cc 2009-06-24 22:39:26 UTC (rev 7891)
+++ code/gazebo/trunk/webgazebo/http.cc 2009-06-24 22:54:06 UTC (rev 7892)
@@ -30,19 +30,23 @@
 }
 
 int
-main(void)
+main( int argc, char* argv[] )
 {
-  struct evhttp_connection* ec;
-  struct evhttp_request* er;
-
+  // initialize libevent
   event_init();
-
-  ec = evhttp_connection_new("localhost", 8000);
+  
+  struct evhttp_connection* ec( evhttp_connection_new("localhost", 8000) );
   assert(ec);
+  
+  struct evhttp_request* er(evhttp_request_new(cb, NULL));
+  assert( er );
+ 
+  char* request = (char*)"";
 
-  er = evhttp_request_new(cb, NULL);
+  if( argc == 1 && argv[1] )
+    request = argv[1];
 
-  int ret = evhttp_make_request(ec, er, EVHTTP_REQ_GET, "/foo");
+  int ret = evhttp_make_request(ec, er, EVHTTP_REQ_GET, request );
   printf("ret: %d\n", ret);
 
   event_dispatch();

Modified: code/gazebo/trunk/webgazebo/main.cc
===================================================================
--- code/gazebo/trunk/webgazebo/main.cc 2009-06-24 22:39:26 UTC (rev 7891)
+++ code/gazebo/trunk/webgazebo/main.cc 2009-06-24 22:54:06 UTC (rev 7892)
@@ -51,6 +51,7 @@
   }
 
   WebGazebo wg(g_fedfile, g_host, g_port, g_dtol, g_atol);
+  wg.Startup( true );
 
   for(;;)
   {


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