Revision: 7426
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7426&view=rev
Author:   gerkey
Date:     2009-03-10 05:43:37 +0000 (Tue, 10 Mar 2009)

Log Message:
-----------
Reorg for installation

Modified Paths:
--------------
    code/websim/CMakeLists.txt
    code/websim/src/websim.cc

Added Paths:
-----------
    code/websim/src/websim.h

Removed Paths:
-------------
    code/websim/include/

Modified: code/websim/CMakeLists.txt
===================================================================
--- code/websim/CMakeLists.txt  2009-03-10 05:38:39 UTC (rev 7425)
+++ code/websim/CMakeLists.txt  2009-03-10 05:43:37 UTC (rev 7426)
@@ -11,3 +11,8 @@
 set_target_properties(websim-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
 
 target_link_libraries(websim event)
+
+install(TARGETS websim websim-static 
+        LIBRARY DESTINATION lib
+        ARCHIVE DESTINATION lib)
+install(FILES src/websim.h DESTINATION include/websim)

Modified: code/websim/src/websim.cc
===================================================================
--- code/websim/src/websim.cc   2009-03-10 05:38:39 UTC (rev 7425)
+++ code/websim/src/websim.cc   2009-03-10 05:43:37 UTC (rev 7426)
@@ -25,7 +25,7 @@
  * SVN: $Id: gazebo.h 7398 2009-03-09 07:21:49Z natepak $
  */
 
-#include "websim/websim.h"
+#include "websim.h"
 
 #include <boost/lexical_cast.hpp>
 

Copied: code/websim/src/websim.h (from rev 7425, 
code/websim/include/websim/websim.h)
===================================================================
--- code/websim/src/websim.h                            (rev 0)
+++ code/websim/src/websim.h    2009-03-10 05:43:37 UTC (rev 7426)
@@ -0,0 +1,159 @@
+/*
+ *  WebSim - Library for web-enabling and federating simulators.
+ *  Copyright (C) 2009
+ *    Richard Vaughan, Brian Gerkey, and Nate Koenig
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */ 
+
+/* Desc: HTTP portal to libgazebo
+ * Author: Brian Gerkey
+ * Date: 9 March 2009
+ * SVN: $Id: gazebo.h 7398 2009-03-09 07:21:49Z natepak $
+ */
+
+#include <string>
+#include <vector>
+#include <map>
+
+// These headers must be included prior to the libevent headers
+#include <sys/types.h>
+#include <sys/queue.h>
+
+// libevent
+#include <event.h>
+#include <evhttp.h>
+
+namespace websim
+{
+
+class Pose;
+class Velocity;
+class Acceleration;
+
+class WebSim
+{
+  public:
+    WebSim(const std::string& _fedfile, 
+           const std::string& _host,
+           int _port);
+    virtual ~WebSim();
+
+    void Update();
+
+    // Interface to be implemented by simulators
+    virtual bool CreateModel(const std::string& name, 
+                             const std::string& type,
+                             std::string& error) = 0;
+    virtual bool DeleteModel(const std::string& name,
+                             std::string& error) = 0;
+    virtual bool SetModelPVA(const std::string& name, 
+                             const Pose& p,
+                             const Velocity& v,
+                             const Acceleration& a,
+                             std::string& error) = 0;
+    virtual bool GetModelPVA(const std::string& name, 
+                             Pose& p,
+                             Velocity& v,
+                             Acceleration& a,
+                             std::string& error) = 0;
+
+  protected:
+    void StringSplit(const std::string &s, 
+                     std::vector<std::string> &t, 
+                     const std::string &d);
+
+  private:
+    std::string fedfile;
+    std::string host;
+    int port;
+
+    struct evhttp* eh;
+
+    // Static, so that it can be passed as a callback to libevent
+    static void EventCallback(evhttp_request* req, void* arg);
+
+    bool GetValue(std::string& value,
+                  struct evkeyvalq* query_args, 
+                  const std::string& key);
+    bool HandleURI(const std::string& model,
+                   const std::string& prop,
+                   const std::string& action,
+                   struct evkeyvalq* kv,
+                   std::string& response);
+    bool HandleSimRequest(const std::string& prop,
+                          const std::string& action,
+                          struct evkeyvalq* kv,
+                          std::string& response);
+    bool HandleModelRequest(const std::string& model,
+                            const std::string& prop,
+                            const std::string& action,
+                            struct evkeyvalq* kv,
+                            std::string& response);
+    bool ParseURI(std::string& model,
+                  std::string& prop,
+                  std::string& action,
+                  std::string uri,
+                  std::string& response);
+    void DeleteKeyVal(struct evkeyvalq* query_args);
+};
+
+class Pose
+{
+public:
+  double x,y,z,r,p,a;
+  
+  Pose() :
+        x(0), y(0), z(0), r(0), p(0), a(0)
+  {
+        // nothing to do
+  }
+  
+  Pose( double x, double y, double z,
+                 double r, double p, double a ) :
+        x(x), y(y), z(z), r(r), p(p), a(a)
+  {
+        // nothing to do
+  }
+  
+};
+
+class Velocity : public Pose
+{
+public:
+  Velocity() : Pose()
+  {}
+
+  Velocity( double x, double y, double z,
+                               double r, double p, double a ) :
+        Pose( x, y, z, r, p, a )
+  {}  
+};
+
+class Acceleration : public Pose
+{
+public:
+  Acceleration() : Pose()
+  {}
+        
+  Acceleration( double x, double y, double z,
+                                        double r, double p, double a ) :
+        Pose( x, y, z, r, p, a )
+  {}  
+};
+
+
+}


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