Revision: 8601 http://playerstage.svn.sourceforge.net/playerstage/?rev=8601&view=rev Author: rtv Date: 2010-03-25 01:06:42 +0000 (Thu, 25 Mar 2010)
Log Message: ----------- updated stageplugin to track model API changes Modified Paths: -------------- code/stage/trunk/libstageplugin/p_laser.cc code/stage/trunk/libstageplugin/p_sonar.cc code/stage/trunk/worlds/fasr.world Modified: code/stage/trunk/libstageplugin/p_laser.cc =================================================================== --- code/stage/trunk/libstageplugin/p_laser.cc 2010-03-24 04:05:49 UTC (rev 8600) +++ code/stage/trunk/libstageplugin/p_laser.cc 2010-03-25 01:06:42 UTC (rev 8601) @@ -53,16 +53,18 @@ void InterfaceLaser::Publish( void ) { ModelLaser* mod = (ModelLaser*)this->mod; - ModelLaser::Sample* samples = mod->GetSamples(NULL); - + + const std::vector<ModelLaser::Sample>& samples = mod->GetSamples(); + + uint32_t sample_count = samples.size(); // don't publish anything until we have some real data - if( samples == NULL ) + if( sample_count == 0 ) return; player_laser_data_t pdata; memset( &pdata, 0, sizeof(pdata) ); - - ModelLaser::Config cfg = mod->GetConfig(); + + ModelLaser::Config cfg = mod->GetConfig(); pdata.min_angle = -cfg.fov/2.0; pdata.max_angle = +cfg.fov/2.0; pdata.resolution = cfg.fov / cfg.sample_count; Modified: code/stage/trunk/libstageplugin/p_sonar.cc =================================================================== --- code/stage/trunk/libstageplugin/p_sonar.cc 2010-03-24 04:05:49 UTC (rev 8600) +++ code/stage/trunk/libstageplugin/p_sonar.cc 2010-03-25 01:06:42 UTC (rev 8601) @@ -60,17 +60,19 @@ player_sonar_data_t sonar; memset( &sonar, 0, sizeof(sonar) ); - size_t count = mod->sensors.size(); + const std::vector<Sensor>& sensors = mod->GetSensors(); + size_t count = sensors.size(); + if( count > 0 ) { //if( son->power_on ) // set with a sonar config { - sonar.ranges_count = count; - sonar.ranges = new float[count]; + sonar.ranges_count = count; + sonar.ranges = new float[count]; - for( unsigned int i=0; i<count; i++ ) - sonar.ranges[i] = mod->sensors[i].range; + for( unsigned int i=0; i<count; i++ ) + sonar.ranges[i] = sensors[i].range; } } @@ -94,8 +96,9 @@ this->addr) ) { ModelRanger* mod = (ModelRanger*)this->mod; - - size_t count = mod->sensors.size(); + + const std::vector<Sensor>& sensors = mod->GetSensors(); + size_t count = sensors.size(); // convert the ranger data into Player-format sonar poses player_sonar_geom_t pgeom; @@ -107,12 +110,12 @@ for( unsigned int i=0; i<count; i++ ) { // fill in the geometry data formatted player-like - pgeom.poses[i].px = mod->sensors[i].pose.x; - pgeom.poses[i].py = mod->sensors[i].pose.y; + pgeom.poses[i].px = sensors[i].pose.x; + pgeom.poses[i].py = sensors[i].pose.y; pgeom.poses[i].pz = 0; pgeom.poses[i].ppitch = 0; pgeom.poses[i].proll = 0; - pgeom.poses[i].pyaw = mod->sensors[i].pose.a; + pgeom.poses[i].pyaw = sensors[i].pose.a; } this->driver->Publish( this->addr, resp_queue, Modified: code/stage/trunk/worlds/fasr.world =================================================================== --- code/stage/trunk/worlds/fasr.world 2010-03-24 04:05:49 UTC (rev 8600) +++ code/stage/trunk/worlds/fasr.world 2010-03-25 01:06:42 UTC (rev 8601) @@ -16,7 +16,7 @@ resolution 0.02 -threads 2 +threads 8 # configure the GUI window window @@ -44,14 +44,16 @@ zone ( + size [ 2 2 0 ] color "green" pose [ -7.000 -7.000 0 0 ] name "source" - ctrl "source" + ctrl "source 100 1" ) zone ( + size [ 2 2 0 ] color "red" pose [ 7.000 7.000 0 0 ] name "sink" @@ -84,7 +86,7 @@ size [ 0.050 0.200 0.100 ] joules -1 # provides infinite energy give_watts 2000 - fiducial_return 2 # look for this in the fiducial sensor + fiducial_return 2 # look for this in the fiducial senso alwayson 1 # so we give charge without any explicit subscriber ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit