Update of /cvsroot/playerstage/code/stage/libstage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv637/libstage

Modified Files:
        Makefile.am TODO model.cc stage.hh typetable.cc worldfile.cc 
Log Message:
added stall sensor and visualization

Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/model.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** model.cc    3 Mar 2008 07:01:12 -0000       1.10
--- model.cc    1 Apr 2008 23:57:41 -0000       1.11
***************
*** 183,187 ****
    this->say_string = NULL;
    this->subs = 0;
!   
    this->geom.size.x = STG_DEFAULT_MOD_GEOM_SIZEX;
    this->geom.size.y = STG_DEFAULT_MOD_GEOM_SIZEX;
--- 183,188 ----
    this->say_string = NULL;
    this->subs = 0;
!   this->stall = false;
! 
    this->geom.size.x = STG_DEFAULT_MOD_GEOM_SIZEX;
    this->geom.size.y = STG_DEFAULT_MOD_GEOM_SIZEX;
***************
*** 208,212 ****
  
    this->flag_list = NULL;
! 
    bzero( &this->velocity, sizeof(velocity));
  
--- 209,215 ----
  
    this->flag_list = NULL;
!   
!   this->blinkenlights = g_ptr_array_new();
!   
    bzero( &this->velocity, sizeof(velocity));
  
***************
*** 247,250 ****
--- 250,274 ----
    
    // anything else to do here?
+   
+   // try some things out;
+   stg_blinkenlight_t* b = new stg_blinkenlight_t;
+   b->pose.x = 0;
+   b->pose.y = 0;
+   b->pose.z = 0.4;
+   b->pose.a = 0;
+   b->enabled = true;
+   b->color = stg_color_pack( 1,1,0,0 );
+   b->size = 0.1;
+ 
+   //AddBlinkenlight( b );
+ 
+   stg_blinkenlight_t* c = new stg_blinkenlight_t;
+   c->pose.x = 0.1;
+   c->pose.y = 0;
+   c->pose.z = 0.4;
+   c->pose.a = 0;
+   c->enabled = false;
+   c->color = stg_color_pack( 1,1,0,0 );
+   c->size = 0.1;
  }  
  
***************
*** 889,894 ****
--- 913,925 ----
      DrawFlagList();
  
+   if( blinkenlights )
+     DrawBlinkenlights();
+ 
+  if( stall )
+    gl_draw_string( 0,0,0.5, "!" );
+  
    // shift up the CS to the top of this model
    gl_coord_shift(  0,0, this->geom.size.z, 0 );
+ 
    
    // recursively draw the tree below this model 
***************
*** 903,908 ****
    glPushMatrix();
    
- 
- 
    GLUquadric* quadric = gluNewQuadric();
    glTranslatef(0,0,1); // jump up
--- 934,937 ----
***************
*** 946,949 ****
--- 975,1013 ----
  }
  
+ void StgModel::DrawBlinkenlights()
+ {
+   glPushMatrix();
+   
+   GLUquadric* quadric = gluNewQuadric();
+   //glTranslatef(0,0,1); // jump up
+   //stg_pose_t gpose = GetGlobalPose();
+   //glRotatef( 180 + rtod(-gpose.a),0,0,1 );
+   
+   glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ 
+   for( int i=0; i<blinkenlights->len; i++ )
+     {
+       stg_blinkenlight_t* b = 
+       (stg_blinkenlight_t*)g_ptr_array_index( blinkenlights, i );
+       assert(b);
+ 
+       glTranslatef( b->pose.x, b->pose.y, b->pose.z );
+ 
+       PushColor( b->color );
+ 
+       if( b->enabled )
+       gluQuadricDrawStyle( quadric, GLU_FILL );
+       else
+       gluQuadricDrawStyle( quadric, GLU_LINE );
+ 
+       gluSphere( quadric, b->size/2.0, 8,8  );
+            
+       PopColor();
+     }
+ 
+   gluDeleteQuadric( quadric );
+   glPopMatrix();
+ }
+ 
  void StgModel::DrawPicker( void )
  {
***************
*** 1366,1369 ****
--- 1430,1435 ----
     if( hitthing )
       {
+        // XX 
+        SetStall( true );
         //printf( "hit %s at %.2f %.2f\n",
         //      hitthing->Token(), hitx, hity );
***************
*** 1374,1377 ****
--- 1440,1446 ----
     else
       {
+        // XX 
+        SetStall( false );
+  
         stg_pose_t newpose;
         stg_pose_sum( &newpose, &this->pose, &p );

Index: typetable.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/typetable.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** typetable.cc        15 Jan 2008 01:16:49 -0000      1.2
--- typetable.cc        1 Apr 2008 23:57:41 -0000       1.3
***************
*** 12,15 ****
--- 12,16 ----
    { "fiducial",   StgModelFiducial::Create },
    { "blobfinder", StgModelBlobfinder::Create },
+   { "blinkenlight", StgModelBlinkenlight::Create },
    { NULL, NULL } // this must be the last entry
  };

Index: Makefile.am
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Makefile.am 3 Mar 2008 06:02:26 -0000       1.10
--- Makefile.am 1 Apr 2008 23:57:41 -0000       1.11
***************
*** 35,38 ****
--- 35,39 ----
        model_ranger.cc \
        model_blobfinder.cc \
+       model_blinkenlight.cc \
        model_props.cc \
        resource.cc \

Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/stage.hh,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** stage.hh    4 Mar 2008 02:09:56 -0000       1.14
--- stage.hh    1 Apr 2008 23:57:41 -0000       1.15
***************
*** 844,847 ****
--- 844,857 ----
    };
  
+   
+   typedef struct 
+   {
+     int enabled;
+     stg_pose_t pose;
+     stg_meters_t size; ///< rendered as a sphere with this diameter
+     stg_color_t color;
+     stg_msec_t period; ///< duration of a complete cycle
+     double duty_cycle; ///< mark/space ratio
+   } stg_blinkenlight_t;
  
    typedef struct
***************
*** 1235,1238 ****
--- 1245,1251 ----
  
      GList* flag_list;
+     
+     GPtrArray* blinkenlights;
+     void DrawBlinkenlights();
  
    public:
***************
*** 1266,1270 ****
  
      void DrawFlagList();
! 
      virtual void PushColor( stg_color_t col )
      { world->PushColor( col ); }
--- 1279,1293 ----
  
      void DrawFlagList();
!     
!     void AddBlinkenlight( stg_blinkenlight_t* b )
!     {
!       g_ptr_array_add( this->blinkenlights, b );
!     }
!     
!     void ClearBlinkenlights()
!     {
!       g_ptr_array_set_size( this->blinkenlights, 0 );
!     }
!     
      virtual void PushColor( stg_color_t col )
      { world->PushColor( col ); }
***************
*** 1837,1847 ****
    // there is currently no energy command packet
  
-   // BLINKENLIGHT -------------------------------------------------------
- 
-   //typedef struct
-   //{
-   //int enable;
-   //stg_msec_t period;
-   //} stg_blinkenlight_t;
    
    // LASER MODEL --------------------------------------------------------
--- 1860,1863 ----
***************
*** 2138,2141 ****
--- 2154,2190 ----
      }    
    };
+ 
+   // BLINKENLIGHT MODEL ----------------------------------------------------
+   class StgModelBlinkenlight : public StgModel
+   {
+   private:
+     double dutycycle;
+     bool enabled;
+     double period;
+     bool on;
+ 
+   public:
+ 
+     StgModelBlinkenlight( StgWorld* world,
+                         StgModel* parent, 
+                         stg_id_t id, 
+                         char* typestr );
+ 
+     ~StgModelBlinkenlight();
+ 
+     virtual void Load();
+     virtual void Update();
+     virtual void Draw( uint32_t flags );
+ 
+     // static wrapper for the constructor - all models must implement
+     // this method and add an entry in typetable.cc
+     static StgModel* Create( StgWorld* world,
+                            StgModel* parent, 
+                            stg_id_t id, 
+                            char* typestr )
+     { 
+       return (StgModel*)new StgModelBlinkenlight( world, parent, id, typestr 
); 
+     }    
+   };
    
    // POSITION MODEL --------------------------------------------------------

Index: worldfile.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/worldfile.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** worldfile.cc        21 Feb 2008 23:40:13 -0000      1.3
--- worldfile.cc        1 Apr 2008 23:57:41 -0000       1.4
***************
*** 549,552 ****
--- 549,554 ----
    AddToken(TokenEOL, "\n", include);
        
+   //DumpTokens();
+ 
    // Read tokens from the file
    if (!LoadTokens(infile, include + 1))
***************
*** 556,559 ****
--- 558,566 ----
      return false;
    }
+   
+   // consume the rest of the include line XX a bit of a hack - assumes
+   // that an include is the last thing on a line
+   while ( ch != '\n' )
+     ch = fgetc(file);
  
    free(fullpath);

Index: TODO
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/TODO,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TODO        22 Feb 2008 21:20:47 -0000      1.4
--- TODO        1 Apr 2008 23:57:41 -0000       1.5
***************
*** 7,10 ****
--- 7,11 ----
  * 3d collision detection broken - e.g. fancypioneer2dx
  * [OSX only - FLTK bug?] loading window size constrains maximum window size
+ * alpha properly done
  
  INCOMPLETE


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to