Revision: 7395
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7395&view=rev
Author:   natepak
Date:     2009-03-09 02:59:16 +0000 (Mon, 09 Mar 2009)

Log Message:
-----------
Added thread stuff to simiface

Modified Paths:
--------------
    code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc
    code/branches/federation/gazebo/libgazebo/SimIface.cc
    code/branches/federation/gazebo/libgazebo/gazebo.h

Modified: 
code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc
===================================================================
--- code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc     
2009-03-09 02:20:29 UTC (rev 7394)
+++ code/branches/federation/gazebo/examples/libgazebo/simiface/simiface.cc     
2009-03-09 02:59:16 UTC (rev 7395)
@@ -54,11 +54,10 @@
     usleep(90000000);
   }*/
 
-  printf("Go\n");
-  simIface->Go(100);
-  printf("Go Done\n");
+  simIface->Go(10e6);
 
 
+  usleep(100000000);
   // Example of resetting the simulator
   // simIface->Reset();
   //usleep(1000000);

Modified: code/branches/federation/gazebo/libgazebo/SimIface.cc
===================================================================
--- code/branches/federation/gazebo/libgazebo/SimIface.cc       2009-03-09 
02:20:29 UTC (rev 7394)
+++ code/branches/federation/gazebo/libgazebo/SimIface.cc       2009-03-09 
02:59:16 UTC (rev 7395)
@@ -1,33 +1,31 @@
 #include <boost/thread/thread.hpp>
+#include <boost/signal.hpp>
 #include <boost/bind.hpp>
 #include <string.h>
 #include "gazebo.h"
 
 using namespace gazebo;
 
-void SimulationIface::BlockThread(unsigned int ms)
+void SimulationIface::BlockThread()
 {
-  printf("Run thread\n");
-  boost::this_thread::sleep(boost::posix_time::milliseconds(ms));
-  printf("Run thread done\n");
+  usleep(this->blockTimeUs);
+  //signal();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Tell gazebo to execute for a specified amount of time
-void SimulationIface::Go(unsigned int ms)
+void SimulationIface::Go(unsigned int us)
 {
   this->Lock(1);
   SimulationRequestData *request = 
&(this->data->requests[this->data->requestCount++]);
   request->type = SimulationRequestData::GO;
-  request->runTime = ms;
+  request->runTime = us;
   this->Unlock();
 
-  printf("Create Thread\n");
-/*  boost::thread *thread = new boost::thread( 
-      boost::bind(&SimulationIface::BlockThread, this, boost::_1)(100) );
-      */
+  this->blockTimeUs = us;
 
-  printf("Thread created\n");
+  boost::thread *thread = new boost::thread( 
+      boost::bind(&SimulationIface::BlockThread, this));
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/branches/federation/gazebo/libgazebo/gazebo.h
===================================================================
--- code/branches/federation/gazebo/libgazebo/gazebo.h  2009-03-09 02:20:29 UTC 
(rev 7394)
+++ code/branches/federation/gazebo/libgazebo/gazebo.h  2009-03-09 02:59:16 UTC 
(rev 7395)
@@ -493,7 +493,8 @@
               const Vec3 &linearVel, const Vec3 &angularVel, 
               const Vec3 &linearAccel, const Vec3 &angularAccel );
 
-  private: void BlockThread(unsigned int ms);
+  private: void BlockThread();
+  private: unsigned int blockTimeUs;
 
   /// Pointer to the simulation data
   public: SimulationData *data;


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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to