Revision: 8058
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8058&view=rev
Author:   rtv
Date:     2009-07-20 23:47:33 +0000 (Mon, 20 Jul 2009)

Log Message:
-----------
fixed energy dissipation vis bug

Modified Paths:
--------------
    code/stage/trunk/examples/ctrl/fasr.cc
    code/stage/trunk/libstage/canvas.cc
    code/stage/trunk/libstage/powerpack.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/libstage/worldgui.cc
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc      2009-07-20 08:25:53 UTC (rev 
8057)
+++ code/stage/trunk/examples/ctrl/fasr.cc      2009-07-20 23:47:33 UTC (rev 
8058)
@@ -506,7 +506,7 @@
                memset( data, 0, sizeof(uint8_t) * dw * dh );
                
                mod->GetWorld()->GetModel( "cave" )->Rasterize( data, dw, dh, 
0.25, 0.5 );
-               
+
                putchar( '\n' );
                for( unsigned int y=0; y<dh; y++ )
                  {
@@ -515,6 +515,7 @@
                         putchar( '\n' );
                  }
                delete data;
+               
         }
 
   new Robot( (ModelPosition*)mod,

Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2009-07-20 08:25:53 UTC (rev 8057)
+++ code/stage/trunk/libstage/canvas.cc 2009-07-20 23:47:33 UTC (rev 8058)
@@ -1185,7 +1185,7 @@
   FILE *fp = fopen( filename, "wb" );
   if( fp == NULL ) 
     {
-      PRINT_ERR1( "Unable to open %s", filename );
+               PRINT_ERR1( "Unable to open %s", filename );
     }
   
   // create PNG data

Modified: code/stage/trunk/libstage/powerpack.cc
===================================================================
--- code/stage/trunk/libstage/powerpack.cc      2009-07-20 08:25:53 UTC (rev 
8057)
+++ code/stage/trunk/libstage/powerpack.cc      2009-07-20 23:47:33 UTC (rev 
8058)
@@ -75,7 +75,7 @@
   glRectf( 0,0,width, fullness);
   
   // outline the charge-o-meter
-  glTranslatef( 0,0,0.001 );
+  glTranslatef( 0,0,0.1 );
   glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
   
   glColor4f( 0,0,0,0.7 );
@@ -276,9 +276,12 @@
         for( unsigned int x=0; x<columns; x++ )
                {
                  stg_joules_t j = cells[ y*columns + x ];
+
+                 //printf( "%d %d %.2f\n", x, y, j );
+
                  if( j > 0 )
                         {
-                               glColor4f( 1.0, 0, 0, j/global_peak_value );
+                               glColor4f( 1.0, 0, 0, j/global_peak_value );    
                        
                                glRectf( x,y,x+1,y+1 );
                         }
                }
@@ -292,14 +295,14 @@
                                                                                
                                  stg_meters_t y, 
                                                                                
                                  stg_joules_t amount )
 {
-  int ix = (x+width/2.0)/cellsize;
-  int iy = (y+height/2.0)/cellsize;
+  //printf( "accumulate %.2f %.2f %.2f\n", x, y, amount );
 
+  unsigned int ix = (x+width/2.0)/cellsize;
+  unsigned int iy = (y+height/2.0)/cellsize;
+
   // don't accumulate if we're outside the grid
-  if( ! ix >= 0 ) return;
-  if( ! ix < columns ) return;
-  if( ! iy >= 0 ) return;
-  if( ! iy < rows ) return;
+  if( ix < 0 || ix >= columns || iy < 0 && iy >= rows )
+               return;
 
   stg_joules_t* j = cells + (iy*columns + ix );
   

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-07-20 08:25:53 UTC (rev 8057)
+++ code/stage/trunk/libstage/stage.hh  2009-07-20 23:47:33 UTC (rev 8058)
@@ -47,6 +47,7 @@
 #include <list>
 #include <map>
 #include <ext/hash_map>
+//#include <unordered_map>
 #include <set>
 #include <algorithm>
 
@@ -853,7 +854,9 @@
         };
         
         __gnu_cxx::hash_map<const char*, Model*, __gnu_cxx::hash<const char*>, 
eqstr > models_by_name; ///< the models that make up the world, indexed by name.
-        
+        //tr1::unordered_map<const char*, Model*, __gnu_cxx::hash<const 
char*>, eqstr > models_by_name; ///< the models that make up the world, indexed 
by name.
+
+
         /** Keep a list of all models with detectable fiducials. This
                  avoids searching the whole world for fiducials. */
         ModelPtrSet models_with_fiducials;
@@ -877,12 +880,11 @@
         
   protected:    
 
-       std::list<std::pair<stg_world_callback_t,void*> > cb_list; ///< List of 
callback functions and arguments
+        std::list<std::pair<stg_world_callback_t,void*> > cb_list; ///< List 
of callback functions and arguments
     stg_bounds3d_t extent; ///< Describes the 3D volume of the world
     bool graphics;///< true iff we have a GUI
     stg_usec_t interval_sim; ///< temporal resolution: microseconds that 
elapse between simulated time steps 
         GHashTable* option_table; ///< GUI options (toggles) registered by 
models
-        //__gnu_cxx::hash_map<Option
         std::list<PowerPack*> powerpack_list; ///< List of all the powerpacks 
attached to models in the world
         std::list<float*> ray_list;///< List of rays traced for debug 
visualization
     stg_usec_t sim_time; ///< the current sim time in this world in 
microseconds
@@ -1541,7 +1543,7 @@
         friend class Canvas;
         
   protected:
-
+        
         class DissipationVis : public Visualizer
         {
         private:

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2009-07-20 08:25:53 UTC (rev 8057)
+++ code/stage/trunk/libstage/world.cc  2009-07-20 23:47:33 UTC (rev 8058)
@@ -532,7 +532,7 @@
          else
                {
                  --steps;
-                 printf( "world::update (steps remaining %d)\n", steps );      
          
+                 //printf( "world::update (steps remaining %d)\n", steps );    
          
                }
        }
 

Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc       2009-07-20 08:25:53 UTC (rev 
8057)
+++ code/stage/trunk/libstage/worldgui.cc       2009-07-20 23:47:33 UTC (rev 
8058)
@@ -629,7 +629,6 @@
 
 void WorldGui::onceCb( Fl_Widget* w, WorldGui* worldGui )
 {
-  puts( "ONCE" );
   worldGui->paused = true;
   worldGui->steps = 1; // number of steps to run  
 }

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2009-07-20 08:25:53 UTC (rev 8057)
+++ code/stage/trunk/worlds/fasr.world  2009-07-20 23:47:33 UTC (rev 8058)
@@ -87,6 +87,11 @@
 
 )
 
+# rtv - test ones
+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.940 -2.000 0 0 ] )
 charge_station(  pose [ 7.940 -3.000 0 0 ] )
 charge_station(  pose [ 7.940 -4.000 0 0 ] )


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

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to