Revision: 8288
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8288&view=rev
Author:   rtv
Date:     2009-10-13 22:00:09 +0000 (Tue, 13 Oct 2009)

Log Message:
-----------
clean up

Modified Paths:
--------------
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_blobfinder.cc
    code/stage/trunk/libstage/model_ranger.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/worlds/everything.world
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-10-13 20:10:23 UTC (rev 8287)
+++ code/stage/trunk/libstage/model.cc  2009-10-13 22:00:09 UTC (rev 8288)
@@ -904,6 +904,7 @@
   SetStall( ConditionalMove( pose + p ) );
 }
 
+
 void Model::UpdateTrail()
 {
        trail.push_back( TrailItem( world->sim_time, GetGlobalPose(), color ) 
);                                        
@@ -1009,9 +1010,6 @@
 
 void Model::RegisterOption( Option* opt )
 { 
-  //drawOptions.push_back( opt ); 
-  
-  //if( world->IsGUI() )
   world->RegisterOption( opt );
 }
 
@@ -1036,8 +1034,6 @@
 Model* Model::GetChild( const std::string& modelname ) const
 {
   // construct the full model name and look it up
-  //char* buf = new char[TOKEN_MAX];
-  //snprintf( buf, TOKEN_MAX, "%s.%s", this->token, modelname );
   
   std::string fullname = token + "." + modelname;
   
@@ -1074,7 +1070,6 @@
   mod->PushColor( 1,0,0,0.5 );
 
   Gl::pose_inverse_shift( mod->GetGlobalPose() );
-
   
   if( pts.size() > 0 )
         {
@@ -1182,10 +1177,12 @@
 }
 
 
-Model::Flag::Flag( Color color, double size )
+// define static member
+int Model::Flag::displaylist( 0 );
+
+Model::Flag::Flag( Color color, double size ) 
+       : color(color), size(size)
 { 
-       this->color = color;
-       this->size = size;
 }
 
 Model::Flag* Model::Flag::Nibble( double chunk )
@@ -1205,17 +1202,29 @@
 
 void Model::Flag::Draw(  GLUquadric* quadric )
 {
-  glColor4f( color.r, color.g, color.b, color.a );
-    
-  glEnable(GL_POLYGON_OFFSET_FILL);
-  glPolygonOffset(1.0, 1.0);
-  gluQuadricDrawStyle( quadric, GLU_FILL );
-  gluSphere( quadric, size/2.0, 4,2  );
-  glDisable(GL_POLYGON_OFFSET_FILL);
-  
-  // draw the edges darker version of the same color
-  glColor4f( color.r/2.0, color.g/2.0, color.b/2.0, color.a/2.0 );
-    
-  gluQuadricDrawStyle( quadric, GLU_LINE );
-  gluSphere( quadric, size/2.0, 4,2 );
+       if( displaylist == 0 )
+               {
+                       displaylist = glGenLists(1);
+                       assert( displaylist > 0 );
+                       
+                       glNewList( displaylist, GL_COMPILE );   
+                       
+                       glColor4f( color.r, color.g, color.b, color.a );
+                       
+                       glEnable(GL_POLYGON_OFFSET_FILL);
+                       glPolygonOffset(1.0, 1.0);
+                       gluQuadricDrawStyle( quadric, GLU_FILL );
+                       gluSphere( quadric, size/2.0, 4,2  );
+                       glDisable(GL_POLYGON_OFFSET_FILL);
+                       
+                       // draw the edges darker version of the same color
+                       glColor4f( color.r/2.0, color.g/2.0, color.b/2.0, 
color.a/2.0 );
+                       
+                       gluQuadricDrawStyle( quadric, GLU_LINE );
+                       gluSphere( quadric, size/2.0, 4,2 );
+
+                       glEndList();
+               }
+
+       glCallList( displaylist );
 }

Modified: code/stage/trunk/libstage/model_blobfinder.cc
===================================================================
--- code/stage/trunk/libstage/model_blobfinder.cc       2009-10-13 20:10:23 UTC 
(rev 8287)
+++ code/stage/trunk/libstage/model_blobfinder.cc       2009-10-13 22:00:09 UTC 
(rev 8288)
@@ -128,9 +128,7 @@
 /** Stop tracking blobs with this color */
 void ModelBlobfinder::RemoveColor( Color col )
 {
-       for( std::vector<Color>::iterator it = colors.begin();
-                        it != colors.end();
-                        ++it )
+       FOR_EACH( it, colors )
                {
                        if( (*it) ==  col  )
                                it = colors.erase(it);

Modified: code/stage/trunk/libstage/model_ranger.cc
===================================================================
--- code/stage/trunk/libstage/model_ranger.cc   2009-10-13 20:10:23 UTC (rev 
8287)
+++ code/stage/trunk/libstage/model_ranger.cc   2009-10-13 22:00:09 UTC (rev 
8288)
@@ -263,19 +263,17 @@
         return;
 
   // raytrace new range data for all sensors
-  for( std::vector<Sensor>::iterator it( sensors.begin() );
-                it != sensors.end();
-                ++it )
+       FOR_EACH( it, sensors )
     {
-               Sensor& s = *it;
-               
+                       Sensor& s = *it;
+                       
       // TODO - reinstate multi-ray rangers
       //for( int r=0; r<sensors[t].ray_count; r++ )
       //{        
       stg_raytrace_result_t ray = Raytrace( s.pose,
-                                                                               
                                  s.bounds_range.max,
-                                                                               
                                  ranger_match,
-                                                                               
                                  NULL );
+                                                                               
                                                                                
                s.bounds_range.max,
+                                                                               
                                                                                
                ranger_match,
+                                                                               
                                                                                
                NULL );
                        
       s.range = std::max( ray.range, s.bounds_range.min );
     }   

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-10-13 20:10:23 UTC (rev 8287)
+++ code/stage/trunk/libstage/stage.hh  2009-10-13 22:00:09 UTC (rev 8288)
@@ -1667,6 +1667,7 @@
         public:
                Color color;
                double size;
+               static int displaylist;
                
                Flag( Color color, double size );
                Flag* Nibble( double portion );

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2009-10-13 20:10:23 UTC (rev 8287)
+++ code/stage/trunk/libstage/world.cc  2009-10-13 22:00:09 UTC (rev 8288)
@@ -556,11 +556,11 @@
 
   FOR_EACH( it, active_energy )
         (*it)->UpdateCharge();
-       
+  
        if( Model::trail_length > 0 && updates % Model::trail_interval == 0 )
                FOR_EACH( it, active_velocity )
-                       (*it)->UpdateTrail();
-       
+                               (*it)->UpdateTrail();
+
   if( show_clock && ((this->updates % show_clock_interval) == 0) )
     {
       printf( "\r[Stage: %s]", ClockString().c_str() );
@@ -572,8 +572,6 @@
   return false;
 }
 
-
-
 unsigned int World::GetEventQueue( Model* mod )
 {
   if( worker_threads < 1 )

Modified: code/stage/trunk/worlds/everything.world
===================================================================
--- code/stage/trunk/worlds/everything.world    2009-10-13 20:10:23 UTC (rev 
8287)
+++ code/stage/trunk/worlds/everything.world    2009-10-13 22:00:09 UTC (rev 
8288)
@@ -5,16 +5,11 @@
 # the size of a pixel in Stage's underlying raytrace model in meters
 resolution     0.02
 
-interval_sim 100  # milliseconds per update step
-interval_real 0 # real-time milliseconds per update step
-
 include "pioneer.inc"
 include "irobot.inc"
 include "map.inc"
 include "sick.inc"
 
-gui_disable 0
-
 window
 ( 
   size [ 811.000 642.000 ] 
@@ -61,12 +56,6 @@
 
   fiducial( range_max 8 range_max_id 5 ) 
 
-  blobfinder( 
-        channel_count 6 
-        channels [ "red" "blue" "green" "cyan" "yellow" "magenta" ]  
-                 alwayson 1
-    )
-
   fiducial_return 17
   gripper_return 0
 
@@ -81,6 +70,12 @@
   pose [-10.071 3.186 0 -2.333]
 
   gripper( pose [0.23 0.000 -0.20 0.000] color "gray" )
+
+  blobfinder( 
+        colors_count 6 
+        colors [ "red" "blue" "green" "cyan" "yellow" "magenta" ]  
+                 alwayson 1
+    )
 )
 
 trickedoutpioneer

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2009-10-13 20:10:23 UTC (rev 8287)
+++ code/stage/trunk/worlds/fasr.world  2009-10-13 22:00:09 UTC (rev 8288)
@@ -104,7 +104,7 @@
  charging_bump( fiducial( range_max 5 pose [ 0 0 -0.100 0 ] ) )
 
  # small speed optimization
- trail_length 0
+ # trail_length 0
 )
 
 autorob( pose [7.062 -1.563 0 152.684] joules 300000 name "r0" )


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to