Revision: 8527
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8527&view=rev
Author:   rtv
Date:     2010-01-25 22:33:23 +0000 (Mon, 25 Jan 2010)

Log Message:
-----------
tracking websim changes

Modified Paths:
--------------
    code/stage/trunk/CMakeLists.txt
    code/stage/trunk/examples/ctrl/sink.cc
    code/stage/trunk/examples/ctrl/source.cc
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/libstage/worldgui.cc
    code/stage/trunk/webstage/CMakeLists.txt
    code/stage/trunk/webstage/webstage.cc
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt     2010-01-24 14:27:08 UTC (rev 8526)
+++ code/stage/trunk/CMakeLists.txt     2010-01-25 22:33:23 UTC (rev 8527)
@@ -165,14 +165,6 @@
   MESSAGE( ${INDENT} "Player not detected. If Player is installed but not 
detected, check your PKG_CONFIG_PATH." )
 ENDIF( PLAYER_FOUND )
 
-pkg_search_module( WEBSIM websim )
-IF( WEBSIM_FOUND )
-  MESSAGE( STATUS ${INDENT} "WebSim version ${WEBSIM_VERSION} detected at 
${WEBSIM_PREFIX}" )
-#  MESSAGE( STATUS "    WEBSIM_CFLAGS = ${WEBSIM_CFLAGS}" )
-#  MESSAGE( STATUS "    WEBSIM_LDFLAGS = ${WEBSIM_LDFLAGS}" )
-ELSE( WEBSIM_FOUND )
-  MESSAGE( ${INDENT} "WebSim not detected." )
-ENDIF( WEBSIM_FOUND )
 
 ## this should not be necessary now that we do the FLTK config
 ## carefully above. I'll leave the code here in case of trouble
@@ -196,14 +188,12 @@
                     replace 
                     ${LIBPNG_INCLUDE_DIRS}
                     ${CMAKE_INCLUDE_PATH}
-                                ${WEBSIM_INCLUDE_DIRS}
 )
 
 
 # all targets need these library directories
 link_directories( 
        ${LIBPNG_LIBRARY_DIRS}
-   ${WEBSIM_LIBRARY_DIRS}
 )
 
 # work through these subdirs
@@ -211,11 +201,8 @@
 ADD_SUBDIRECTORY(examples)
 ADD_SUBDIRECTORY(assets)
 ADD_SUBDIRECTORY(worlds)
+ADD_SUBDIRECTORY(webstage)              
 
-# if( WEBSIM_FOUND )
-# ADD_SUBDIRECTORY(webstage)            
-# endif( WEBSIM_FOUND )
-
 IF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND )
   ADD_SUBDIRECTORY(libstageplugin)
 ENDIF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND )  

Modified: code/stage/trunk/examples/ctrl/sink.cc
===================================================================
--- code/stage/trunk/examples/ctrl/sink.cc      2010-01-24 14:27:08 UTC (rev 
8526)
+++ code/stage/trunk/examples/ctrl/sink.cc      2010-01-25 22:33:23 UTC (rev 
8527)
@@ -1,7 +1,7 @@
 #include "stage.hh"
 using namespace Stg;
 
-const int INTERVAL = 50;
+const int INTERVAL = 20;
 
 int Update( Model* mod, void* dummy );
 

Modified: code/stage/trunk/examples/ctrl/source.cc
===================================================================
--- code/stage/trunk/examples/ctrl/source.cc    2010-01-24 14:27:08 UTC (rev 
8526)
+++ code/stage/trunk/examples/ctrl/source.cc    2010-01-25 22:33:23 UTC (rev 
8527)
@@ -1,7 +1,7 @@
 #include "stage.hh"
 using namespace Stg;
 
-const int INTERVAL = 200;
+const int INTERVAL = 100;
 const double FLAGSZ = 0.4;
 
 int Update( Model* mod, void* dummy );

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2010-01-24 14:27:08 UTC (rev 8526)
+++ code/stage/trunk/libstage/model.cc  2010-01-25 22:33:23 UTC (rev 8527)
@@ -228,7 +228,7 @@
   laser_return( LaserVisible ),
   obstacle_return( true ),
   ranger_return( true )
-{ /* nothing do do */ }
+{ /* nothing to do */ }
 
 //static const members
 static const double DEFAULT_FRICTION = 0.0;
@@ -261,8 +261,8 @@
 
 // constructor
 Model::Model( World* world,
-                                 Model* parent,
-                                 const std::string& type ) :
+                                                       Model* parent,
+                                                       const std::string& type 
) :
   Ancestor(),   
   alwayson(false),
   blockgroup(),
@@ -271,43 +271,43 @@
   color( 1,0,0 ), // red
   data_fresh(false),
   disabled(false),
-        cv_list(),
-    flag_list(),
-    geom(),
-    has_default_block( true ),
-    id( Model::count++ ),
-    interval((stg_usec_t)1e5), // 100msec
-    interval_energy((stg_usec_t)1e5), // 100msec
-    interval_pose((stg_usec_t)1e5), // 100msec
-    last_update(0),
-        log_state(false),
-    map_resolution(0.1),
-    mass(0),
-    parent(parent),
-    pose(),
-        power_pack( NULL ),
-        pps_charging(),
-        rastervis(),
-    rebuild_displaylist(true),
-    say_string(),
-    stack_children( true ),
-    stall(false),       
+       cv_list(),
+       flag_list(),
+       geom(),
+       has_default_block( true ),
+       id( Model::count++ ),
+       interval((stg_usec_t)1e5), // 100msec
+       interval_energy((stg_usec_t)1e5), // 100msec
+       interval_pose((stg_usec_t)1e5), // 100msec
+       last_update(0),
+       log_state(false),
+       map_resolution(0.1),
+       mass(0),
+       parent(parent),
+       pose(),
+       power_pack( NULL ),
+       pps_charging(),
+       rastervis(),
+       rebuild_displaylist(true),
+       say_string(),
+       stack_children( true ),
+       stall(false),    
        subs(0),
        thread_safe( false ),
        trail(trail_length),
        trail_index(0),
        type(type),     
-        event_queue_num( 0 ),
-    used(false),
+       event_queue_num( 0 ),
+       used(false),
        velocity(),
        velocity_enable( false ),
        watts(0.0),
-        watts_give(0.0),
-        watts_take(0.0),        
-    wf(NULL),
-    wf_entity(0),
-    world(world),
-        world_gui( dynamic_cast<WorldGui*>( world ) )
+       watts_give(0.0),
+       watts_take(0.0),         
+       wf(NULL),
+       wf_entity(0),
+       world(world),
+       world_gui( dynamic_cast<WorldGui*>( world ) )
 {
   //assert( modelsbyid );
   assert( world );
@@ -952,6 +952,11 @@
     world->NeedRedraw();
 }
 
+void Model::Redraw( void )
+{
+       world->Redraw();
+}
+
 Model* Model::GetUnusedModelOfType( const std::string& type )
 {
   //printf( "searching for type %d in model %s type %d\n", type, token, 
this->type );

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2010-01-24 14:27:08 UTC (rev 8526)
+++ code/stage/trunk/libstage/stage.hh  2010-01-25 22:33:23 UTC (rev 8527)
@@ -799,6 +799,7 @@
                  avoids searching the whole world for fiducials. */
         ModelPtrVec models_with_fiducials;
         
+                               
         /** Add a model to the set of models with non-zero fiducials, if not 
already there. */
         void FiducialInsert( Model* mod )
         { 
@@ -855,8 +856,13 @@
     virtual void Stop(){ paused = true; };
     virtual void TogglePause(){ paused ? Start() : Stop(); };
 
-        bool Paused(){ return( paused ); };
-       
+               bool Paused(){ return( paused ); };
+               
+               /** Force the GUI to redraw the world, even if paused. This
+                               imlementation does nothing, but can be 
overridden by
+                               subclasses. */
+               virtual void Redraw( void ){ }; // does nothing
+
         PointIntVec rt_cells;
         PointIntVec rt_candidate_cells;
 
@@ -1424,7 +1430,10 @@
        
     WorldGui(int W,int H,const char*L=0);
     ~WorldGui();
-       
+
+               /** Forces the window to be redrawn, even if paused.*/
+               virtual void Redraw( void );
+
     virtual std::string ClockString() const;
     virtual bool Update();     
     virtual void Load( const char* filename );
@@ -2087,7 +2096,10 @@
         /** Sets the redraw flag, so this model will be redrawn at the
                  earliest opportunity */
         void NeedRedraw();
-       
+               
+               /** Force the GUI (if any) to redraw this model */
+               void Redraw();
+
         /** Add a block to this model by loading it from a worldfile
                  entity */
         void LoadBlock( Worldfile* wf, int entity );

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2010-01-24 14:27:08 UTC (rev 8526)
+++ code/stage/trunk/libstage/world.cc  2010-01-25 22:33:23 UTC (rev 8527)
@@ -155,6 +155,7 @@
   ground = new Model(this, NULL, "model");
   assert(ground);
   ground->SetToken( "_ground_model" ); // allow users to identify this unique 
model
+       AddModelName( ground, ground->Token() ); // add this name to the 
world's table
   ground->ClearBlocks();
   ground->SetGuiMove(false);
 }

Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc       2010-01-24 14:27:08 UTC (rev 
8526)
+++ code/stage/trunk/libstage/worldgui.cc       2010-01-25 22:33:23 UTC (rev 
8527)
@@ -560,6 +560,12 @@
         wg->SetTimeouts();  
 }
 
+void WorldGui::Redraw()
+{
+       puts( "redrawing\n" );
+       canvas->redraw();
+}
+
 void WorldGui::Start()
 {
   World::Start();

Modified: code/stage/trunk/webstage/CMakeLists.txt
===================================================================
--- code/stage/trunk/webstage/CMakeLists.txt    2010-01-24 14:27:08 UTC (rev 
8526)
+++ code/stage/trunk/webstage/CMakeLists.txt    2010-01-25 22:33:23 UTC (rev 
8527)
@@ -1,10 +1,24 @@
-MESSAGE( STATUS "Configuring webstage" )
+MESSAGE( STATUS "Looking for WebSim" )
 
-add_executable( webstage webstage.cc )
+pkg_search_module( WEBSIM websim )
+IF( WEBSIM_FOUND )
+  MESSAGE( STATUS ${INDENT} "WebSim version ${WEBSIM_VERSION} detected at 
${WEBSIM_PREFIX}" )
+  MESSAGE( STATUS "    WEBSIM_CFLAGS = ${WEBSIM_CFLAGS}" )
+  MESSAGE( STATUS "    WEBSIM_LDFLAGS = ${WEBSIM_LDFLAGS}" )
+  MESSAGE( STATUS "    WEBSIM_INCLUDE_DIRS = ${WEBSIM_INCLUDE_DIRS}" )
+  MESSAGE( STATUS "    WEBSIM_LIBRARY_DIRS = ${WEBSIM_LIBRARY_DIRS}" )
+  MESSAGE( STATUS "Configuring webstage" )
+  include_directories( ${WEBSIM_INCLUDE_DIRS} )
+  link_directories( ${WEBSIM_LIBRARY_DIRS} )
+  add_executable( webstage webstage.cc )
+  target_link_libraries( webstage stage event ${WEBSIM_LIBRARIES} )
 
-target_link_libraries( webstage  ${WEBSIM_LIBRARIES} event stage )
+  INSTALL(TARGETS webstage RUNTIME DESTINATION bin )
 
-INSTALL(TARGETS webstage
-       RUNTIME DESTINATION bin
-)
+ELSE( WEBSIM_FOUND )
+  MESSAGE( ${INDENT} "WebSim not detected." )
+ENDIF( WEBSIM_FOUND )
 
+
+
+

Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc       2010-01-24 14:27:08 UTC (rev 
8526)
+++ code/stage/trunk/webstage/webstage.cc       2010-01-25 22:33:23 UTC (rev 
8527)
@@ -72,67 +72,67 @@
   }
  
 
-  void Push( const std::string& name )
-  {
-        Stg::Model* mod = world->GetModel( name.c_str() );
+  // void Push( const std::string& name )
+  // {
+       //  Stg::Model* mod = world->GetModel( name.c_str() );
 
-        if( mod )
-               {
-                 websim::Pose p;
-                 websim::Velocity v;
-                 websim::Acceleration a;
+       //  if( mod )
+       //      {
+       //        websim::Pose p;
+       //        websim::Velocity v;
+       //        websim::Acceleration a;
 
-                 Stg::Pose sp = mod->GetPose(); 
-                 p.x = sp.x;
-                 p.y = sp.y;
-                 p.z = sp.z;
-                 p.a = sp.a;
+       //        Stg::Pose sp = mod->GetPose(); 
+       //        p.x = sp.x;
+       //        p.y = sp.y;
+       //        p.z = sp.z;
+       //        p.a = sp.a;
                  
-                 Stg::Velocity sv = mod->GetVelocity(); 
-                 v.x = sv.x;
-                 v.y = sv.y;
-                 v.z = sv.z;
-                 v.a = sv.a;
+       //        Stg::Velocity sv = mod->GetVelocity(); 
+       //        v.x = sv.x;
+       //        v.y = sv.y;
+       //        v.z = sv.z;
+       //        v.a = sv.a;
 
-                 SetPuppetPVA( name, p, v, a );
-               }
-        else
-               printf( "Warning: attempt to push PVA for unrecognized model 
\"%s\"\n",
-                                 name.c_str() );
-  }
+       //        SetPuppetPVA( name, p, v, a );
+       //      }
+       //  else
+       //      printf( "Warning: attempt to push PVA for unrecognized model 
\"%s\"\n",
+       //                        name.c_str() );
+  // }
   
-  void Push()
-  {
-        for( std::map<std::string,Puppet*>::iterator it = puppets.begin();
-                       it != puppets.end();
-                       it++ )
-               {
-                 Puppet* pup = it->second;
-                 assert(pup);
+  // void Push()
+  // {
+       //  for( std::map<std::string,Puppet*>::iterator it = puppets.begin();
+       //              it != puppets.end();
+       //              it++ )
+       //      {
+       //        Puppet* pup = it->second;
+       //        assert(pup);
                  
-                 Stg::Model* mod = world->GetModel( pup->name.c_str() );
-                 assert(mod);
+       //        Stg::Model* mod = world->GetModel( pup->name.c_str() );
+       //        assert(mod);
                  
-                 websim::Pose p;
-                 websim::Velocity v;
-                 websim::Acceleration a;
+       //        websim::Pose p;
+       //        websim::Velocity v;
+       //        websim::Acceleration a;
                  
-                 Stg::Pose sp = mod->GetPose(); 
-                 p.x = sp.x;
-                 p.y = sp.y;
-                 p.z = sp.z;
-                 p.a = sp.a;
+       //        Stg::Pose sp = mod->GetPose(); 
+       //        p.x = sp.x;
+       //        p.y = sp.y;
+       //        p.z = sp.z;
+       //        p.a = sp.a;
                  
-                 Stg::Velocity sv = mod->GetVelocity(); 
-                 v.x = sv.x;
-                 v.y = sv.y;
-                 v.z = sv.z;
-                 v.a = sv.a;
+       //        Stg::Velocity sv = mod->GetVelocity(); 
+       //        v.x = sv.x;
+       //        v.y = sv.y;
+       //        v.z = sv.z;
+       //        v.a = sv.a;
                  
-                 pup->Push( p,v,a );
-                 printf( "pushing puppet %s\n", pup->name.c_str() );
-               }
-  }
+       //        pup->Push( p,v,a );
+       //        printf( "pushing puppet %s\n", pup->name.c_str() );
+       //      }
+  // }
 
   virtual bool GetModelChildren(const std::string& model, 
                                                                                
  std::vector<std::string>& children)
@@ -190,6 +190,16 @@
         printf( "delete model name:%s \n", name.c_str() ); 
         return true;
   }
+       
+       const websim::PVA ModToPVA( Model* mod )
+       {
+               // construct a PVA from Stage's values
+               Stg::Pose sp = mod->GetPose(); 
+               Stg::Velocity sv = mod->GetVelocity();          
+               return( websim::PVA( websim::Pose( sp.x, sp.y, sp.z, 0.0, 0.0, 
sp.a ),
+                                                                               
                 websim::Velocity( sv.x, sv.y, sv.z, 0.0, 0.0, sv.a ),
+                                                                               
                 websim::Acceleration() ));
+       }
 
   virtual bool GetModelData(const std::string& name,
        
@@ -198,35 +208,18 @@
                                                                         void* 
xmlparent) {
         std::string str;
         websim::Time t = GetTime();
-
+        
         Model*mod = world->GetModel( name.c_str() );
         if(mod){
-               std::string type = mod->GetModelType();
-               if(type == "position") {
-
-                 websim::Pose p;
-                 websim::Velocity v;
-                 websim::Acceleration a;
-                       
-                 Stg::Pose sp = mod->GetPose(); 
-                 p.x = sp.x;
-                 p.y = sp.y;
-                 p.z = sp.z;
-                 p.a = sp.a;
-
-                 Stg::Velocity sv = mod->GetVelocity(); 
-                 v.x = sv.x;
-                 v.y = sv.y;
-                 v.z = sv.z;
-                 v.a = sv.a;
-               
-                 WebSim::GetPVA(name, t, p, v, a, format, response, xmlparent);
-                       
-                       
-
-               }else if(type == "laser"){
-
-                 uint32_t resolution;
+                std::string type = mod->GetModelType();
+                if(type == "position") 
+                        {                               
+                                response = WebSim::FormatPVA( name, t, 
ModToPVA(mod), format );                        
+                                return true;                   
+                        }
+                else if(type == "laser")
+                        {                       
+                        uint32_t resolution;
                  double fov;
                  websim::Pose p;
                  std::vector<double> ranges;                                   
                                                        
@@ -318,59 +311,68 @@
         return true;
   }
   
-
   virtual bool SetModelPVA(const std::string& name, 
-                                                                       const 
websim::Pose& p,
-                                                                       const 
websim::Velocity& v,
-                                                                       const 
websim::Acceleration& a,
-                                                                       
std::string& error)
+                                                                               
                         const websim::PVA& pva,
+                                                                               
                         std::string& response )
   {
         //printf( "set model PVA name:%s\n", name.c_str() );    
 
         Model* mod = world->GetModel( name.c_str() );
         if( mod )
-               {
-                 mod->SetPose( Stg::Pose( p.x, p.y, p.z, p.a ));
-                 mod->SetVelocity( Stg::Velocity( v.x, v.y, v.z, v.a ));       
         
-                 // stage doesn't model acceleration
-               }
-        else
-               printf( "Warning: attempt to set PVA for unrecognized model 
\"%s\"\n",
-                                 name.c_str() );
+                {
+                        mod->SetPose( Stg::Pose( pva.p.x,  pva.p.y,  pva.p.z,  
pva.p.a ));
+                        mod->SetVelocity( Stg::Velocity(  pva.v.x,  pva.v.y,  
pva.v.z,  pva.v.a ));             
+                        // stage doesn't model acceleration
 
-        return true;
-  }
+                       // force GUI update to see the change if Stage was 
paused
+                       mod->Redraw();
 
+                       response = "OK";
+                       return true;
+               }
+        //else
+        
+        printf( "Warning: attempt to set PVA for unrecognized model \"%s\"\n",
+                                                        name.c_str() );
+        response = "unknown model " + name;
+        return false;
+  }
+       
   virtual bool GetModelPVA(const std::string& name, 
-                                                                       
websim::Time& t,
-                                                                       
websim::Pose& p,
-                                                                       
websim::Velocity& v,
-                                                                       
websim::Acceleration& a,
-                                                                       
std::string& error)
+                                                                               
                         websim::Time& t,
+                                                                               
                         websim::PVA& pva,
+                                                                               
                         std::string& error )
   {
         //printf( "get model name:%s\n", name.c_str() ); 
 
         t = GetTime();
-
+        
         Model* mod = world->GetModel( name.c_str() );
-        if( mod )
-               {
-                 Stg::Pose sp = mod->GetPose(); 
-                 p.x = sp.x;
-                 p.y = sp.y;
-                 p.z = sp.z;
-                 p.a = sp.a;
 
-                 Stg::Velocity sv = mod->GetVelocity(); 
-                 v.x = sv.x;
-                 v.y = sv.y;
-                 v.z = sv.z;
-                 v.a = sv.a;
-               }
-        else
-               printf( "Warning: attempt to set PVA for unrecognized model 
\"%s\"\n",
-                                 name.c_str() );
+        if( !mod  ) 
+                {                       
+                        error = "attempt to set PVA for unrecognized model '" 
+ name + "'";
+                        puts( error.c_str() );
+                        return false;
+                }
 
+        // else model is good   
+        
+        // zero all fields
+        pva.Zero();
+        
+        Stg::Pose sp = mod->GetPose(); 
+        pva.p.x = sp.x;
+        pva.p.y = sp.y;
+        pva.p.z = sp.z;
+        pva.p.a = sp.a;
+        
+        Stg::Velocity sv = mod->GetVelocity(); 
+        pva.v.x = sv.x;
+        pva.v.y = sv.y;
+        pva.v.z = sv.z;
+        pva.v.a = sv.a;
+        
         return true;
   }
   /*
@@ -469,44 +471,37 @@
         }*/
 
   virtual bool GetModelGeometry(const std::string& name,
-                                                                               
  double& x,
-                                                                               
  double& y,
-                                                                               
  double& z,
-                                                                               
  websim::Pose& center,
-                                                                               
  std::string& response)
+                                                                               
                                                websim::Time& t,
+                                                                               
                                                websim::Geometry& geom,
+                                                                               
                                                std::string& error )
   {
-        if(name == "sim"){
-       
-               stg_bounds3d_t ext = world->GetExtent();
-       
-               x = ext.x.max - ext.x.min;
-               y = ext.y.max - ext.y.min;
-               z = ext.z.max - ext.z.min;
-
-        }
-        else
-               {
-                 Model* mod = world->GetModel(name.c_str());
-                 if(mod){
-                        Geom ext = mod->GetGeom();
-       
-                        x = ext.size.x;
-                        y = ext.size.y;
-                        z = ext.size.z;
-                        center.x = ext.pose.x;
-                        center.y = ext.pose.y;
-                        center.a = ext.pose.a;
-                 }
-                 else
-                        {
-                               printf("Warning: attemp to get the extent of 
unrecognized model \"%s\"\n", name.c_str());
+               if(name == "sim")
+                       {
+                               stg_bounds3d_t ext = world->GetExtent();        
+                               geom.extent.x = ext.x.max - ext.x.min;
+                               geom.extent.y = ext.y.max - ext.y.min;
+                               geom.extent.z = ext.z.max - ext.z.min;          
                
+                               return true;
+                       }
+               
+               Model* mod = world->GetModel(name.c_str());
+               if( !mod )
+                       {
+                               error = "Error: attempt to get the geometry of 
unrecognized model \"" + name + "\"";
+                               puts( error.c_str() );
                                return false;           
-                        }
-               }
-        
-        return true;
+                       }
+               
+               Geom ext = mod->GetGeom();      
+               geom.extent.x = ext.size.x;
+               geom.extent.y = ext.size.y;
+               geom.extent.z = ext.size.z;
+               geom.pose.x = ext.pose.x;
+               geom.pose.y = ext.pose.y;
+               geom.pose.a = ext.pose.a;
+               return true;
   }
-
+       
   static int CountRobots(Model * mod, int* n ){
  
         if(n && mod->GetModelType() == "position")
@@ -567,19 +562,12 @@
         return t;
   }
   
-  // add an FLTK event loop update to WebSim's implementation
-  virtual void Wait()
-  {
-        do
-               {
-                 printf( " event loop in wait (%d %d %d)\r",
-                                        unacknowledged_ticks, 
unacknowledged_pushes, ticks_remaining );
-                 
-                 event_loop( EVLOOP_NONBLOCK );                 
-                 Fl::check();                    
-               }
-        while( unacknowledged_ticks || unacknowledged_pushes || 
ticks_remaining );               
-  }
+       // add an FLTK event loop update to WebSim's implementation
+       virtual void Wait()
+       {
+               Check(); // nonblocking check for server events
+               Fl::check(); // nonblocking check for GUI events                
  
+       }
   
 }; // close WebStage class
 
@@ -644,27 +632,25 @@
 
   WebStage ws( world, host, port );
 
-  if( usefedfile )
-        ws.LoadFederationFile( fedfilename );
+  //if( usefedfile )
+               //       ws.LoadFederationFile( fedfilename );
 
   ws.Startup( true ); // start http server
   
   if( ! world->paused ) 
         world->Start(); // start sumulation running
 
-  puts( "entering main loop" );
-
   //close program once time has completed
   bool quit = false;
   while( ! quit )
         {
                // todo? check for changes?
                // send my updates              
-               ws.Push();
+               //ws.Push();
                //puts( "push  done" );
 
                // run one step of the simulation
-               ws.Tick();
+               //ws.Tick();
                
                //puts( "tick done" );
                
@@ -674,6 +660,9 @@
          
                // wait until everyone report simulation step done
                ws.Wait();                      
+
+               usleep(100); // TODO - loop sensibly here
+
                //puts( "wait done" );
         }
 

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2010-01-24 14:27:08 UTC (rev 8526)
+++ code/stage/trunk/worlds/fasr.world  2010-01-25 22:33:23 UTC (rev 8527)
@@ -7,7 +7,7 @@
 include "map.inc"
 include "sick.inc"
 
-speedup 10
+speedup 10.000
 paused 1
 
 # time at which to pause (in GUI mode) or quit (in headless mode) the 
simulation
@@ -16,16 +16,16 @@
 
 resolution 0.02
 
- threads 0
+threads 0
 
 # configure the GUI window
 window
 ( 
   size [ 683.000 713.000 ] 
 
-  center [ -0.180 -1.009 ] 
+  center [ 1.477 -5.626 ] 
   rotate [ 0 0 ]
-  scale 35.284 
+  scale 19.306 
   
   show_data 1
   show_flags 1
@@ -63,7 +63,7 @@
 (
   pose [0.240 0 -0.100 0 ] 
   size [0.120 0.050 0.100] 
-  take_watts 1000.0 
+  take_watts 2000.0 
   color "orange" 
   obstacle_return 0
 )
@@ -83,7 +83,7 @@
     color "yellow"
     size [ 0.050 0.200 0.100 ]
     joules -1  # provides infinite energy
-    give_watts 1000 
+    give_watts 2000 
     fiducial_return 2 # look for this in the fiducial sensor
         
         alwayson 1 # so we give charge without any explicit subscriber
@@ -91,10 +91,18 @@
 
 )
 
-charge_station(  pose [ 7.940 -2.000 0 0 ] )
-charge_station(  pose [ 7.940 -3.000 0 0 ] )
-charge_station(  pose [ 7.940 -4.000 0 0 ] )
+charge_station(  pose [ 7.908 -2.510 0 0 ] )
+charge_station(  pose [ 7.920 -3.847 0 0 ] )
+charge_station(  pose [ 7.449 -4.974 0 -40.107 ] )
+charge_station(  pose [ 7.698 -1.432 0 31.513 ] )
+charge_station(  pose [ 5.162 -0.814 0 88.809 ] )
 
+charge_station(  pose [ 3.927 -0.693 0 88.808 ] )
+charge_station(  pose [ 6.427 -0.964 0 74.484 ] )
+#charge_station(  pose [ 4.964 -0.752 0 88.808 ] )
+#charge_station(  pose [ 3.832 -0.704 0 91.673 ] )
+#charge_station(  pose [ 7.949 -4.019 0 0 ] )
+
 define autorob pioneer2dx                
 (               
  sicklaser( samples 32 range_max 5 laser_return 2 watts 30 )
@@ -108,27 +116,51 @@
  # trail_length 0
 )
 
-autorob( pose [7.062 -1.563 0 152.684] joules 300000 name "r0" )
+autorob( pose [5.967 -3.269 0 152.684] joules 300000 name "r0" )
 autorob( pose [-7.444 -7.348 0 125.831] joules 100000 name "r1" )
 autorob( pose [5.043 3.459 0 174.453] joules 200000 )
 autorob( pose [-3.501 -3.827 0 -117.456] joules 400000 )
 autorob( pose [-1.782 7.123 0 44.991] joules 100000 )
+
 autorob( pose [-6.224 4.313 0 35.145] joules 200000 )
 autorob( pose [-4.373 -4.515 0 -143.181] joules 300000 )
 autorob( pose [3.975 7.410 0 0] joules 400000 )
 autorob( pose [6.796 4.223 0 -89.994] joules 100000 )
 autorob( pose [-6.679 -4.488 0 90.003] joules 200000 )
 
-#autorob( pose [-5.333 -7.515 0 -1.811] )
-#autorob( pose [-1.496 1.724 0 -116.317]  )
-#autorob( pose [7.122 4.175 0 -31.440]  )
-#autorob( pose [5.944 6.951 0 2.937] )
-#autorob( pose [6.405 5.291 0 -103.060] )
-#autorob( pose [5.974 5.725 0 -103.060] )
-#autorob( pose [4.151 7.272 0 53.540] )
-#autorob( pose [6.545 7.459 0 2.937] )
-#autorob( pose [7.237 7.533 0 34.450] )
-#autorob( pose [3.875 6.533 0 134.717] )
-#autorob( pose [3.944 4.674 0 -103.060] )
-#autorob( pose [4.634 6.897 0 -103.060] )
+autorob( pose [-5.333 -7.515 0 -1.811] )
+autorob( pose [-1.496 1.724 0 -116.317]  )
+autorob( pose [7.462 3.892 0 -31.440]  )
+autorob( pose [5.944 6.951 0 2.937] )
+autorob( pose [6.405 5.291 0 -103.060] )
 
+autorob( pose [5.974 5.725 0 -103.060] )
+autorob( pose [2.479 5.713 0 53.540] )
+autorob( pose [7.503 6.594 0 2.937] )
+autorob( pose [6.959 3.268 0 34.450] )
+autorob( pose [4.617 6.811 0 134.717] )
+
+autorob( pose [6.545 7.366 0 2.937] )
+autorob( pose [7.237 7.533 0 34.450] )
+autorob( pose [3.875 6.533 0 134.717] )
+autorob( pose [3.944 4.674 0 -103.060] )
+autorob( pose [4.776 5.792 0 -103.060] )
+
+autorob( pose [3.212 3.779 0 -103.060] )
+autorob( pose [2.982 6.577 0 -103.060] )
+autorob( pose [3.189 5.168 0 -103.060] )
+autorob( pose [2.027 6.472 0 -103.060] )
+autorob( pose [3.897 5.537 0 -103.060] )
+
+#autorob( pose [4.974 4.800 0 -103.060] )
+#autorob( pose [2.225 7.350 0 -103.060] )
+#autorob( pose [5.683 4.431 0 -103.060] )
+#autorob( pose [2.055 2.901 0 -103.060] )
+#autorob( pose [1.498 7.310 0 -103.060] )
+
+#autorob( pose [0.366 6.989 0 -103.060] )
+#autorob( pose [5.215 7.601 0 -103.060] )
+#autorob( pose [6.714 6.392 0 -103.060] )
+#autorob( pose [7.418 5.581 0 -103.060] )
+#autorob( pose [2.523 4.878 0 -103.060] )
+


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

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to