Revision: 7306
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7306&view=rev
Author:   rtv
Date:     2009-01-27 04:02:15 +0000 (Tue, 27 Jan 2009)

Log Message:
-----------
bugfixes

Modified Paths:
--------------
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_props.cc
    code/stage/trunk/libstage/option.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstageplugin/p_driver.cc
    code/stage/trunk/libstageplugin/p_fiducial.cc
    code/stage/trunk/libstageplugin/p_position.cc

Removed Paths:
-------------
    code/stage/trunk/libstage/draw.cc

Deleted: code/stage/trunk/libstage/draw.cc
===================================================================
--- code/stage/trunk/libstage/draw.cc   2009-01-27 01:18:55 UTC (rev 7305)
+++ code/stage/trunk/libstage/draw.cc   2009-01-27 04:02:15 UTC (rev 7306)
@@ -1,4 +0,0 @@
-/* Author: Richard Vaughan
-   Date
-#include "stage_internal.hh"
-

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-01-27 01:18:55 UTC (rev 7305)
+++ code/stage/trunk/libstage/model.cc  2009-01-27 04:02:15 UTC (rev 7306)
@@ -615,18 +615,20 @@
 {
   subs++;
   world->total_subs++;
-
+  world->dirty = true; // need redraw
+  
   //printf( "subscribe to %s %d\n", token, subs );
-
+  
   // if this is the first sub, call startup
-  if( this->subs == 1 )
-    this->Startup();
+  if( subs == 1 )
+    Startup();
 }
 
 void Model::Unsubscribe( void )
 {
   subs--;
   world->total_subs--;
+  world->dirty = true; // need redraw
 
   printf( "unsubscribe from %s %d\n", token, subs );
 
@@ -1683,9 +1685,7 @@
 }
 
 Model* Model::GetUnsubscribedModelOfType( stg_model_type_t type )
-{
-  printf( "searching for type %d in model %s type %d\n", type, token, 
this->type );
-  
+{  
   if( (this->type == type) && (this->subs == 0) )
     return this;
 
@@ -1705,7 +1705,7 @@
 
 Model* Model::GetUnusedModelOfType( stg_model_type_t type )
 {
-  printf( "searching for type %d in model %s type %d\n", type, token, 
this->type );
+  //printf( "searching for type %d in model %s type %d\n", type, token, 
this->type );
 
   if( (this->type == type) && (!this->used ) )
     {

Modified: code/stage/trunk/libstage/model_props.cc
===================================================================
--- code/stage/trunk/libstage/model_props.cc    2009-01-27 01:18:55 UTC (rev 
7305)
+++ code/stage/trunk/libstage/model_props.cc    2009-01-27 04:02:15 UTC (rev 
7306)
@@ -7,16 +7,16 @@
 void* Model::GetProperty( char* key )
 {
        // see if the key has the predefined-property prefix
-       if( strncmp( key, STG_MP_PREFIX, strlen(STG_MP_PREFIX)) == 0 )
+       if( strncmp( key, MP_PREFIX, strlen(MP_PREFIX)) == 0 )
        {
-               if( MATCH( key, STG_MP_COLOR))            return (void*)&color;
-               if( MATCH( key, STG_MP_MASS))             return (void*)&mass;
-               if( MATCH( key, STG_MP_WATTS))            return (void*)&watts;
-               if( MATCH( key, STG_MP_FIDUCIAL_RETURN))  return 
(void*)&vis.fiducial_return;
-               if( MATCH( key, STG_MP_LASER_RETURN))     return 
(void*)&vis.laser_return;
-               if( MATCH( key, STG_MP_OBSTACLE_RETURN))  return 
(void*)&vis.obstacle_return;
-               if( MATCH( key, STG_MP_RANGER_RETURN))    return 
(void*)&vis.ranger_return;
-               if( MATCH( key, STG_MP_GRIPPER_RETURN))   return 
(void*)&vis.gripper_return;
+               if( MATCH( key, MP_COLOR))            return (void*)&color;
+               if( MATCH( key, MP_MASS))             return (void*)&mass;
+               if( MATCH( key, MP_WATTS))            return (void*)&watts;
+               if( MATCH( key, MP_FIDUCIAL_RETURN))  return 
(void*)&vis.fiducial_return;
+               if( MATCH( key, MP_LASER_RETURN))     return 
(void*)&vis.laser_return;
+               if( MATCH( key, MP_OBSTACLE_RETURN))  return 
(void*)&vis.obstacle_return;
+               if( MATCH( key, MP_RANGER_RETURN))    return 
(void*)&vis.ranger_return;
+               if( MATCH( key, MP_GRIPPER_RETURN))   return 
(void*)&vis.gripper_return;
 
                PRINT_WARN1( "Requested non-existent model core property 
\"%s\"", key );
                return NULL;
@@ -30,46 +30,46 @@
                void* data )
 {
        // see if the key has the predefined-property prefix
-       if( strncmp( key, STG_MP_PREFIX, strlen(STG_MP_PREFIX)) == 0 )
+       if( strncmp( key, MP_PREFIX, strlen(MP_PREFIX)) == 0 )
        {
                PRINT_DEBUG1( "Looking up model core property \"%s\"\n", key );
 
-               if( MATCH(key,STG_MP_FIDUCIAL_RETURN) )
+               if( MATCH(key,MP_FIDUCIAL_RETURN) )
                {
                        this->SetFiducialReturn( *(int*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_LASER_RETURN ) )
+               if( MATCH( key, MP_LASER_RETURN ) )
                {
                        this->SetLaserReturn( *(stg_laser_return_t*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_OBSTACLE_RETURN ) )
+               if( MATCH( key, MP_OBSTACLE_RETURN ) )
                {
                        this->SetObstacleReturn( *(int*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_RANGER_RETURN ) )
+               if( MATCH( key, MP_RANGER_RETURN ) )
                {
                        this->SetRangerReturn( *(int*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_GRIPPER_RETURN ) )
+               if( MATCH( key, MP_GRIPPER_RETURN ) )
                {
                        this->SetGripperReturn( *(int*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_COLOR ) )
+               if( MATCH( key, MP_COLOR ) )
                {
                        this->SetColor( *(int*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_MASS ) )
+               if( MATCH( key, MP_MASS ) )
                {
                        this->SetMass( *(double*)data );
                        return 0;
                }
-               if( MATCH( key, STG_MP_WATTS ) )
+               if( MATCH( key, MP_WATTS ) )
                {
                        this->SetWatts( *(double*)data );
                        return 0;
@@ -87,7 +87,7 @@
 
 void Model::UnsetProperty( char* key )
 {
-       if( strncmp( key, STG_MP_PREFIX, strlen(STG_MP_PREFIX)) == 0 )
+       if( strncmp( key, MP_PREFIX, strlen(MP_PREFIX)) == 0 )
                PRINT_WARN1( "Attempt to unset a model core property \"%s\" has 
no effect", key );
        else
                g_datalist_remove_data( &this->props, key );

Modified: code/stage/trunk/libstage/option.cc
===================================================================
--- code/stage/trunk/libstage/option.cc 2009-01-27 01:18:55 UTC (rev 7305)
+++ code/stage/trunk/libstage/option.cc 2009-01-27 04:02:15 UTC (rev 7306)
@@ -24,7 +24,7 @@
 
 void Option::Load( Worldfile* wf, int section )
 {
-  printf( "loading wf key %s\n", wf_token.c_str() );
+  //printf( "loading wf key %s\n", wf_token.c_str() );
        set( (bool)wf->ReadInt( section, wf_token.c_str(), value ));
 }
 

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-01-27 01:18:55 UTC (rev 7305)
+++ code/stage/trunk/libstage/stage.hh  2009-01-27 04:02:15 UTC (rev 7306)
@@ -102,7 +102,7 @@
 
   /// Copyright string
   const char COPYRIGHT[] =                                    
-    "Copyright Richard Vaughan and contributors 2000-2008";
+    "Copyright Richard Vaughan and contributors 2000-2009";
 
   /// Author string
   const char AUTHORS[] =                                       
@@ -420,18 +420,18 @@
   const uint32_t STG_MOVE_ROT   = (1 << 1); ///< bitmask for stg_movemask_t
   const uint32_t STG_MOVE_SCALE = (1 << 2); ///< bitmask for stg_movemask_t
 
-  const char STG_MP_PREFIX[] =             "_mp_";
-  const char STG_MP_POSE[] =               "_mp_pose";
-  const char STG_MP_VELOCITY[] =           "_mp_velocity";
-  const char STG_MP_GEOM[] =               "_mp_geom";
-  const char STG_MP_COLOR[] =              "_mp_color";
-  const char STG_MP_WATTS[] =              "_mp_watts";
-  const char STG_MP_FIDUCIAL_RETURN[] =    "_mp_fiducial_return";
-  const char STG_MP_LASER_RETURN[] =       "_mp_laser_return";
-  const char STG_MP_OBSTACLE_RETURN[] =    "_mp_obstacle_return";
-  const char STG_MP_RANGER_RETURN[] =      "_mp_ranger_return";
-  const char STG_MP_GRIPPER_RETURN[] =     "_mp_gripper_return";
-  const char STG_MP_MASS[] =               "_mp_mass";
+  const char MP_PREFIX[] =             "_mp_";
+  const char MP_POSE[] =               "_mp_pose";
+  const char MP_VELOCITY[] =           "_mp_velocity";
+  const char MP_GEOM[] =               "_mp_geom";
+  const char MP_COLOR[] =              "_mp_color";
+  const char MP_WATTS[] =              "_mp_watts";
+  const char MP_FIDUCIAL_RETURN[] =    "_mp_fiducial_return";
+  const char MP_LASER_RETURN[] =       "_mp_laser_return";
+  const char MP_OBSTACLE_RETURN[] =    "_mp_obstacle_return";
+  const char MP_RANGER_RETURN[] =      "_mp_ranger_return";
+  const char MP_GRIPPER_RETURN[] =     "_mp_gripper_return";
+  const char MP_MASS[] =               "_mp_mass";
 
 
   /// laser return value
@@ -472,20 +472,20 @@
     } bounds3_t;
 
     typedef enum {
-      STG_D_DRAW_POINTS,
-      STG_D_DRAW_LINES,
-      STG_D_DRAW_LINE_STRIP,
-      STG_D_DRAW_LINE_LOOP,
-      STG_D_DRAW_TRIANGLES,
-      STG_D_DRAW_TRIANGLE_STRIP,
-      STG_D_DRAW_TRIANGLE_FAN,
-      STG_D_DRAW_QUADS,
-      STG_D_DRAW_QUAD_STRIP,
-      STG_D_DRAW_POLYGON,
-      STG_D_PUSH,
-      STG_D_POP,
-      STG_D_ROTATE,
-      STG_D_TRANSLATE,
+      DRAW_POINTS,
+      DRAW_LINES,
+      DRAW_LINE_STRIP,
+      DRAW_LINE_LOOP,
+      DRAW_TRIANGLES,
+      DRAW_TRIANGLE_STRIP,
+      DRAW_TRIANGLE_FAN,
+      DRAW_QUADS,
+      DRAW_QUAD_STRIP,
+      DRAW_POLYGON,
+      PUSH,
+      POP,
+      ROTATE,
+      TRANSLATE,
     } type_t;
 
     /** the start of all stg_d structures looks like this */
