Revision: 6742 http://playerstage.svn.sourceforge.net/playerstage/?rev=6742&view=rev Author: jeremy_asher Date: 2008-07-02 14:41:39 -0700 (Wed, 02 Jul 2008)
Log Message: ----------- Added filter options for all sensor classes Modified Paths: -------------- code/stage/trunk/libstage/model_blinkenlight.cc code/stage/trunk/libstage/model_blobfinder.cc code/stage/trunk/libstage/model_camera.cc code/stage/trunk/libstage/model_fiducial.cc code/stage/trunk/libstage/model_laser.cc code/stage/trunk/libstage/model_position.cc code/stage/trunk/libstage/model_ranger.cc code/stage/trunk/libstage/stage.hh code/stage/trunk/libstage/worldgui.cc Modified: code/stage/trunk/libstage/model_blinkenlight.cc =================================================================== --- code/stage/trunk/libstage/model_blinkenlight.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_blinkenlight.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -48,6 +48,10 @@ //#define DEBUG 1 #include "stage_internal.hh" +#include "option.hh" + +Option StgModelBlinkenlight::showBlinkenData( "Show Blink", "show_blinken", "", true ); + StgModelBlinkenlight::StgModelBlinkenlight( StgWorld* world, StgModel* parent ) @@ -74,6 +78,8 @@ this->on = true; this->Startup(); + + registerOption( &showBlinkenData ); } StgModelBlinkenlight::~StgModelBlinkenlight() @@ -99,11 +105,9 @@ } -void StgModelBlinkenlight::Draw( uint32_t flags, StgCanvas* canvas ) +void StgModelBlinkenlight::DataVisualize() { - StgModel::Draw( flags, canvas ); - - if( on ) + if( on && showBlinkenData ) { glPushMatrix(); // move into this model's local coordinate frame Modified: code/stage/trunk/libstage/model_blobfinder.cc =================================================================== --- code/stage/trunk/libstage/model_blobfinder.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_blobfinder.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -25,6 +25,8 @@ static const unsigned int DEFAULT_BLOBFINDERSCANWIDTH = 80; static const unsigned int DEFAULT_BLOBFINDERSCANHEIGHT = 60; +Option StgModelBlobfinder::showBlobData( "Show Blobfinder", "show_blob", "", true ); + /** @ingroup model @defgroup model_blobfinder Blobfinder model @@ -97,6 +99,8 @@ // leave the color filter array empty initally - this tracks all colors colors = g_array_new( false, true, sizeof(stg_color_t) ); + + registerOption( &showBlobData ); } @@ -298,6 +302,9 @@ void StgModelBlobfinder::DataVisualize( void ) { + if ( !showBlobData ) + return; + if( debug ) { // draw the FOV Modified: code/stage/trunk/libstage/model_camera.cc =================================================================== --- code/stage/trunk/libstage/model_camera.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_camera.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -16,7 +16,7 @@ #include <sstream> #include <iomanip> -Option StgModelCamera::ShowCamera( "Show Camera", "show_camera", "", true ); +Option StgModelCamera::showCameraData( "Show Camera Data", "show_camera", "", true ); //caclulate the corss product, and store results in the first vertex void cross( float& x1, float& y1, float& z1, float x2, float y2, float z2 ) @@ -70,7 +70,7 @@ //TODO can't draw this as it blocks the laser SetGeom( geom ); - RegisterOption( &ShowCamera ); + registerOption( &showCameraData ); Startup(); } @@ -181,7 +181,7 @@ //TODO create lines outlining camera frustrum, then iterate over each depth measurement and create a square void StgModelCamera::DataVisualize( void ) { - if( _frame_data == NULL || !ShowCamera ) + if( _frame_data == NULL || !showCameraData ) return; // TODO - shift to global CS? Modified: code/stage/trunk/libstage/model_fiducial.cc =================================================================== --- code/stage/trunk/libstage/model_fiducial.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_fiducial.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -23,6 +23,8 @@ const stg_radians_t DEFAULT_FIDUCIAL_FOV = M_PI; const stg_watts_t DEFAULT_FIDUCIAL_WATTS = 10.0; +Option StgModelFiducial::showFiducialData( "Show Fiducial", "show_fiducial", "", true ); + /** @ingroup model @defgroup model_fiducial Fiducial detector model @@ -85,6 +87,8 @@ key = 0; data = g_array_new( false, true, sizeof(stg_fiducial_t) ); + + registerOption( &showFiducialData ); } StgModelFiducial::~StgModelFiducial( void ) @@ -243,6 +247,9 @@ void StgModelFiducial::DataVisualize() { + if ( !showFiducialData ) + return; + // draw the FOV // GLUquadric* quadric = gluNewQuadric(); Modified: code/stage/trunk/libstage/model_laser.cc =================================================================== --- code/stage/trunk/libstage/model_laser.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_laser.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -33,7 +33,7 @@ //static const char COLOR[] = "steel blue"; //static const char FILL_COLOR[] = "powder blue"; -Option StgModelLaser::ShowLaserData( "Show Laser Data", "show_laser", "", true ); +Option StgModelLaser::showLaserData( "Show Laser Data", "show_laser", "", true ); /** @ingroup model @@ -106,7 +106,7 @@ data_dl = glGenLists(1); - RegisterOption( &ShowLaserData ); + registerOption( &showLaserData ); } @@ -302,7 +302,7 @@ void StgModelLaser::DataVisualize( void ) { - if ( !ShowLaserData ) + if ( !showLaserData ) return; if( ! (samples && sample_count) ) Modified: code/stage/trunk/libstage/model_position.cc =================================================================== --- code/stage/trunk/libstage/model_position.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_position.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -81,7 +81,6 @@ const stg_position_localization_mode_t POSITION_LOCALIZATION_DEFAULT = STG_POSITION_LOCALIZATION_GPS; const stg_position_drive_mode_t POSITION_DRIVE_DEFAULT = STG_POSITION_DRIVE_DIFFERENTIAL; - StgModelPosition::StgModelPosition( StgWorld* world, StgModel* parent ) : StgModel( world, parent, MODEL_TYPE_POSITION ) Modified: code/stage/trunk/libstage/model_ranger.cc =================================================================== --- code/stage/trunk/libstage/model_ranger.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/model_ranger.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -92,7 +92,9 @@ static const char RANGER_CONFIG_COLOR[] = "gray90"; static const char RANGER_GEOM_COLOR[] = "orange"; +Option StgModelRanger::showRangerData( "Show Ranger Data", "show_ranger", "", true ); + StgModelRanger::StgModelRanger( StgWorld* world, StgModel* parent ) : StgModel( world, parent, MODEL_TYPE_RANGER ) @@ -135,6 +137,8 @@ sensors[c].fov = (2.0*M_PI)/(sensor_count+1); sensors[c].ray_count = DEFAULT_RANGER_RAYCOUNT; } + + registerOption( &showRangerData ); } StgModelRanger::~StgModelRanger() @@ -310,6 +314,9 @@ void StgModelRanger::DataVisualize( void ) { + if ( !showRangerData ) + return; + if( ! (samples && sensors && sensor_count) ) return; Modified: code/stage/trunk/libstage/stage.hh =================================================================== --- code/stage/trunk/libstage/stage.hh 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/stage.hh 2008-07-02 21:41:39 UTC (rev 6742) @@ -1206,7 +1206,7 @@ int gui_mask; /// Register an Option for pickup by the GUI - void RegisterOption( Option* opt ) { drawOptions.push_back( opt ); } + void registerOption( Option* opt ) { drawOptions.push_back( opt ); } StgModel* parent; //< the model that owns this one, possibly NULL @@ -2094,6 +2094,7 @@ // predicate for ray tracing static bool BlockMatcher( StgBlock* testblock, StgModel* finder ); + static Option showBlobData; public: unsigned int scan_width; @@ -2207,8 +2208,7 @@ stg_radians_t fov; uint32_t resolution; - // Options - static Option ShowLaserData; + static Option showLaserData; public: static const char* typestr; @@ -2380,7 +2380,9 @@ virtual void DataVisualize(); GArray* data; - + + static Option showFiducialData; + public: static const char* typestr; // constructor @@ -2437,6 +2439,10 @@ uint32_t sensor_count; stg_ranger_sensor_t* sensors; stg_meters_t* samples; + + private: + static Option showRangerData; + }; // BLINKENLIGHT MODEL ---------------------------------------------------- @@ -2448,6 +2454,7 @@ double period; bool on; + static Option showBlinkenData; public: static const char* typestr; @@ -2458,7 +2465,7 @@ virtual void Load(); virtual void Update(); - virtual void Draw( uint32_t flags, StgCanvas* canvas ); + virtual void DataVisualize(); }; // CAMERA MODEL ---------------------------------------------------- @@ -2486,7 +2493,7 @@ GLfloat* _camera_quads; GLubyte* _camera_colors; - static Option ShowCamera; + static Option showCameraData; StgPerspectiveCamera _camera; int _yaw_offset; //position camera is mounted at @@ -2557,7 +2564,6 @@ stg_position_drive_mode_t drive_mode; stg_position_localization_mode_t localization_mode; ///< global or local mode stg_velocity_t integration_error; ///< errors to apply in simple odometry model - public: static const char* typestr; // constructor Modified: code/stage/trunk/libstage/worldgui.cc =================================================================== --- code/stage/trunk/libstage/worldgui.cc 2008-07-02 21:09:50 UTC (rev 6741) +++ code/stage/trunk/libstage/worldgui.cc 2008-07-02 21:41:39 UTC (rev 6742) @@ -422,9 +422,8 @@ oDlg->callback( optionsDlgCb, worldGui ); oDlg->setOptions( worldGui->drawOptions ); oDlg->showAllOpt( &worldGui->canvas->visualizeAll ); - oDlg->show(); - worldGui->oDlg = oDlg; + oDlg->show(); } else { worldGui->oDlg->show(); // bring it to front This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit