Revision: 6616
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6616&view=rev
Author:   rtv
Date:     2008-06-16 20:43:58 -0700 (Mon, 16 Jun 2008)

Log Message:
-----------
repaired test program

Modified Paths:
--------------
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/test.cc
    code/stage/trunk/libstageplugin/p_driver.cc

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2008-06-17 03:35:12 UTC (rev 6615)
+++ code/stage/trunk/libstage/stage.hh  2008-06-17 03:43:58 UTC (rev 6616)
@@ -1103,9 +1103,9 @@
                                 double ppm = DEFAULT_PPM );
 
        virtual ~StgWorld();
-       
-       FileManager fileMan;
 
+  FileManager fileMan;
+
        stg_usec_t SimTimeNow(void){ return sim_time;} ;
        stg_usec_t RealTimeNow(void);
        stg_usec_t RealTimeSinceStart(void);
@@ -2030,6 +2030,12 @@
        virtual void Load( const char* filename );
        virtual void UnLoad();
        virtual bool Save( const char* filename );
+  
+  /** Set the minimum real time interval between world updates, in
+               microeconds. */
+  void SetRealTimeInterval( stg_usec_t usec )
+  { interval_real = usec; }
+  
 
        // static callback functions
        static void LoadCallback( Fl_Widget* wid, StgWorldGui* world );

Modified: code/stage/trunk/libstage/test.cc
===================================================================
--- code/stage/trunk/libstage/test.cc   2008-06-17 03:35:12 UTC (rev 6615)
+++ code/stage/trunk/libstage/test.cc   2008-06-17 03:43:58 UTC (rev 6616)
@@ -37,8 +37,12 @@
   Init( &argc, &argv);
 
   StgWorldGui world( 400,400, "Test" );
+
+  world.SetRealTimeInterval( 20000 );
+
   world.Start();
 
+
   stg_geom_t geom;
   bzero( &geom, sizeof(geom) );
 
@@ -159,7 +163,7 @@
                //m[i]->PlaceInFreeSpace( -10, 10, -10, 10 );
                top->SetColor( lrand48() | 0xFF000000 );
                
-               interact( &world );
+               //interact( &world );
         }
 
    for( int i=0; i<POP; i++ )
@@ -172,7 +176,7 @@
                
                m[i]->SetVelocity( v );
                                                                
-               interact( &world );
+               //interact( &world );
         }
   
 //   for( int i=0; i<POP; i++ )

Modified: code/stage/trunk/libstageplugin/p_driver.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_driver.cc 2008-06-17 03:35:12 UTC (rev 
6615)
+++ code/stage/trunk/libstageplugin/p_driver.cc 2008-06-17 03:43:58 UTC (rev 
6616)
@@ -564,30 +564,28 @@
   {
     Interface* interface = (Interface*)g_ptr_array_index( this->devices, i );
     assert( interface );
-
+        
     switch( interface->addr.interf )
       {
       case PLAYER_SIMULATION_CODE:
-       //if( stg_world_update( this->world, FALSE ) )
-       world->Cycle();
-       //player_quit = TRUE; // set Player's global quit flag
-       break;
-
+                 world->Update();        
+                 break;
+                 
       default:
-       {
-         // Has enough time elapsed since the last time we published on this
-         // interface?  This really needs some thought, as each model/interface
-         // should have a configurable publishing rate. For now, I'm using the
-         // world's update rate (which appears to be stored as msec).  - BPG
-          double currtime;
-         GlobalTime->GetTimeDouble(&currtime);
-         if((currtime - interface->last_publish_time) >= 
-            (interface->publish_interval_msec / 1e3))
-           {
-             interface->Publish();
-             interface->last_publish_time = currtime;
-           }
-       }
+                 {
+                        // Has enough time elapsed since the last time we 
published on this
+                        // interface?  This really needs some thought, as each 
model/interface
+                        // should have a configurable publishing rate. For 
now, I'm using the
+                        // world's update rate (which appears to be stored as 
msec).  - BPG
+                        double currtime;
+                        GlobalTime->GetTimeDouble(&currtime);
+                        if((currtime - interface->last_publish_time) >= 
+                                (interface->publish_interval_msec / 1e3))
+                               {
+                                 interface->Publish();
+                                 interface->last_publish_time = currtime;
+                               }
+                 }
       }
   }
 }


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to