@@ -1919,10 +1919,15 @@
        
   /** set a model's geometry (size and center offsets) */
   void SetGeom(  Geom src );
-       
-  /** set a model's geometry (size and center offsets) */
+  
+  /** Set a model's fiducial return value. Values less than zero
+               are not detected by the fiducial sensor. */
   void SetFiducialReturn(  int fid );
-       
+  
+  /** Get a model's fiducial return value. */
+  int GetFiducialReturn()
+  { return vis.fiducial_return; }
+  
   /** set a model's fiducial key: only fiducial finders with a
       matching key can detect this model as a fiducial. */
   void SetFiducialKey(  int key );

Modified: code/stage/trunk/libstageplugin/p_driver.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_driver.cc 2009-01-27 01:18:55 UTC (rev 
7305)
+++ code/stage/trunk/libstageplugin/p_driver.cc 2009-01-27 04:02:15 UTC (rev 
7306)
@@ -137,7 +137,6 @@
 
 */
 
-
 // TODO - configs I should implement
 //  - PLAYER_SONAR_POWER_REQ
 //  - PLAYER_BLOBFINDER_SET_COLOR_REQ
@@ -148,15 +147,14 @@
 #include <unistd.h>
 #include <string.h>
 #include <math.h>
-
+#include "config.h"
 #include "p_driver.h"
 using namespace Stg;
 
 const char* copyright_notice =
 "\n * Part of the Player Project [http://playerstage.sourceforge.net]\n";
