Revision: 6356
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6356&view=rev
Author:   gbiggs
Date:     2008-04-18 00:32:41 -0700 (Fri, 18 Apr 2008)

Log Message:
-----------
Merging changes 4437:4451 from trunk

Modified Paths:
--------------
    code/player/branches/cmake/libplayercore/driver.cc
    code/player/branches/cmake/libplayercore/message.cc
    code/player/branches/cmake/server/drivers/laser/lasercutter.cc
    code/player/branches/cmake/server/drivers/laser/sicks3000.cc

Modified: code/player/branches/cmake/libplayercore/driver.cc
===================================================================
--- code/player/branches/cmake/libplayercore/driver.cc  2008-04-18 07:28:02 UTC 
(rev 6355)
+++ code/player/branches/cmake/libplayercore/driver.cc  2008-04-18 07:32:41 UTC 
(rev 6356)
@@ -151,7 +151,6 @@
 {
   Device* dev;
 
-  Message msg(*hdr,src,copy);
   // lock here, because we're accessing our device's queue list
   this->Lock();
   // push onto each queue subscribed to the given device
@@ -165,6 +164,7 @@
     this->Unlock();
     return;
   }
+  Message msg(*hdr,src,copy);
   for(size_t i=0;i<dev->len_queues;i++)
   {
     if(dev->queues[i] != NULL)

Modified: code/player/branches/cmake/libplayercore/message.cc
===================================================================
--- code/player/branches/cmake/libplayercore/message.cc 2008-04-18 07:28:02 UTC 
(rev 6355)
+++ code/player/branches/cmake/libplayercore/message.cc 2008-04-18 07:32:41 UTC 
(rev 6356)
@@ -129,7 +129,7 @@
     }
     else
     {
-      PLAYER_ERROR3 ("failed to clone message %s: %s, %d", interf_to_str 
(Header.addr.interf), msgtype_to_str (Header.type), Header.subtype);
+      PLAYER_ERROR3 ("failed to find clone function for  message %s: %s, %d", 
interf_to_str (Header.addr.interf), msgtype_to_str (Header.type), 
Header.subtype);
     }
   }
   else

Modified: code/player/branches/cmake/server/drivers/laser/lasercutter.cc
===================================================================
--- code/player/branches/cmake/server/drivers/laser/lasercutter.cc      
2008-04-18 07:28:02 UTC (rev 6355)
+++ code/player/branches/cmake/server/drivers/laser/lasercutter.cc      
2008-04-18 07:32:41 UTC (rev 6356)
@@ -138,8 +138,9 @@
   // Settings.
   allocated_ranges = 0;
   data.ranges = NULL;
-  this->max_angle = cf->ReadAngle(section, "max_angle", M_PI/2.0);
-  this->min_angle = cf->ReadAngle(section, "min_angle", -M_PI/2.0);
+  data.intensity = NULL;
+  this->max_angle = cf->ReadAngle(section, "max_angle", M_PI_2);
+  this->min_angle = cf->ReadAngle(section, "min_angle", -M_PI_2);
 
   return;
 }
@@ -147,55 +148,60 @@
 LaserCutter::~LaserCutter()
 {
   free(data.ranges);
+  free(data.intensity);
 }
 
 
 
////////////////////////////////////////////////////////////////////////////////
 // Process laser data.
-int LaserCutter::UpdateLaser(player_laser_data_t * data)
+int LaserCutter::UpdateLaser(player_laser_data_t * indata)
 {
   unsigned int i;
   double current_angle;
 
   // Construct the outgoing laser packet
-  this->data.resolution   = data->resolution;
+  this->data.resolution   = indata->resolution;
   this->data.min_angle    = (min_angle);
   this->data.max_angle    = (max_angle);
-  this->data.max_range    = data->max_range;
-  this->data.id           = data->id;
+  this->data.max_range    = indata->max_range;
+  this->data.id           = indata->id;
 
   this->data.ranges_count    = 0;
   this->data.intensity_count = 0;
 
-  current_angle = data->min_angle;
-  if (data->ranges_count+1 > allocated_ranges)
-    data->ranges = 
(float*)realloc(data->ranges,sizeof(data->ranges[0])*(data->ranges_count+1));
-  for (i = 0; i < data->ranges_count; i++)
+  current_angle = indata->min_angle;
+  if (indata->ranges_count+1 > allocated_ranges)
   {
-    current_angle += data->resolution;
-
+    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));
+  }
+  for (i = 0; i < indata->ranges_count; i++)
+  {
     if ((current_angle >= min_angle) && (current_angle <= max_angle))
     {
-      this->data.ranges[this->data.ranges_count] = data->ranges[i];
+      this->data.ranges[this->data.ranges_count] = indata->ranges[i];
       this->data.ranges_count++;
     }
+    current_angle += indata->resolution;
   }
 
-  current_angle = data->min_angle;
-  for (i = 0; i < data->intensity_count; i++)
+  current_angle = indata->min_angle;
+  if (indata->intensity_count+1 > allocated_ranges)
   {
-    current_angle += data->resolution;
-
+    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] = data->intensity[i];
+      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, sizeof(this->data), NULL);
+  this->Publish(this->device_addr, PLAYER_MSGTYPE_DATA, 
PLAYER_LASER_DATA_SCAN, &this->data);
 
   return 1;
 }

Modified: code/player/branches/cmake/server/drivers/laser/sicks3000.cc
===================================================================
--- code/player/branches/cmake/server/drivers/laser/sicks3000.cc        
2008-04-18 07:28:02 UTC (rev 6355)
+++ code/player/branches/cmake/server/drivers/laser/sicks3000.cc        
2008-04-18 07:32:41 UTC (rev 6356)
@@ -112,7 +112,8 @@
 //#include <replace/replace.h>
 extern PlayerTime* GlobalTime;
 
-#define DEFAULT_RX_BUFFER_SIZE 4096
+// 1 second of data at 500kbaud
+#define DEFAULT_RX_BUFFER_SIZE 500*1024/8
 
 // The laser device class.
 class SickS3000 : public Driver


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

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to