Revision: 8211
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8211&view=rev
Author:   rtv
Date:     2009-08-20 21:42:09 +0000 (Thu, 20 Aug 2009)

Log Message:
-----------
fixed alwayson and model property bugs. Fixed stage.pc to include GL and FLTK 
libraries.

Modified Paths:
--------------
    code/stage/trunk/CMakeLists.txt
    code/stage/trunk/examples/ctrl/fasr.cc
    code/stage/trunk/libstage/block.cc
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_load.cc
    code/stage/trunk/libstage/model_props.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/stage.pc.in
    code/stage/trunk/todo.txt
    code/stage/trunk/worlds/fasr.world
    code/stage/trunk/worlds/simple.world

Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt     2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/CMakeLists.txt     2009-08-20 21:42:09 UTC (rev 8211)
@@ -57,10 +57,6 @@
 
 ENABLE_TESTING()
 
-# Create the pkgconfig file
-CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in 
${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
-INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION lib/pkgconfig/)
-
 SET(RGBFILE ${CMAKE_INSTALL_PREFIX}/share/stage/rgb.txt )
 
 # Create the config.h file
@@ -189,6 +185,10 @@
 #      SET(APPLE_LIBRARIES 
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
 #ENDIF (APPLE)
 
+# Create the pkgconfig file
+CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in 
${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
+INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION lib/pkgconfig/)
+
 MESSAGE( STATUS "Installation path 
CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
 
 # all targets need these include directories

Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc      2009-08-19 16:26:15 UTC (rev 
8210)
+++ code/stage/trunk/examples/ctrl/fasr.cc      2009-08-20 21:42:09 UTC (rev 
8211)
@@ -495,7 +495,7 @@
 // Stage calls this when the model starts up
 extern "C" int Init( Model* mod )
 {  
-#if 0          
+#if 1          
   // example using the model rasterizer
   if( strcmp( mod->Token(), "r0" ) == 0 )
         {

Modified: code/stage/trunk/libstage/block.cc
===================================================================
--- code/stage/trunk/libstage/block.cc  2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/libstage/block.cc  2009-08-20 21:42:09 UTC (rev 8211)
@@ -134,7 +134,7 @@
   mod->blockgroup.BuildDisplayList( mod );
 }
 
-Color Block::GetColor()
+const Color& Block::GetColor()
 {
   return( inherit_color ? mod->color : color );
 }
@@ -248,7 +248,7 @@
 void Block::GenerateCandidateCells()
 {
   candidate_cells->clear();
-  
+
   if( mpts.size() == 0 )
        {
          // no valid cache of model coord points, so generate them

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/libstage/model.cc  2009-08-20 21:42:09 UTC (rev 8211)
@@ -189,6 +189,8 @@
                                  Model* parent,
                                  const std::string& type ) :
   Ancestor(),   
+  access_mutex(),
+  alwayson(false),
   blockgroup(),
   blocks_dl(0),
   boundary(false),
@@ -303,6 +305,9 @@
         event_queue_num = thread_safe ? world->GetEventQueue( this ) : 0;
   
   CallCallbacks( &hooks.init );
+
+  if( alwayson )
+        Subscribe();
 }  
 
 void Model::InitRecursive()

Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc     2009-08-19 16:26:15 UTC (rev 
8210)
+++ code/stage/trunk/libstage/model_load.cc     2009-08-20 21:42:09 UTC (rev 
8211)
@@ -227,15 +227,11 @@
        trail_length = wf->ReadInt( wf_entity, "trail_length", trail_length );
        trail_interval = wf->ReadInt( wf_entity, "trail_interval", 
trail_interval );
 
+       this->alwayson = wf->ReadInt( wf_entity, "alwayson",  alwayson );
+
   // call any type-specific load callbacks
   this->CallCallbacks( &hooks.load );
   
-  // MUST BE THE LAST THING LOADED
-  if( wf->PropertyExists( wf_entity, "alwayson" ))
-    {
-      if( wf->ReadInt( wf_entity, "alwayson", 0) > 0 )
-                 Subscribe();
-    }
   
   MapWithChildren();
 

Modified: code/stage/trunk/libstage/model_props.cc
===================================================================
--- code/stage/trunk/libstage/model_props.cc    2009-08-19 16:26:15 UTC (rev 
8210)
+++ code/stage/trunk/libstage/model_props.cc    2009-08-20 21:42:09 UTC (rev 
8211)
@@ -82,8 +82,10 @@
                return 1; // error code
        }
 
+       //printf( "setting property %s %p\n", key, data );
+
        // otherwise it's an arbitary property and we store the pointer
-       //g_datalist_set_data( &this->props, key, (void*)data );
+       //g_datalist_set_data( &this->props, key, (void*)data );        
        props[key] = data;
 
        return 0; // ok
@@ -130,6 +132,8 @@
 {
   char* cp = (char*)GetProperty( key ); 
   
+  //printf( "got model %s property string %s=%s\n", token, key, cp );
+
   if( cp )
         {
                *c = cp;
@@ -154,6 +158,7 @@
 
 void Model::SetPropertyStr( const char* key, const char* str )
 {
+  //printf( "set model %s string %s=%s\n", token, key, str );
   SetProperty( key, (void*)strdup(str) );
 }
 

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/libstage/stage.hh  2009-08-20 21:42:09 UTC (rev 8211)
@@ -1037,7 +1037,7 @@
     Model* GetModel( const char* name ) const;
   
     /** Return the 3D bounding box of the world, in meters */
-    stg_bounds3d_t GetExtent(){ return extent; };
+    const stg_bounds3d_t& GetExtent(){ return extent; };
   
     /** Return the number of times the world has been updated. */
     uint64_t GetUpdateCount() { return updates; }
@@ -1121,9 +1121,9 @@
         std::vector<stg_point_t>& Points()
     { return pts; };            
         
-    void AddToCellArray( CellPtrVec* blocks );
-    void RemoveFromCellArray( CellPtrVec* blocks );
-    void GenerateCandidateCells();  
+    inline void AddToCellArray( CellPtrVec* blocks );
+    inline void RemoveFromCellArray( CellPtrVec* blocks );
+    inline void GenerateCandidateCells();  
 
         void AppendTouchingModels( ModelPtrSet& touchers );
         
@@ -1132,7 +1132,7 @@
     void SwitchToTestedCells();  
     void Load( Worldfile* wf, int entity );  
     Model* GetModel(){ return mod; };  
-    Color GetColor();          
+    const Color& GetColor();           
         void Rasterize( uint8_t* data, 
                                                  unsigned int width, unsigned 
int height,              
                                                  stg_meters_t cellwidth, 
stg_meters_t cellheight );
@@ -1203,8 +1203,8 @@
     ~BlockGroup();
         
     uint32_t GetCount(){ return blocks.size(); };
-    Size GetSize(){ return size; };
-    stg_point3_t GetOffset(){ return offset; };
+    const Size& GetSize(){ return size; };
+    const stg_point3_t& GetOffset(){ return offset; };
 
     /** establish the min and max of all the blocks, so we can scale this
                  group later */
@@ -1670,6 +1670,11 @@
         
   protected:
         pthread_mutex_t access_mutex;
+
+        /** If true, the model always has at least one subscription, so
+                 always runs. Defaults to false. */
+        bool alwayson;
+
         BlockGroup blockgroup;
         /**  OpenGL display list identifier for the blockgroup */
         int blocks_dl;
@@ -1764,7 +1769,7 @@
                  by derived model types to store properties, and for user code
                  to associate arbitrary items with a model. */
         //GData* props;
-        std::map<const char*,const void*> props;
+        std::map<std::string,const void*> props;
 
         /** Visualize the most recent rasterization operation performed by 
this model */
         class RasterVis : public Visualizer
@@ -1841,8 +1846,11 @@
         const std::string& GetModelType() const {return type;}  
         std::string GetSayString(){return std::string(say_string);}
         Visibility vis;
-        //stg_usec_t GetSimInterval(){ return world->interval_sim; }
-       
+        
+        stg_usec_t GetUpdateInterval(){ return interval; }
+        stg_usec_t GetEnergyInterval(){ return interval_energy; }
+        stg_usec_t GetPoseInterval(){ return interval_pose; }
+        
         /** Render the model's blocks as an occupancy grid into the
                  preallocated array of width by height pixels */
         void Rasterize( uint8_t* data, 

Modified: code/stage/trunk/stage.pc.in
===================================================================
--- code/stage/trunk/stage.pc.in        2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/stage.pc.in        2009-08-20 21:42:09 UTC (rev 8211)
@@ -3,6 +3,6 @@
 Name: stage
 Description: Stage robot simulation program, C++ library and Player plugin - 
part of the Player/Stage Project
 Version: @VERSION@
-Requires: gthread-2.0 >= 2.4
-Libs: -L${prefix}/lib -lstage
-Cflags: -I${prefix}/include/sta...@apiversion@
+Requires: 
+Libs: -L${prefix}/lib -lstage @FLTK_LDFLAGS@
+Cflags: -I${prefix}/include/sta...@apiversion@ @FLTK_CFLAGS@ 

Modified: code/stage/trunk/todo.txt
===================================================================
--- code/stage/trunk/todo.txt   2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/todo.txt   2009-08-20 21:42:09 UTC (rev 8211)
@@ -7,19 +7,19 @@
 ------------
 linux  8.89
 OS X   7.75
+     11.05 (rev 8210)
 
 fasr.world
 ----------
 linux  16.36
-OS X   16.20 (rev 7949)
+OS X   16.20 (rev 7949) 
+      19.94 (rev 8210 - new event queue is slower but more powerful and 
elegant)
 
 
-** 3.1.0 RELEASE *
+** 3.2.0 RELEASE *
 
  - visualizer option state in worldfile
  - blinkenlights vs lightindicator - resolve and fix interfaces
- - ranger transducer geometry correct?
- - feature freeze around July 1
  - scan SF for patches
  - fix world files
  - docs for new models
@@ -54,3 +54,10 @@
 * 3d collision detection broken - e.g. fancypioneer2dx
 * energy model & recharging
 * runtime update rate UI
+
+** 3.1.0 RELEASE *
+ - feature freeze around July 1
+ - scan SF for patches
+ - fix world files
+ - docs for new models
+ - push docs to SF

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2009-08-19 16:26:15 UTC (rev 8210)
+++ code/stage/trunk/worlds/fasr.world  2009-08-20 21:42:09 UTC (rev 8211)
@@ -9,11 +9,9 @@
 speedup 10
 paused 1
 
-# time to pause (in GUI mode) or quit (in headless mode) the simulation
-
+# time at which to pause (in GUI mode) or quit (in headless mode) the 
simulation
 quit_time 3600 # 1 hour of simulated time
 
-
 resolution 0.02
 
 threads 0

Modified: code/stage/trunk/worlds/simple.world
===================================================================
--- code/stage/trunk/worlds/simple.world        2009-08-19 16:26:15 UTC (rev 
8210)
+++ code/stage/trunk/worlds/simple.world        2009-08-20 21:42:09 UTC (rev 
8211)
@@ -46,7 +46,8 @@
 
   sicklaser(   
      # ctrl "lasernoise"  # uncomment this line to run a laser noise generator
-  ) 
+  )
+ 
 
   ctrl "wander"
 


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to