Revision: 7533
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7533&view=rev
Author:   rtv
Date:     2009-03-20 09:02:33 +0000 (Fri, 20 Mar 2009)

Log Message:
-----------
experimenting with wavefront planner

Modified Paths:
--------------
    code/stage/trunk/examples/ctrl/CMakeLists.txt
    code/stage/trunk/libstage/block.cc
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_laser.cc
    code/stage/trunk/libstage/model_position.cc
    code/stage/trunk/libstage/stage.cc
    code/stage/trunk/worlds/simple.world
    code/stage/trunk/worlds/wavefront.cfg

Modified: code/stage/trunk/examples/ctrl/CMakeLists.txt
===================================================================
--- code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-03-19 06:38:54 UTC 
(rev 7532)
+++ code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-03-20 09:02:33 UTC 
(rev 7533)
@@ -7,18 +7,29 @@
      wander
 )
 
+# need plaer's wavefront planning library for this one
+if( PLAYER_FOUND )  
+  SET( PLUGINS ${PLUGINS} fasr_plan )
+endif( PLAYER_FOUND )
 
 # create a library module for each plugin and link libstage to each
 
-
 foreach( PLUGIN ${PLUGINS} )
   ADD_LIBRARY( ${PLUGIN} MODULE ${PLUGIN}.cc )
   TARGET_LINK_LIBRARIES( ${PLUGIN} stage )
-  set_source_files_properties( ${PLUGIN}.cc PROPERTIES COMPILE_FLAGS 
"${FLTK_CFLAGS}" )
 endforeach( PLUGIN )
 
 # delete the "lib" prefix from the plugin libraries
 SET_TARGET_PROPERTIES( ${PLUGINS} PROPERTIES PREFIX "" )
 
+# need plaer's wavefront planning library for this one
+if( PLAYER_FOUND )  
+  link_directories( ${PLAYER_LIBRARY_DIRS} )
+  include_directories( ${PLAYER_INCLUDE_DIRS} )
+  target_link_libraries( fasr_plan "-lwavefront_standalone" )
+endif( PLAYER_FOUND )
+
+
 # install in <prefix>/lib
-INSTALL( TARGETS ${PLUGINS} DESTINATION lib)
+install( TARGETS ${PLUGINS} DESTINATION lib)
+

Modified: code/stage/trunk/libstage/block.cc
===================================================================
--- code/stage/trunk/libstage/block.cc  2009-03-19 06:38:54 UTC (rev 7532)
+++ code/stage/trunk/libstage/block.cc  2009-03-20 09:02:33 UTC (rev 7533)
@@ -5,16 +5,16 @@
 using namespace Stg;
 
 /** Create a new block. A model's body is a list of these
-        blocks. The point data is copied, so pts can safely be freed
-        after calling this.*/
+    blocks. The point data is copied, so pts can safely be freed
+    after calling this.*/
 Block::Block( Model* mod,  
-                                                 stg_point_t* pts, 
-                                                 size_t pt_count,
-                                                 stg_meters_t zmin,
-                                                 stg_meters_t zmax,
-                                                 stg_color_t color,
-                                                 bool inherit_color
-                                                 ) :
+             stg_point_t* pts, 
+             size_t pt_count,
+             stg_meters_t zmin,
+             stg_meters_t zmax,
+             stg_color_t color,
+             bool inherit_color
+             ) :
   mod( mod ),
   pt_count( pt_count ),
   pts( (stg_point_t*)g_memdup( pts, pt_count * sizeof(stg_point_t)) ),
@@ -33,15 +33,15 @@
 
 /** A from-file  constructor */
 Block::Block(  Model* mod,  
-                                                       Worldfile* wf, 
-                                                       int entity) 
+              Worldfile* wf, 
+              int entity) 
   : mod( mod ),
-        pt_count(0), 
-        pts(NULL), 
-        color(0),
-        inherit_color(true),
-        rendered_cells( g_ptr_array_sized_new(32) ), 
-        candidate_cells( g_ptr_array_sized_new(32) )
+    pt_count(0), 
+    pts(NULL), 
+    color(0),
+    inherit_color(true),
+    rendered_cells( g_ptr_array_sized_new(32) ), 
+    candidate_cells( g_ptr_array_sized_new(32) )
 {
   assert(mod);
   assert(wf);
@@ -64,10 +64,10 @@
 void Block::Translate( double x, double y )
 {
   for( unsigned int p=0; p<pt_count; p++)
-        {
-               pts[p].x += x;
-               pts[p].y += y;
-        }
+    {
+      pts[p].x += x;
+      pts[p].y += y;
+    }
 
   // force redraw
   mod->blockgroup.BuildDisplayList( mod );
@@ -80,10 +80,10 @@
   double max = -billion;
   
   for( unsigned int p=0; p<pt_count; p++)
-        {
-               if( pts[p].y > max ) max = pts[p].y;
-               if( pts[p].y < min ) min = pts[p].y;
-        }
+    {
+      if( pts[p].y > max ) max = pts[p].y;
+      if( pts[p].y < min ) min = pts[p].y;
+    }
                  
   // return the value half way between max and min
   return( min + (max - min)/2.0 );
@@ -95,10 +95,10 @@
   double max = -billion;
   
   for( unsigned int p=0; p<pt_count; p++)
-        {
-               if( pts[p].x > max ) max = pts[p].x;
-               if( pts[p].x < min ) min = pts[p].x;
-        }
+    {
+      if( pts[p].x > max ) max = pts[p].x;
+      if( pts[p].x < min ) min = pts[p].x;
+    }
                  
   // return the value half way between maxx and min
   return( min + (max - min)/2.0 );
@@ -144,20 +144,20 @@
 {
   // for every cell we are rendered into
   for( unsigned int i=0; i<rendered_cells->len; i++ )
-        {
-               Cell* cell = (Cell*)g_ptr_array_index( rendered_cells, i);
+    {
+      Cell* cell = (Cell*)g_ptr_array_index( rendered_cells, i);
                
-               // for every block rendered into that cell
-               for( GSList* it = cell->list; it; it=it->next )
-                 {
-                        Block* testblock = (Block*)it->data;
-                        Model* testmod = testblock->mod;
+      // for every block rendered into that cell
+      for( GSList* it = cell->list; it; it=it->next )
+       {
+         Block* testblock = (Block*)it->data;
+         Model* testmod = testblock->mod;
                         
-                        if( !mod->IsRelated( testmod ))
-                               if( ! g_list_find( list, testmod ) )
-                                        list = g_list_append( list, testmod );
-                 }
-        }
+         if( !mod->IsRelated( testmod ))
+           if( ! g_list_find( list, testmod ) )
+             list = g_list_append( list, testmod );
+       }
+    }
 
   return list;
 }
@@ -170,29 +170,29 @@
   GenerateCandidateCells();
   
   if( mod->vis.obstacle_return )
-        // for every cell we may be rendered into
-        for( unsigned int i=0; i<candidate_cells->len; i++ )
-        {
-               Cell* cell = (Cell*)g_ptr_array_index(candidate_cells, i);
+    // for every cell we may be rendered into
+    for( unsigned int i=0; i<candidate_cells->len; i++ )
+      {
+       Cell* cell = (Cell*)g_ptr_array_index(candidate_cells, i);
                
-               // for every rendered into that cell
-               for( GSList* it = cell->list; it; it=it->next )
-                 {
-                        Block* testblock = (Block*)it->data;
-                        Model* testmod = testblock->mod;
+       // for every rendered into that cell
+       for( GSList* it = cell->list; it; it=it->next )
+         {
+           Block* testblock = (Block*)it->data;
+           Model* testmod = testblock->mod;
                         
-                        //printf( "   testing block %p of model %s\n", 
testblock, testmod->Token() );
+           //printf( "   testing block %p of model %s\n", testblock, 
testmod->Token() );
                         
-                        // if the tested model is an obstacle and it's not 
attached to this model
-                        if( (testmod != this->mod) &&  
-                                       testmod->vis.obstacle_return && 
-                                       !mod->IsRelated( testmod ))
-                               {
-                                 //puts( "HIT");
-                                 return testmod; // bail immediately with the 
bad news
-                               }                 
-                 }
-        }
+           // if the tested model is an obstacle and it's not attached to this 
model
+           if( (testmod != this->mod) &&  
+               testmod->vis.obstacle_return && 
+               !mod->IsRelated( testmod ))
+             {
+               //puts( "HIT");
+               return testmod; // bail immediately with the bad news
+             }           
+         }
+      }
   
   //printf( "model %s block %p collision done. no hits.\n", mod->Token(), this 
);
   return NULL; // no hit
@@ -202,13 +202,13 @@
 void Block::RemoveFromCellArray( GPtrArray* ptrarray )
 {  
   for( unsigned int i=0; i<ptrarray->len; i++ )         
-        ((Cell*)g_ptr_array_index(ptrarray, i))->RemoveBlock( this );  
+    ((Cell*)g_ptr_array_index(ptrarray, i))->RemoveBlock( this );  
 }
 
 void Block::AddToCellArray( GPtrArray* ptrarray )
 {  
   for( unsigned int i=0; i<ptrarray->len; i++ )         
-        ((Cell*)g_ptr_array_index(ptrarray, i))->AddBlock( this );  
+    ((Cell*)g_ptr_array_index(ptrarray, i))->AddBlock( this );  
 }
 
 
@@ -276,9 +276,9 @@
   
   // compute the global location of the first point
   Pose local( (pts[0].x - bgoffset.x) * scale.x ,
-                                                 (pts[0].y - bgoffset.y) * 
scale.y, 
-                                                 -bgoffset.z, 
-                                                 0 );
+             (pts[0].y - bgoffset.y) * scale.y, 
+             -bgoffset.z, 
+             0 );
 
   Pose first_gpose, last_gpose;
   first_gpose = last_gpose = pose_sum( gpose, local );
@@ -289,27 +289,27 @@
   
   // now loop from the the second to the last
   for( unsigned int p=1; p<pt_count; p++ )
-        {
-               Pose local( (pts[p].x - bgoffset.x) * scale.x ,
-                                                               (pts[p].y - 
bgoffset.y) * scale.y, 
-                                                               -bgoffset.z, 
-                                                               0 );            
+    {
+      Pose local( (pts[p].x - bgoffset.x) * scale.x ,
+                 (pts[p].y - bgoffset.y) * scale.y, 
+                 -bgoffset.z, 
+                 0 );          
                
-               Pose gpose2 = pose_sum( gpose, local );
+      Pose gpose2 = pose_sum( gpose, local );
                
-               // and render the shape of the block into the global cells      
                 
-               mod->world->ForEachCellInLine( last_gpose.x, last_gpose.y, 
-                                                                               
                 gpose2.x, gpose2.y, 
-                                                                               
                 (stg_cell_callback_t)AppendCellToPtrArray,
-                                                                               
                 candidate_cells );
-               last_gpose = gpose2;
-        }
+      // and render the shape of the block into the global cells               
         
+      mod->world->ForEachCellInLine( last_gpose.x, last_gpose.y, 
+                                    gpose2.x, gpose2.y, 
+                                    (stg_cell_callback_t)AppendCellToPtrArray,
+                                    candidate_cells );
+      last_gpose = gpose2;
+    }
   
   // close the polygon
   mod->world->ForEachCellInLine( last_gpose.x, last_gpose.y,
-                                                                               
        first_gpose.x, first_gpose.y,
-                                                                               
        (stg_cell_callback_t)AppendCellToPtrArray, 
-                                                                               
        candidate_cells );
+                                first_gpose.x, first_gpose.y,
+                                (stg_cell_callback_t)AppendCellToPtrArray, 
+                                candidate_cells );
   
   mapped = true;
 }
@@ -321,7 +321,7 @@
   // extent
   glBegin( GL_POLYGON);
   for( unsigned int i=0; i<pt_count; i++ )
-        glVertex3f( pts[i].x, pts[i].y, local_z.max );
+    glVertex3f( pts[i].x, pts[i].y, local_z.max );
   glEnd();
 }       
 
@@ -330,10 +330,10 @@
   // construct a strip that wraps around the polygon  
   glBegin(GL_QUAD_STRIP);
   for( unsigned int p=0; p<pt_count; p++)
-        {
-               glVertex3f( pts[p].x, pts[p].y, local_z.max );
-               glVertex3f( pts[p].x, pts[p].y, local_z.min );
-        }
+    {
+      glVertex3f( pts[p].x, pts[p].y, local_z.max );
+      glVertex3f( pts[p].x, pts[p].y, local_z.min );
+    }
   // close the strip
   glVertex3f( pts[0].x, pts[0].y, local_z.max );
   glVertex3f( pts[0].x, pts[0].y, local_z.min );
@@ -344,7 +344,7 @@
 {
   glBegin(GL_POLYGON);
   for( unsigned int p=0; p<pt_count; p++ )
-        glVertex2f( pts[p].x, pts[p].y );
+    glVertex2f( pts[p].x, pts[p].y );
   glEnd();
 }
 
@@ -391,7 +391,7 @@
   //printf( "Block::Load entity %d\n", entity );
   
   if( pts )
-        stg_points_destroy( pts );
+    stg_points_destroy( pts );
   
   pt_count = wf->ReadInt( entity, "points", 0);
   pts = stg_points_create( pt_count );
@@ -401,10 +401,10 @@
   
   char key[128];  
   for( unsigned int p=0; p<pt_count; p++ )           {
-        snprintf(key, sizeof(key), "point[%d]", p );
+    snprintf(key, sizeof(key), "point[%d]", p );
         
-        pts[p].x = wf->ReadTupleLength(entity, key, 0, 0);
-        pts[p].y = wf->ReadTupleLength(entity, key, 1, 0);
+    pts[p].x = wf->ReadTupleLength(entity, key, 0, 0);
+    pts[p].y = wf->ReadTupleLength(entity, key, 1, 0);
   }
   
   local_z.min = wf->ReadTupleLength( entity, "z", 0, 0.0 );
@@ -412,12 +412,12 @@
   
   const char* colorstr = wf->ReadString( entity, "color", NULL );
   if( colorstr )
-        {
-               color = stg_lookup_color( colorstr );
-               inherit_color = false;
-        }
+    {
+      color = stg_lookup_color( colorstr );
+      inherit_color = false;
+    }
   else
-        inherit_color = true;
+    inherit_color = true;
 }
 
        

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-03-19 06:38:54 UTC (rev 7532)
+++ code/stage/trunk/libstage/model.cc  2009-03-20 09:02:33 UTC (rev 7533)
@@ -1022,3 +1022,5 @@
   //if( world->IsGUI() )
   world->RegisterOption( opt );
 }
+
+

Modified: code/stage/trunk/libstage/model_laser.cc
===================================================================
--- code/stage/trunk/libstage/model_laser.cc    2009-03-19 06:38:54 UTC (rev 
7532)
+++ code/stage/trunk/libstage/model_laser.cc    2009-03-20 09:02:33 UTC (rev 
7533)
@@ -38,57 +38,57 @@
 Option ModelLaser::showLaserBeams( "Laser beams", "show_laser_beams", "", 
false, NULL );
 
 /**
-...@ingroup model
-...@defgroup model_laser Laser model 
-The laser model simulates a scanning laser rangefinder
+   @ingroup model
+   @defgroup model_laser Laser model 
+   The laser model simulates a scanning laser rangefinder
 
-API: Stg::ModelLaser
+   API: Stg::ModelLaser
 
-<h2>Worldfile properties</h2>
+   <h2>Worldfile properties</h2>
 
-...@par Summary and default values
+   @par Summary and default values
 
-...@verbatim
-laser
-(
-  # laser properties
-  samples 180
-  range_max 8.0
-  fov 3.14159
-  resolution 1
+   @verbatim
+   laser
+   (
+   # laser properties
+   samples 180
+   range_max 8.0
+   fov 3.14159
+   resolution 1
 
-  # model properties
-  size [ 0.15 0.15 0.2 ]
-  color "blue"
-)
-...@endverbatim
+   # model properties
+   size [ 0.15 0.15 0.2 ]
+   color "blue"
+   )
+   @endverbatim
 
-...@par Details
+   @par Details
  
-- samples <int>\n
-  the number of laser samples per scan
-- range_max <float>\n
-  the maximum range reported by the scanner, in meters. The scanner will not 
detect objects beyond this range.
-- fov <float>\n
-  the angular field of view of the scanner, in radians. 
-- resolution <int>\n
-  Only calculate the true range of every nth laser sample. The missing samples 
are filled in with a linear interpolation. Generally it would be better to use 
fewer samples, but some (poorly implemented!) programs expect a fixed number of 
samples. Setting this number > 1 allows you to reduce the amount of computation 
required for your fixed-size laser vector.
+   - samples <int>\n
+   the number of laser samples per scan
+   - range_max <float>\n
+   the maximum range reported by the scanner, in meters. The scanner will not 
detect objects beyond this range.
+   - fov <float>\n
+   the angular field of view of the scanner, in radians. 
+   - resolution <int>\n
+   Only calculate the true range of every nth laser sample. The missing 
samples are filled in with a linear interpolation. Generally it would be better 
to use fewer samples, but some (poorly implemented!) programs expect a fixed 
number of samples. Setting this number > 1 allows you to reduce the amount of 
computation required for your fixed-size laser vector.
 */
   
-  ModelLaser::ModelLaser( World* world, 
-                                                                               
  Model* parent )
+ModelLaser::ModelLaser( World* world, 
+                       Model* parent )
   : Model( world, parent, MODEL_TYPE_LASER ),
-       data_dl(0),
-       data_dirty( true ),
-       samples( NULL ),        // don't allocate sample buffer memory until 
Update() is called
-       sample_count( DEFAULT_SAMPLES ),
-       range_max( DEFAULT_MAXRANGE ),
-       fov( DEFAULT_FOV ),
-       resolution( DEFAULT_RESOLUTION )
+    data_dl(0),
+    data_dirty( true ),
+    samples( NULL ),   // don't allocate sample buffer memory until Update() 
is called
+    sample_count( DEFAULT_SAMPLES ),
+    range_max( DEFAULT_MAXRANGE ),
+    fov( DEFAULT_FOV ),
+    resolution( DEFAULT_RESOLUTION )
 {
   
   PRINT_DEBUG2( "Constructing ModelLaser %d (%s)\n", 
-                                        id, typestr );
+               id, typestr );
   
 
   // Model data members
@@ -162,8 +162,8 @@
 }
 
 static bool laser_raytrace_match( Model* hit, 
-                                                                               
         Model* finder,
-                                                                               
         const void* dummy )
+                                 Model* finder,
+                                 const void* dummy )
 {
   // Ignore the model that's looking and things that are invisible to
   // lasers  
@@ -186,20 +186,20 @@
       rayorg.a = bearing;
 
       stg_raytrace_result_t sample = 
-                 Raytrace( rayorg, 
-                                               range_max,
-                                               laser_raytrace_match,
-                                               NULL,
-                                               true ); // z testing enabled
+       Raytrace( rayorg, 
+                 range_max,
+                 laser_raytrace_match,
+                 NULL,
+                 true ); // z testing enabled
                
       samples[t].range = sample.range;
 
       // if we hit a model and it reflects brightly, we set
       // reflectance high, else low
       if( sample.mod && ( sample.mod->vis.laser_return >= LaserBright ) )      
-                 samples[t].reflectance = 1;
+       samples[t].reflectance = 1;
       else
-                 samples[t].reflectance = 0;
+       samples[t].reflectance = 0;
                
       // todo - lower bound on range      
       bearing += sample_incr;
@@ -209,22 +209,22 @@
   if( resolution > 1 )
     {
       for( unsigned int t=resolution; t<sample_count; t+=resolution )
-                 for( unsigned int g=1; g<resolution; g++ )
-                        {
-                               if( t >= sample_count )
-                                 break;
+       for( unsigned int g=1; g<resolution; g++ )
+         {
+           if( t >= sample_count )
+             break;
                                
-                               // copy the rightmost sample data into this 
point
-                               memcpy( &samples[t-g],
-                                                 &samples[t-resolution],
-                                                 sizeof(stg_laser_sample_t));
+           // copy the rightmost sample data into this point
+           memcpy( &samples[t-g],
+                   &samples[t-resolution],
+                   sizeof(stg_laser_sample_t));
                                
-                               double left = samples[t].range;
-                               double right = samples[t-resolution].range;
+           double left = samples[t].range;
+           double right = samples[t-resolution].range;
                                
-                               // linear range interpolation between the left 
and right samples
-                               samples[t-g].range = 
(left-g*(left-right)/resolution);
-                        }
+           // linear range interpolation between the left and right samples
+           samples[t-g].range = (left-g*(left-right)/resolution);
+         }
     }
   
   data_dirty = true;
@@ -317,8 +317,8 @@
     {      
       data_dirty = false;
 
-               if( data_dl < 1 )
-                 data_dl = glGenLists(1);
+      if( data_dl < 1 )
+       data_dl = glGenLists(1);
        
       glNewList( data_dl, GL_COMPILE );
 
@@ -330,7 +330,7 @@
       glBegin( GL_POINTS );
       glVertex2f( 0,0 );
       glEnd();
-               PopColor();
+      PopColor();
 
       // pack the laser hit points into a vertex array for fast rendering
       static float* pts = NULL;
@@ -339,79 +339,79 @@
       pts[0] = 0.0;
       pts[1] = 0.0;
                
-               PushColor( 0, 0, 1, 0.5 );
-               glDepthMask( GL_FALSE );
-               glPointSize( 2 );
+      PushColor( 0, 0, 1, 0.5 );
+      glDepthMask( GL_FALSE );
+      glPointSize( 2 );
                
-               for( unsigned int s=0; s<sample_count; s++ )
-                 {
-                        double ray_angle = (s * (fov / (sample_count-1))) - 
fov/2.0;
-                        pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) 
);
-                        pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) 
);
+      for( unsigned int s=0; s<sample_count; s++ )
+       {
+         double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
+         pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) );
+         pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) );
                         
-                        // if the sample is unusually bright, draw a little 
blob
-                        if( showLaserData && (samples[s].reflectance > 0) )
-                               {
-                                 glBegin( GL_POINTS );
-                                 glVertex2f( pts[2*s+2], pts[2*s+3] );
-                                 glEnd();
-                               }                        
-                 }
+         // if the sample is unusually bright, draw a little blob
+         if( showLaserData && (samples[s].reflectance > 0) )
+           {
+             glBegin( GL_POINTS );
+             glVertex2f( pts[2*s+2], pts[2*s+3] );
+             glEnd();
+           }                    
+       }
                
-               glVertexPointer( 2, GL_FLOAT, 0, pts );      
+      glVertexPointer( 2, GL_FLOAT, 0, pts );      
                
-               PopColor();
+      PopColor();
                
-               if( showLaserData )
-                 {                              
-                        // draw the filled polygon in transparent blue
-                        PushColor( 0, 0, 1, 0.1 );             
-                        glDrawArrays( GL_POLYGON, 0, sample_count+1 );
-                        PopColor();
-                 }
+      if( showLaserData )
+       {                        
+         // draw the filled polygon in transparent blue
+         PushColor( 0, 0, 1, 0.1 );            
+         glDrawArrays( GL_POLYGON, 0, sample_count+1 );
+         PopColor();
+       }
                
       if( showLaserStrikes )
-                 {
-                        // draw the beam strike points
-                        PushColor( 0, 0, 1, 0.8 );
-                        glDrawArrays( GL_POINTS, 0, sample_count+1 );
-                        PopColor();
-                 }
+       {
+         // draw the beam strike points
+         PushColor( 0, 0, 1, 0.8 );
+         glDrawArrays( GL_POINTS, 0, sample_count+1 );
+         PopColor();
+       }
 
-               if( showLaserFov )
-                 {
-                        for( unsigned int s=0; s<sample_count; s++ )
-                               {
-                                 double ray_angle = (s * (fov / 
(sample_count-1))) - fov/2.0;
-                                 pts[2*s+2] = (float)(range_max * 
cos(ray_angle) );
-                                 pts[2*s+3] = (float)(range_max * 
sin(ray_angle) );                     
-                               }
+      if( showLaserFov )
+       {
+         for( unsigned int s=0; s<sample_count; s++ )
+           {
+             double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
+             pts[2*s+2] = (float)(range_max * cos(ray_angle) );
+             pts[2*s+3] = (float)(range_max * sin(ray_angle) );                
         
+           }
 
-                        glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-                        PushColor( 0, 0, 1, 0.5 );             
-                        glDrawArrays( GL_POLYGON, 0, sample_count+1 );
-                        PopColor();
-                        //                      glPolygonMode( 
GL_FRONT_AND_BACK, GL_LINE );
+         glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+         PushColor( 0, 0, 1, 0.5 );            
+         glDrawArrays( GL_POLYGON, 0, sample_count+1 );
+         PopColor();
+         //                     glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
 
-                 }                      
+       }                        
                
-               if( showLaserBeams )
-                 {
-                        PushColor( 0, 0, 1, 0.5 );             
-                        glBegin( GL_LINES );
+      if( showLaserBeams )
+       {
+         PushColor( 0, 0, 1, 0.5 );            
+         glBegin( GL_LINES );
                         
-                        for( unsigned int s=0; s<sample_count; s++ )
-                               {
+         for( unsigned int s=0; s<sample_count; s++ )
+           {
                                  
-                                 glVertex2f( 0,0 );
-                                 double ray_angle = (s * (fov / 
(sample_count-1))) - fov/2.0;
-                                 glVertex2f( samples[s].range * 
cos(ray_angle), 
-                                                                 
samples[s].range * sin(ray_angle) );
+             glVertex2f( 0,0 );
+             double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
+             glVertex2f( samples[s].range * cos(ray_angle), 
+                         samples[s].range * sin(ray_angle) );
                                  
-                               }
-                        glEnd();
-                        PopColor();
-                 }     
+           }
+         glEnd();
+         PopColor();
+       }       
 
                
       glDepthMask( GL_TRUE );

Modified: code/stage/trunk/libstage/model_position.cc
===================================================================
--- code/stage/trunk/libstage/model_position.cc 2009-03-19 06:38:54 UTC (rev 
7532)
+++ code/stage/trunk/libstage/model_position.cc 2009-03-20 09:02:33 UTC (rev 
7533)
@@ -662,7 +662,7 @@
   // draw lines connecting the waypoints
   if( waypoint_count > 1 )
     {
-      glBegin( GL_LINE_STRIP );
+      glBegin( GL_LINES );
       
       for( unsigned int i=1; i < waypoint_count; i++ )
        {

Modified: code/stage/trunk/libstage/stage.cc
===================================================================
--- code/stage/trunk/libstage/stage.cc  2009-03-19 06:38:54 UTC (rev 7532)
+++ code/stage/trunk/libstage/stage.cc  2009-03-20 09:02:33 UTC (rev 7533)
@@ -254,7 +254,7 @@
                }
 }  
 
-// // returns TRUE if any channel in the pixel is non-zero
+// returns true if the value in the first channel is above threshold
 static gboolean pb_pixel_is_set( Fl_Shared_Image* img, int x, int y, int 
threshold )
 {
        guchar* pixel = pb_get_pixel( img,x,y );

Modified: code/stage/trunk/worlds/simple.world
===================================================================
--- code/stage/trunk/worlds/simple.world        2009-03-19 06:38:54 UTC (rev 
7532)
+++ code/stage/trunk/worlds/simple.world        2009-03-20 09:02:33 UTC (rev 
7533)
@@ -7,7 +7,7 @@
 include "sick.inc"
 
 interval_sim 100  # simulation timestep in milliseconds
-interval_real 50  # real-time interval between simulation updates in 
milliseconds 
+interval_real 0  # real-time interval between simulation updates in 
milliseconds 
 
 paused 0
 
@@ -44,5 +44,9 @@
   sicklaser() 
 
   ctrl "wander"
+
+  # report error-free position in world coordinates
+  localization "gps"
+  localization_origin [ 0 0 0 0 ]
 )
 

Modified: code/stage/trunk/worlds/wavefront.cfg
===================================================================
--- code/stage/trunk/worlds/wavefront.cfg       2009-03-19 06:38:54 UTC (rev 
7532)
+++ code/stage/trunk/worlds/wavefront.cfg       2009-03-20 09:02:33 UTC (rev 
7533)
@@ -1,23 +1,34 @@
 driver
 (
   name "stage"
-  plugin "libstageplugin"
+  plugin "stageplugin"
   provides ["6665:simulation:0"]
-  worldfile "simple.world"
+  worldfile "wavefront.world"
 )
 
+#driver
+#(
+#  name "stage"
+#  provides ["6665:map:0"]
+#  model "cave"
+#)
+
 driver
 (
-  name "stage"
+  name "mapfile"
   provides ["6665:map:0"]
-  model "cave"
+  filename "bitmaps/cave.png"
+  resolution 0.032 # meters per pixel
+  negate 0
+  origin [-8 -8 ] # real-world location of the bottom-left-hand corner of the 
map
 )
 
+
 driver
 (
   name "stage"
   provides ["6665:position2d:0" "6665:laser:0"]
-  model "robot1"
+  model "r0"
 )
 
 driver
@@ -36,19 +47,19 @@
 #  requires ["output::6665:position2d:0" "input::6665:position2d:0" 
"6665:laser:0"]
 #)
 
-driver
-(
-  name "amcl"
-  provides ["6665:localize:0" "6665:position2d:2"]
-  requires ["odometry::6665:position2d:0" "6665:laser:0" "laser::6665:map:0"]
-)
+#driver
+#(
+#  name "amcl"
+#  provides ["6665:localize:0" "6665:position2d:2"]
+#  requires ["odometry::6665:position2d:0" "6665:laser:0" "laser::6665:map:0"]
+#)
 
 
 driver
 (
   name "wavefront"
   provides ["6665:planner:0"]
-  requires ["output::6665:position2d:1" "input::6665:position2d:2" 
"6665:map:0"]
+  requires ["output::6665:position2d:1" "input::6665:position2d:0" 
"6665:map:0"]
   safety_dist 0.15
   distance_epsilon 0.5
   angle_epsilon 10


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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to