Revision: 4458
          http://playerstage.svn.sourceforge.net/playerstage/?rev=4458&view=rev
Author:   thjc
Date:     2008-03-28 17:50:49 -0700 (Fri, 28 Mar 2008)

Log Message:
-----------
updated version to rc2-svn so it is distinguishable from the released rc1
fixed lasercutter driver again

Modified Paths:
--------------
    code/player/trunk/configure.ac
    code/player/trunk/server/drivers/laser/lasercutter.cc

Modified: code/player/trunk/configure.ac
===================================================================
--- code/player/trunk/configure.ac      2008-03-28 20:38:22 UTC (rev 4457)
+++ code/player/trunk/configure.ac      2008-03-29 00:50:49 UTC (rev 4458)
@@ -2,7 +2,7 @@
 
 dnl Initialize autoconf with name and version of package to be built.
 dnl PACKAGE and VERSION will be so defined in <config.h>.
-AC_INIT(player,2.1.0rc1)
+AC_INIT(player,2.1.0rc2-svn)
 
 dnl Player version information.  In an ideal world, we would just declare
 dnl the following 3 values, then reuse them throughout.  Unfortunately,

Modified: code/player/trunk/server/drivers/laser/lasercutter.cc
===================================================================
--- code/player/trunk/server/drivers/laser/lasercutter.cc       2008-03-28 
20:38:22 UTC (rev 4457)
+++ code/player/trunk/server/drivers/laser/lasercutter.cc       2008-03-29 
00:50:49 UTC (rev 4458)
@@ -161,46 +161,39 @@
   
   // Construct the outgoing laser packet
   this->data.resolution   = indata->resolution;
-  this->data.min_angle    = (min_angle);
-  this->data.max_angle    = (max_angle);
+  this->data.min_angle    = min_angle;
+  this->data.max_angle    = max_angle;
   this->data.max_range    = indata->max_range;
   this->data.id           = indata->id;
 
   this->data.ranges_count    = 0;
   this->data.intensity_count = 0;
   
-  current_angle = indata->min_angle;
-  if (indata->ranges_count+1 > allocated_ranges)
+  // check we have space for the scans
+  if (indata->ranges_count+1 > allocated_ranges || indata->intensity_count+1 > 
allocated_ranges)
   {
-    data.ranges = 
(float*)realloc(data.ranges,sizeof(data.ranges[0])*(indata->ranges_count+1));
-    data.intensity = 
(uint8_t*)realloc(data.intensity,sizeof(data.intensity[0])*(indata->ranges_count+1));
+    allocated_ranges = (indata->ranges_count+1) > (indata->intensity_count+1) 
? indata->ranges_count+1 : indata->intensity_count+1;
+    data.ranges = 
(float*)realloc(data.ranges,sizeof(data.ranges[0])*(allocated_ranges));
+    data.intensity = 
(uint8_t*)realloc(data.intensity,sizeof(data.intensity[0])*(allocated_ranges));
   }
-  for (i = 0; i < indata->ranges_count; i++)
+
+  
+  current_angle = indata->min_angle;
+  for (i = 0; i < indata->ranges_count && current_angle <= max_angle; i++)
   {
-    if ((current_angle >= min_angle) && (current_angle <= max_angle))
+    if (current_angle >= min_angle)
     {
       this->data.ranges[this->data.ranges_count] = indata->ranges[i];
       this->data.ranges_count++;
+      if (i < indata->intensity_count)
+      {
+        this->data.intensity[this->data.intensity_count] = 
indata->intensity[i];
+        this->data.intensity_count++;
+      }
     }
     current_angle += indata->resolution;
   }
 
-  current_angle = indata->min_angle;
-  if (indata->intensity_count+1 > allocated_ranges)
-  {
-    data.ranges = 
(float*)realloc(data.ranges,sizeof(data.ranges[0])*(indata->intensity_count+1));
-    data.intensity = 
(uint8_t*)realloc(data.intensity,sizeof(data.intensity[0])*(indata->intensity_count+1));
-  }
-  for (i = 0; i < indata->intensity_count; i++)
-  {
-    if ((current_angle >= min_angle) && (current_angle <= max_angle))
-    {
-      this->data.intensity[this->data.intensity_count] = indata->intensity[i];
-      this->data.intensity_count++;
-    }
-    current_angle += indata->resolution;
-  }
-
   this->Publish(this->device_addr, PLAYER_MSGTYPE_DATA, 
PLAYER_LASER_DATA_SCAN, &this->data);
 
   return 1;


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

-------------------------------------------------------------------------
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