Revision: 9138 http://sourceforge.net/p/playerstage/svn/9138 Author: jpgr87 Date: 2014-02-18 00:28:27 +0000 (Tue, 18 Feb 2014) Log Message: ----------- Applied patch #347: Bug in laserrescan driver
Modified Paths: -------------- code/player/trunk/server/drivers/laser/laserrescan.cc Modified: code/player/trunk/server/drivers/laser/laserrescan.cc =================================================================== --- code/player/trunk/server/drivers/laser/laserrescan.cc 2014-02-16 17:38:42 UTC (rev 9137) +++ code/player/trunk/server/drivers/laser/laserrescan.cc 2014-02-18 00:28:27 UTC (rev 9138) @@ -111,6 +111,7 @@ double min_angle, max_angle, res; int scan_count; + bool angle_warn; }; @@ -138,6 +139,7 @@ this->min_angle = cf->ReadAngle(section, "min_angle", -M_PI/2.0); this->scan_count = cf->ReadInt(section, "scan_count", 181); res = (max_angle - min_angle) / scan_count; + angle_warn = false; return; } @@ -158,6 +160,11 @@ this->data.ranges = new float[scan_count]; this->data.max_range = data->max_range; + if ( (data->min_angle > min_angle || data->max_angle < max_angle) && angle_warn == false) { + angle_warn = true; + PLAYER_WARN("Parts of the interpolated laser configuration lie outside of the source laser range"); + } + double real_min = data->min_angle; double real_res = data->resolution; @@ -166,8 +173,8 @@ double theta = min_angle + i*res; double new_i = (theta - real_min)/real_res; - unsigned int j = (int) floor(new_i); - unsigned int k = (int) ceil(new_i); + unsigned int j = (int) floor(new_i) < 0 ? 0 : (int) floor(new_i); + unsigned int k = (int) ceil(new_i) < 0 ? 0 : (int) ceil(new_i); if (j < 0) j = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit