Revision: 7575
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7575&view=rev
Author:   rtv
Date:     2009-04-03 19:03:02 +0000 (Fri, 03 Apr 2009)

Log Message:
-----------
eliminated crash or assert fail in powerpack when moving outside the previous 
world bounds

Modified Paths:
--------------
    code/stage/trunk/libstage/powerpack.cc
    code/stage/trunk/libstage/stage.hh

Modified: code/stage/trunk/libstage/powerpack.cc
===================================================================
--- code/stage/trunk/libstage/powerpack.cc      2009-04-03 08:01:42 UTC (rev 
7574)
+++ code/stage/trunk/libstage/powerpack.cc      2009-04-03 19:03:02 UTC (rev 
7575)
@@ -294,10 +294,11 @@
   int ix = (x+width/2.0)/cellsize;
   int iy = (y+height/2.0)/cellsize;
 
-  assert( ix >= 0 );
-  assert( ix < (int)columns );
-  assert( iy >= 0 );
-  assert( iy < (int)rows );
+  // 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;
 
   stg_joules_t* j = cells + (iy*columns + ix );
   

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-04-03 08:01:42 UTC (rev 7574)
+++ code/stage/trunk/libstage/stage.hh  2009-04-03 19:03:02 UTC (rev 7575)
@@ -2253,7 +2253,7 @@
         stg_radians_t fov;
         stg_radians_t pan;
 
-        static  const char* typestr;
+        static const char* typestr;
 
         // constructor
         ModelBlobfinder( World* world,
@@ -2401,27 +2401,19 @@
         struct config_t
         {
                Size paddle_size; ///< paddle dimensions 
-               
                paddle_state_t paddles;
-               lift_state_t lift;
-               
+               lift_state_t lift;              
                double paddle_position; ///< 0.0 = full open, 1.0 full closed
                double lift_position; ///< 0.0 = full down, 1.0 full up
-               
                Model* gripped;
-
-               bool paddles_stalled; // true iff some solid object stopped
-               // the paddles closing or opening
-               
+               bool paddles_stalled; // true iff some solid object stopped the 
paddles closing or opening
                double close_limit; ///< How far the gripper can close. If < 
1.0, the gripper has its mouth full.               
                bool autosnatch; ///< if true, cycle the gripper through 
open-close-up-down automatically
-
                double break_beam_inset[2]; ///< distance from the end of the 
paddle
-
       Model* beam[2]; ///< points to a model detected by the beams
       Model* contact[2]; ///< pointers to a model detected by the contacts     
        
         };
-                
+        
   private:
         virtual void Update();
         virtual void DataVisualize( Camera* cam );
@@ -2460,7 +2452,6 @@
         
         /** Set the current activity of the gripper. */
         void SetCommand( cmd_t cmd ) { this->cmd = cmd; }
-
         /** Command the gripper paddles to close. Wrapper for SetCommand( 
CMD_CLOSE ). */
         void CommandClose() { SetCommand( CMD_CLOSE ); }
         /** Command the gripper paddles to open. Wrapper for SetCommand( 
CMD_OPEN ). */


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

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to