Revision: 8239
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8239&view=rev
Author:   rtv
Date:     2009-08-28 01:58:11 +0000 (Fri, 28 Aug 2009)

Log Message:
-----------
added vis of current draw from powerpacks

Modified Paths:
--------------
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_actuator.cc
    code/stage/trunk/libstage/model_getset.cc
    code/stage/trunk/libstage/model_laser.cc
    code/stage/trunk/libstage/model_load.cc
    code/stage/trunk/libstage/model_position.cc
    code/stage/trunk/libstage/powerpack.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/worldgui.cc
    code/stage/trunk/worlds/simple.world

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-08-27 23:41:43 UTC (rev 8238)
+++ code/stage/trunk/libstage/model.cc  2009-08-28 01:58:11 UTC (rev 8239)
@@ -110,7 +110,6 @@
 // static members
 uint32_t Model::count = 0;
 std::map<stg_id_t,Model*> Model::modelsbyid;
-
 std::map<std::string, creator_t> Model::name_map;
 
 void Size::Load( Worldfile* wf, int section, const char* keyword )
@@ -957,7 +956,7 @@
 {
   if( power_pack )
         return power_pack;
-
+  
   if( parent )
         return parent->FindPowerPack();
 
@@ -1120,4 +1119,3 @@
 {
   pts.clear();
 }
-

Modified: code/stage/trunk/libstage/model_actuator.cc
===================================================================
--- code/stage/trunk/libstage/model_actuator.cc 2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/model_actuator.cc 2009-08-28 01:58:11 UTC (rev 
8239)
@@ -56,8 +56,8 @@
   if a linear actuator the axis that the actuator will move along
  */
   
-static const double STG_ACTUATOR_WATTS_KGMS = 5.0; // cost per kg per meter 
per second
-static const double STG_ACTUATOR_WATTS = 2.0; // base cost of position device
+static const double WATTS_KGMS = 5.0; // cost per kg per meter per second
+static const double WATTS_BASE = 2.0; // base cost of position device
 
 ModelActuator::ModelActuator( World* world,
                                                                                
Model* parent,
@@ -68,12 +68,11 @@
   max_speed(1), 
   min_position(0), 
   max_position(1),
-  control_mode( STG_ACTUATOR_CONTROL_VELOCITY ),
-  actuator_type( STG_ACTUATOR_TYPE_LINEAR ),
+  control_mode( CONTROL_VELOCITY ),
+  actuator_type( TYPE_LINEAR ),
   axis(0,0,0)
 {
-  // no power consumed until we're subscribed
-  this->SetWatts( 0 );
+  this->SetWatts( WATTS_BASE );
   
   // sensible position defaults
   this->SetVelocity( Velocity(0,0,0,0) );
@@ -100,9 +99,9 @@
                if( type_str )
                {
                        if( strcmp( type_str, "linear" ) == 0 )
-                               actuator_type = STG_ACTUATOR_TYPE_LINEAR;
+                               actuator_type = TYPE_LINEAR;
                        else if( strcmp( type_str, "rotational" ) == 0 )
-                               actuator_type = STG_ACTUATOR_TYPE_ROTATIONAL;
+                               actuator_type = TYPE_ROTATIONAL;
                        else
                        {
                                PRINT_ERR1( "invalid actuator type specified: 
\"%s\" - should be one of: \"linear\" or \"rotational\". Using \"linear\" as 
default.", type_str );
@@ -110,7 +109,7 @@
                }
        }
 
-       if (actuator_type == STG_ACTUATOR_TYPE_LINEAR)
+       if (actuator_type == TYPE_LINEAR)
        {
                // if we are a linear actuator find the axis we operate in
                if( wf->PropertyExists( wf_entity, "axis" ) )
@@ -169,11 +168,11 @@
 
        switch (actuator_type)
        {
-               case STG_ACTUATOR_TYPE_LINEAR:
+               case TYPE_LINEAR:
                {
                        pos = PoseDiff.x * axis.x + PoseDiff.y * axis.y + 
PoseDiff.z * axis.z; // Dot product to find distance along axis
                } break;
-               case STG_ACTUATOR_TYPE_ROTATIONAL:
+               case TYPE_ROTATIONAL:
                {
                        pos = PoseDiff.a;
                } break;
@@ -186,7 +185,7 @@
        {
                switch( control_mode )
                {
-                       case STG_ACTUATOR_CONTROL_VELOCITY :
+                       case CONTROL_VELOCITY :
                                {
                                        PRINT_DEBUG( "actuator velocity control 
mode" );
                                        PRINT_DEBUG2( "model %s command(%.2f)",
@@ -198,7 +197,7 @@
                                                velocity = goal;
                                } break;
 
-                       case STG_ACTUATOR_CONTROL_POSITION:
+                       case CONTROL_POSITION:
                                {
                                        PRINT_DEBUG( "actuator position control 
mode" );
 
@@ -233,14 +232,14 @@
                Velocity outvel;
                switch (actuator_type)
                {
-                       case STG_ACTUATOR_TYPE_LINEAR:
+                       case TYPE_LINEAR:
                        {
                                outvel.x = axis.x * velocity;
                                outvel.y = axis.y * velocity;
                                outvel.z = axis.z * velocity;
                                outvel.a = 0;
                        } break;
-                       case STG_ACTUATOR_TYPE_ROTATIONAL:
+                       case TYPE_ROTATIONAL:
                        {
                                outvel.x = outvel.y = outvel.z = 0;
                                outvel.a = velocity;
@@ -263,9 +262,6 @@
        Model::Startup();
 
        PRINT_DEBUG( "position startup" );
-
-       this->SetWatts( STG_ACTUATOR_WATTS );
-
 }
 
 void ModelActuator::Shutdown( void )
@@ -277,20 +273,18 @@
 
        velocity.Zero();
 
-       this->SetWatts( 0 );
-
        Model::Shutdown();
 }
 
 void ModelActuator::SetSpeed( double speed)
 {
-       control_mode = STG_ACTUATOR_CONTROL_VELOCITY;
+       control_mode = CONTROL_VELOCITY;
        goal = speed;
 }
 
 
 void ModelActuator::GoTo( double pos)
 {
-       control_mode = STG_ACTUATOR_CONTROL_POSITION;
+       control_mode = CONTROL_POSITION;
        goal = pos;
 }

Modified: code/stage/trunk/libstage/model_getset.cc
===================================================================
--- code/stage/trunk/libstage/model_getset.cc   2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/model_getset.cc   2009-08-28 01:58:11 UTC (rev 
8239)
@@ -116,7 +116,7 @@
   CallCallbacks( &gui.outline );
 }
 
-void Model::SetWatts(  stg_watts_t val )
+void Model::SetWatts( stg_watts_t val )
 {
   watts = val;
   CallCallbacks( &watts );

Modified: code/stage/trunk/libstage/model_laser.cc
===================================================================
--- code/stage/trunk/libstage/model_laser.cc    2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/model_laser.cc    2009-08-28 01:58:11 UTC (rev 
8239)
@@ -96,6 +96,9 @@
   // set up our data buffers and raytracing
   SampleConfig();
 
+  // start consuming power
+  watts = DEFAULT_WATTS;
+
   AddVisualizer( &vis, true );  
 }
 
@@ -111,9 +114,6 @@
   fov       = wf->ReadAngle( wf_entity, "fov",  fov );
   resolution = wf->ReadInt( wf_entity, "resolution",  resolution );
   
-  //showLaserData.Load( wf, wf_entity );
-  //showLaserStrikes.Load( wf, wf_entity );
-
   if( resolution < 1 )
     {
       PRINT_WARN( "laser resolution set < 1. Forcing to 1" );
@@ -228,17 +228,12 @@
 void ModelLaser::Startup(  void )
 { 
   Model::Startup();
-
   PRINT_DEBUG( "laser startup" );
-
-  // start consuming power
-  SetWatts( DEFAULT_WATTS );
 }
 
 void ModelLaser::Shutdown( void )
 { 
   PRINT_DEBUG( "laser shutdown" );
-  SetWatts( 0 );   // stop consuming power
   Model::Shutdown();
 }
 

Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc     2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/model_load.cc     2009-08-28 01:58:11 UTC (rev 
8239)
@@ -47,40 +47,28 @@
                                                                                
                                         power_pack->GetCapacity() ) );         
        
         }
     
-  // use my own pack or an ancestor's for the other energy properties
-  PowerPack* pp = FindPowerPack();
-  
-  watts = wf->ReadFloat( wf_entity, "watts", watts );
-  if( (watts > 0) && !pp  )
-        PRINT_WARN1( "Model %s: Setting \"watts\" has no effect unless 
\"joules\" is specified for this model or a parent", token );
-    
-  watts_give = wf->ReadFloat( wf_entity, "give_watts", watts_give );  
-  if( (watts_give > 0.0) && !pp)
-        PRINT_WARN1( "Model %s: Setting \"watts_give\" has no effect unless 
\"joules\" is specified for this model or a parent", token );
-  
+  watts = wf->ReadFloat( wf_entity, "watts", watts );    
+  watts_give = wf->ReadFloat( wf_entity, "give_watts", watts_give );    
   watts_take = wf->ReadFloat( wf_entity, "take_watts", watts_take );
-  if( (watts_take > 0.0) & !pp )
-        PRINT_WARN1( "Model %s: Setting \"watts_take\" has no effect unless 
\"joules\" is specified for this model or a parent", token );    
   
-        
   if( wf->PropertyExists( wf_entity, "debug" ) )
     {
       PRINT_WARN2( "debug property specified for model %d  %s\n",
-                  wf_entity, this->token );
+                                                wf_entity, this->token );
       this->debug = wf->ReadInt( wf_entity, "debug", this->debug );
     }
-
+  
   if( wf->PropertyExists( wf_entity, "name" ) )
     {
       char *name = (char*)wf->ReadString(wf_entity, "name", NULL );
       if( name )
-       {
-         //printf( "adding name %s to %s\n", name, this->token );
-         this->token = strdup( name );
-         world->AddModel( this ); // add this name to the world's table
-       }
+                 {
+                        //printf( "adding name %s to %s\n", name, this->token 
);
+                        this->token = strdup( name );
+                        world->AddModel( this ); // add this name to the 
world's table
+                 }
       else
-       PRINT_ERR1( "Name blank for model %s. Check your worldfile\n", 
this->token );
+                 PRINT_ERR1( "Name blank for model %s. Check your 
worldfile\n", this->token );
     }
   
   //PRINT_WARN1( "%s::Load", token );

Modified: code/stage/trunk/libstage/model_position.cc
===================================================================
--- code/stage/trunk/libstage/model_position.cc 2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/model_position.cc 2009-08-28 01:58:11 UTC (rev 
8239)
@@ -83,9 +83,9 @@
                                                                                
const std::string& type ) : 
   Model( world, parent, type ),
   goal(0,0,0,0),
-  control_mode( STG_POSITION_CONTROL_VELOCITY ),
-  drive_mode( STG_POSITION_DRIVE_DIFFERENTIAL ),
-  localization_mode( STG_POSITION_LOCALIZATION_GPS ),
+  control_mode( CONTROL_VELOCITY ),
+  drive_mode( DRIVE_DIFFERENTIAL ),
+  localization_mode( LOCALIZATION_GPS ),
   integration_error( drand48() * INTEGRATION_ERROR_MAX_X - 
INTEGRATION_ERROR_MAX_X/2.0,
                                                        drand48() * 
INTEGRATION_ERROR_MAX_Y - INTEGRATION_ERROR_MAX_Y/2.0,
                                                        drand48() * 
INTEGRATION_ERROR_MAX_Z - INTEGRATION_ERROR_MAX_Z/2.0,
@@ -101,11 +101,6 @@
   // assert that Update() is reentrant for this derived model
   thread_safe = false;
        
-  // no power consumed until we're subscribed
-  this->SetWatts( 0 );
-  
-  this->SetVelocity( Velocity(0,0,0,0) );
-  
   this->SetBlobReturn( true );
   
   AddVisualizer( &wpvis, true );
@@ -131,11 +126,11 @@
                if( mode_str )
                  {
                         if( strcmp( mode_str, "diff" ) == 0 )
-                               drive_mode = STG_POSITION_DRIVE_DIFFERENTIAL;
+                               drive_mode = DRIVE_DIFFERENTIAL;
                         else if( strcmp( mode_str, "omni" ) == 0 )
-                               drive_mode = STG_POSITION_DRIVE_OMNI;
+                               drive_mode = DRIVE_OMNI;
                         else if( strcmp( mode_str, "car" ) == 0 )
-                               drive_mode = STG_POSITION_DRIVE_CAR;
+                               drive_mode = DRIVE_CAR;
                         else
                                {
                                  PRINT_ERR1( "invalid position drive mode 
specified: \"%s\" - should be one of: \"diff\", \"omni\" or \"car\". Using 
\"diff\" as default.", mode_str );              
@@ -202,9 +197,9 @@
       if( loc_str )
                  {
                         if( strcmp( loc_str, "gps" ) == 0 )
-                               localization_mode = 
STG_POSITION_LOCALIZATION_GPS;
+                               localization_mode = LOCALIZATION_GPS;
                         else if( strcmp( loc_str, "odom" ) == 0 )
-                               localization_mode = 
STG_POSITION_LOCALIZATION_ODOM;
+                               localization_mode = LOCALIZATION_ODOM;
                         else
                                PRINT_ERR2( "unrecognized localization mode 
\"%s\" for model \"%s\"."
                                                                " Valid choices 
are \"gps\" and \"odom\".", 
@@ -227,7 +222,7 @@
     {            
       switch( control_mode )
                  {
-                 case STG_POSITION_CONTROL_VELOCITY :
+                 case CONTROL_VELOCITY :
                         {
                                PRINT_DEBUG( "velocity control mode" );
                                PRINT_DEBUG4( "model %s command(%.2f %.2f 
%.2f)",
@@ -238,21 +233,21 @@
                 
                                switch( drive_mode )
                                  {
-                                 case STG_POSITION_DRIVE_DIFFERENTIAL:
+                                 case DRIVE_DIFFERENTIAL:
                                         // differential-steering model, like a 
Pioneer
                                         vel.x = goal.x;
                                         vel.y = 0;
                                         vel.a = goal.a;
                                         break;
                          
-                                 case STG_POSITION_DRIVE_OMNI:
+                                 case DRIVE_OMNI:
                                         // direct steering model, like an 
omnidirectional robot
                                         vel.x = goal.x;
                                         vel.y = goal.y;
                                         vel.a = goal.a;
                                         break;
                          
-                                 case STG_POSITION_DRIVE_CAR:
+                                 case DRIVE_CAR:
                                         // car like steering model based on 
speed and turning angle
                                         vel.x = goal.x * cos(goal.a);
                                         vel.y = 0;
@@ -264,7 +259,7 @@
                                  }
                         } break;
          
-                 case STG_POSITION_CONTROL_POSITION:
+                 case CONTROL_POSITION:
                         {
                                PRINT_DEBUG( "position control mode" );
                 
@@ -282,7 +277,7 @@
                 
                                switch( drive_mode )
                                  {
-                                 case STG_POSITION_DRIVE_OMNI:
+                                 case DRIVE_OMNI:
                                         {
                                                // this is easy - we just 
reduce the errors in each axis
                                                // independently with a 
proportional controller, speed
@@ -293,7 +288,7 @@
                                         }
                                         break;
 
-                                 case STG_POSITION_DRIVE_DIFFERENTIAL:
+                                 case DRIVE_DIFFERENTIAL:
                                         {
                                                // axes can not be controlled 
independently. We have to
                                                // turn towards the desired x,y 
position, drive there,
@@ -371,7 +366,7 @@
 
   switch( localization_mode )
     {
-    case STG_POSITION_LOCALIZATION_GPS:
+    case LOCALIZATION_GPS:
       {
                  // compute our localization pose based on the origin and true 
pose
                  Pose gpose = this->GetGlobalPose();
@@ -387,7 +382,7 @@
       }
       break;
 
-    case STG_POSITION_LOCALIZATION_ODOM:
+    case LOCALIZATION_ODOM:
       {
                  // integrate our velocities to get an 'odometry' position 
estimate.
                  double dt = interval / 1e6; // update interval convert to 
seconds
@@ -419,10 +414,8 @@
 void ModelPosition::Startup( void )
 {
   Model::Startup();
-
+  
   PRINT_DEBUG( "position startup" );
-
-  this->SetWatts( WATTS );
 }
 
 void ModelPosition::Shutdown( void )
@@ -430,11 +423,9 @@
   PRINT_DEBUG( "position shutdown" );
 
   // safety features!
-  bzero( &goal, sizeof(goal) );
-  bzero( &velocity, sizeof(velocity) );
+  goal.Zero();
+  velocity.Zero();
 
-  this->SetWatts( 0 );
-
   Model::Shutdown();
 }
 
@@ -449,7 +440,7 @@
   //assert( ! isnan(y) );
   //assert( ! isnan(a) );
   
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.x = x;
   goal.y = y;
   goal.z = 0;
@@ -459,7 +450,7 @@
 void ModelPosition::SetXSpeed( double x )
 { 
   //assert( ! isnan(x) );
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.x = x;
 }  
 
@@ -467,21 +458,21 @@
 void ModelPosition::SetYSpeed( double y )
 { 
   //assert( ! isnan(y) );
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.y = y;
 }  
 
 void ModelPosition::SetZSpeed( double z )
 { 
   //assert( ! isnan(z) );
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.z = z;
 }  
 
 void ModelPosition::SetTurnSpeed( double a )
 { 
   //assert( ! isnan(a) );
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.a = a;
 }  
 
@@ -493,7 +484,7 @@
   //assert( ! isnan(vel.z) );
   //assert( ! isnan(vel.a) );
 
-  control_mode = STG_POSITION_CONTROL_VELOCITY;
+  control_mode = CONTROL_VELOCITY;
   goal.x = vel.x;
   goal.y = vel.y;
   goal.z = vel.z;
@@ -506,7 +497,7 @@
   //assert( ! isnan(y) );
   //assert( ! isnan(a) );
 
-  control_mode = STG_POSITION_CONTROL_POSITION;
+  control_mode = CONTROL_POSITION;
   goal.x = x;
   goal.y = y;
   goal.z = 0;
@@ -515,7 +506,7 @@
 
 void ModelPosition::GoTo( Pose pose ) 
 {
-  control_mode = STG_POSITION_CONTROL_POSITION;
+  control_mode = CONTROL_POSITION;
   goal = pose;
 }  
 

Modified: code/stage/trunk/libstage/powerpack.cc
===================================================================
--- code/stage/trunk/libstage/powerpack.cc      2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/powerpack.cc      2009-08-28 01:58:11 UTC (rev 
8239)
@@ -23,7 +23,10 @@
   stored( 0.0 ), 
   capacity( 0.0 ), 
   charging( false ),
-  dissipated( 0.0 )
+  dissipated( 0.0 ),
+  last_time(0),
+  last_joules(0.0),
+  last_watts(0.0)
 { 
   // tell the world about this new pp
   mod->world->AddPowerPack( this );  
@@ -48,7 +51,7 @@
 }
 
 /** OpenGL visualization of the powerpack state */
-void PowerPack::Visualize( Camera* cam ) const
+void PowerPack::Visualize( Camera* cam ) 
 {
   const double height = 0.5;
   const double width = 0.2;
@@ -64,8 +67,7 @@
                else
                  glColor4f( 1,0,0, alpha ); // red
   
-  static char buf[6];
-  snprintf( buf, 6, "%.0f", percent );
+  //  snprintf( buf, 32, "%.0f", percent );
   
   glTranslatef( -width, 0.0, 0.0 );
   
@@ -126,9 +128,29 @@
                glLineWidth( 1.0 );
         }
   
-    
-  // draw the percentage
-  //gl_draw_string( -0.2, 0, 0, buf );  
+  
+  // compute the instantaneous power output
+  stg_usec_t time_now = mod->world->SimTimeNow();
+  stg_usec_t delta_t = time_now - last_time;
+  stg_watts_t watts = last_watts;
+  
+  if( delta_t > 0 ) // some sim time elapsed 
+        {
+               stg_joules_t delta_j = stored - last_joules;
+               stg_watts_t watts = (-1e6 * delta_j) / (double)delta_t;
+               
+               last_joules = stored;
+               last_time = time_now;    
+               last_watts = watts;
+        }
+  
+  if( fabs(watts) > 1e-5 ) // any current
+        {
+               glColor4f( 1,0,0,0.8 ); // red
+               char buf[32];
+               snprintf( buf, 32, "%.1fW", watts );  
+               Gl::draw_string( -0.05,height+0.05,0, buf );    
+        }
 }
 
 

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-08-27 23:41:43 UTC (rev 8238)
+++ code/stage/trunk/libstage/stage.hh  2009-08-28 01:58:11 UTC (rev 8239)
@@ -146,9 +146,6 @@
     "The text of the license may also be available online at\n"                
\
     "http://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n";;
   
-  /** The maximum length of a Stage model identifier string */
-  const uint32_t TOKEN_MAX = 64;
-
   /** Convenient constant */
   const double thousand = 1e3;
 
@@ -695,8 +692,10 @@
         void Load( Worldfile* wf, int section );
         void Save( Worldfile* wf, int section );
         
-  public:
-       
+  public:      
+        /** The maximum length of a Stage model identifier string */
+        static const uint32_t TOKEN_MAX = 64;
+                
     /** get the children of the this element */
         ModelPtrVec& GetChildren(){ return children;}
     
@@ -704,7 +703,6 @@
     void ForEachDescendant( stg_model_callback_t func, void* arg );
                
     /** array contains the number of each type of child model */
-    //unsigned int child_type_counts[MODEL_TYPE_COUNT];
         std::map<std::string,unsigned int> child_type_counts;
         
     Ancestor();
@@ -1223,16 +1221,17 @@
     uint32_t GetCount(){ return blocks.size(); };
     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 */
+        
+    /** Establish the min and max of all the blocks, so we can scale this
+                 group later. */
     void CalcSize();
+        
     void AppendBlock( Block* block );
     void CallDisplayList( Model* mod );
     void Clear() ; /** deletes all blocks from the group */
         
         void AppendTouchingModels( ModelPtrSet& touchers );
-       
+        
     /** Returns a pointer to the first model detected to be colliding
                  with a block in this group, or NULL, if none are detected. */
     Model* TestCollision();
@@ -1242,12 +1241,12 @@
     void Map();
     void UnMap();
         
-    void DrawSolid( const Geom &geom); // draw the block in OpenGL as a solid 
single color
-    void DrawFootPrint( const Geom &geom); // draw the
-    // projection of the
-    // block onto the z=0
-    // plane
+        /** Draw the block in OpenGL as a solid single color. */
+    void DrawSolid( const Geom &geom); 
 
+        /** Draw the projection of the block onto the z=0 plane. */
+        void DrawFootPrint( const Geom &geom);
+
     void LoadBitmap( Model* mod, const char* bitmapfile, Worldfile *wf );
     void LoadBlock( Model* mod, Worldfile* wf, int entity );
         
@@ -1263,12 +1262,6 @@
 
   };
 
-
-  //typedef int ctrlinit_t( Model* mod );
-  //typedef void ctrlupdate_t( Model* mod );
-  
-  // BLOCKS
-
   class Camera 
   {
   protected:
@@ -1419,8 +1412,8 @@
                  timesteps. */
     stg_usec_t real_time_interval;
         
-    stg_usec_t real_time_now; ///< The current real time in microseconds
-    //stg_usec_t real_time_start; ///< the real time at which this world was 
created
+        /** The current real time in microseconds. */
+    stg_usec_t real_time_now; 
 
         /** The last recorded real time, sampled every $timing_interval
                  updates. */
@@ -1547,6 +1540,7 @@
                
                void Accumulate( stg_meters_t x, stg_meters_t y, stg_joules_t 
amount );
         } event_vis;
+        
 
         StripPlotVis output_vis;
         StripPlotVis stored_vis;
@@ -1565,6 +1559,11 @@
         
         /** Energy dissipated */
         stg_joules_t dissipated;
+        
+        // these are used to visualize the power draw
+        stg_usec_t last_time;
+        stg_joules_t last_joules;
+        stg_watts_t last_watts;
 
         static stg_joules_t global_stored;
         static stg_joules_t global_capacity;
@@ -1576,7 +1575,7 @@
         ~PowerPack();
         
         /** OpenGL visualization of the powerpack state */
-        void Visualize( Camera* cam ) const;
+        void Visualize( Camera* cam );
 
         /** Print human-readable status on stdout, prefixed with the
                  argument string */
@@ -1816,7 +1815,7 @@
                void ClearPts();
          
         } rastervis;
-               
+        
         bool rebuild_displaylist; ///< iff true, regenerate block display list 
before redraw
         char* say_string;   ///< if non-null, this string is displayed in the 
GUI 
                
@@ -2849,21 +2848,21 @@
   public:
         /** Define a position  control method */
         typedef enum
-               { STG_POSITION_CONTROL_VELOCITY, 
-                 STG_POSITION_CONTROL_POSITION 
+               { CONTROL_VELOCITY, 
+                 CONTROL_POSITION 
                } ControlMode;
         
         /** Define a localization method */
         typedef enum
-               { STG_POSITION_LOCALIZATION_GPS, 
-                 STG_POSITION_LOCALIZATION_ODOM 
+               { LOCALIZATION_GPS, 
+                 LOCALIZATION_ODOM 
                } LocalizationMode;
         
         /** Define a driving method */
         typedef enum
-               { STG_POSITION_DRIVE_DIFFERENTIAL, 
-                 STG_POSITION_DRIVE_OMNI, 
-                 STG_POSITION_DRIVE_CAR 
+               { DRIVE_DIFFERENTIAL, 
+                 DRIVE_OMNI, 
+                 DRIVE_CAR 
                } DriveMode;
         
   private:
@@ -2942,14 +2941,14 @@
   public:
         /** Define a actuator control method */
         typedef enum
-               { STG_ACTUATOR_CONTROL_VELOCITY,
-                 STG_ACTUATOR_CONTROL_POSITION
+               { CONTROL_VELOCITY,
+                 CONTROL_POSITION
                } ControlMode;
   
         /** Define an actuator type */
         typedef enum
-               { STG_ACTUATOR_TYPE_LINEAR,
-                 STG_ACTUATOR_TYPE_ROTATIONAL
+               { TYPE_LINEAR,
+                 TYPE_ROTATIONAL
                } ActuatorType;
   
   private:
@@ -2976,13 +2975,13 @@
         virtual void Update();
         virtual void Load();
   
-        /** Sets the control_mode to STG_ACTUATOR_CONTROL_VELOCITY and sets
+        /** Sets the control_mode to CONTROL_VELOCITY and sets
                  the goal velocity. */
         void SetSpeed( double speed );
   
         double GetSpeed() const {return goal;}
   
-        /** Sets the control mode to STG_ACTUATOR_CONTROL_POSITION and sets
+        /** Sets the control mode to CONTROL_POSITION and sets
                  the goal pose */
         void GoTo( double pose );
   

Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc       2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/libstage/worldgui.cc       2009-08-28 01:58:11 UTC (rev 
8239)
@@ -607,13 +607,6 @@
 
 void WorldGui::viewOptionsCb( OptionsDlg* oDlg, WorldGui* wg ) 
 {
-  // the options dialog expects a std::vector of options (annoyingly)
-  // std::vector<Option*> optvec;
-  // adds each option to the vector
-  //g_hash_table_foreach( wg->option_table, 
-  //                                           (GHFunc)append_option, 
-  //                                           (void*)&optvec );  
-  
   // sort the vector by option label alphabetically
   //std::sort();// wg->option_table.begin(), wg->option_table.end() );//, 
sort_option_pointer );
   //std::sort();// wg->option_table.begin(), wg->option_table.end() );//, 
sort_option_pointer );

Modified: code/stage/trunk/worlds/simple.world
===================================================================
--- code/stage/trunk/worlds/simple.world        2009-08-27 23:41:43 UTC (rev 
8238)
+++ code/stage/trunk/worlds/simple.world        2009-08-28 01:58:11 UTC (rev 
8239)
@@ -48,7 +48,6 @@
      # ctrl "lasernoise"  # uncomment this line to run a laser noise generator
   )
  
-
   ctrl "wander"
 
   # report error-free position in world coordinates


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