-" * Copyright 2000-2007 Richard Vaughan, Brian Gerkey and contributors.\n"
-" * Released under the GNU General Public License v2.\n"
-" **\n";
+" * Copyright 2000-2009 Richard Vaughan, Brian Gerkey and contributors.\n"
+" * Released under the GNU General Public License v2.\n";
 
 #define STG_DEFAULT_WORLDFILE "default.world"
 #define DRIVER_ERROR(X) printf( "Stage driver error: %s\n", X )
@@ -195,7 +193,7 @@
 // driver can support and how to create a driver instance.
 void StgDriver_Register(DriverTable* table)
 {
-  printf( "\n ** Stage plugin v%s **", "3.0dev" ); // XX TODO
+  printf( "\n ** %s plugin v%s **",  PROJECT, VERSION ); // XX TODO
 
   if( !player_quiet_startup )
     {
@@ -417,8 +415,8 @@
                                   player_devaddr_t* addr,
                                   stg_model_type_t type )
 {
-  printf( "attempting to find a model under model \"%s\" of type [%d]\n",
-                        basename, type );
+  //printf( "attempting to find a model under model \"%s\" of type [%d]\n",
+  //    basename, type );
 
   Model* base_model = world->GetModel( basename );
 

Modified: code/stage/trunk/libstageplugin/p_fiducial.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_fiducial.cc       2009-01-27 01:18:55 UTC 
(rev 7305)
+++ code/stage/trunk/libstageplugin/p_fiducial.cc       2009-01-27 04:02:15 UTC 
(rev 7306)
@@ -164,11 +164,10 @@
                                                                                
  this->addr))
     {
       // fill in the data formatted player-like
-#warning disabled this bit
-      player_fiducial_id_t pid;
-//      pid.id = mod->FiducialReturn();
-      pid.id = 0;
 
+      player_fiducial_id_t pid;
+               pid.id = mod->GetFiducialReturn();
+               
       // acknowledge, including the new ID
       this->driver->Publish(this->addr, resp_queue,
                                                                         
PLAYER_MSGTYPE_RESP_ACK,

Modified: code/stage/trunk/libstageplugin/p_position.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_position.cc       2009-01-27 01:18:55 UTC 
(rev 7305)
+++ code/stage/trunk/libstageplugin/p_position.cc       2009-01-27 04:02:15 UTC 
(rev 7306)
@@ -224,22 +224,15 @@
   {
     if(hdr->size == sizeof(player_position2d_position_mode_req_t))
     {
-      PRINT_WARN( "set control mode not implemented") ;
 
-      player_position2d_position_mode_req_t* req = 
-              (player_position2d_position_mode_req_t*)data;
+      //player_position2d_position_mode_req_t* req = 
+               //      (player_position2d_position_mode_req_t*)data;
 
-      stg_position_control_mode_t mode = 
(stg_position_control_mode_t)req->state;
+      //stg_position_control_mode_t mode = 
(stg_position_control_mode_t)req->state;
 
-      // XX should this be in cfg instead?
-      //cmd->mode = mode;
-      //model_change( mod, &mod->cmd );
 
-      
-
-      //stg_model_set_property( mod, "position_control", &mode, sizeof(mode));
-
       PRINT_WARN2( "Put model %s into %s control mode", this->mod->Token(), 
mod ? "POSITION" : "VELOCITY" );
+      PRINT_WARN( "set control mode not yet implemented") ;
 
       this->driver->Publish( this->addr, resp_queue, 
                              PLAYER_MSGTYPE_RESP_ACK, 


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

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to