[fawkes] Converted to new hokuyoaist 3.0 api

rmattes rmattes at fedoraproject.org
Tue Aug 14 22:56:56 UTC 2012


commit 6c410ecd20aec8127db8deb778db0e563a1ce7c5
Author: Rich Mattes <richmattes at gmail.com>
Date:   Tue Aug 14 18:56:03 2012 -0400

    Converted to new hokuyoaist 3.0 api

 fawkes-0.4.2-gbx10.patch |   92 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 82 insertions(+), 10 deletions(-)
---
diff --git a/fawkes-0.4.2-gbx10.patch b/fawkes-0.4.2-gbx10.patch
index f1a9efc..ad61a39 100644
--- a/fawkes-0.4.2-gbx10.patch
+++ b/fawkes-0.4.2-gbx10.patch
@@ -1,6 +1,6 @@
 diff -up ./fawkes-0.4.2/src/plugins/laser/laser.mk.gbx10 ./fawkes-0.4.2/src/plugins/laser/laser.mk
 --- ./fawkes-0.4.2/src/plugins/laser/laser.mk.gbx10	2011-02-19 17:24:55.000000000 -0500
-+++ ./fawkes-0.4.2/src/plugins/laser/laser.mk	2012-08-13 23:05:16.653699334 -0400
++++ ./fawkes-0.4.2/src/plugins/laser/laser.mk	2012-08-14 18:14:03.073693207 -0400
 @@ -31,9 +31,9 @@ else
  endif
  
@@ -15,8 +15,8 @@ diff -up ./fawkes-0.4.2/src/plugins/laser/laser.mk.gbx10 ./fawkes-0.4.2/src/plug
  endif
  
 diff -up ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp.gbx10 ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp
---- ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp.gbx10	2012-08-13 23:06:44.461874363 -0400
-+++ ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp	2012-08-14 00:11:15.169214526 -0400
+--- ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp.gbx10	2011-02-19 17:24:55.000000000 -0500
++++ ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp	2012-08-14 18:45:23.118618822 -0400
 @@ -24,7 +24,7 @@
  
  #include <core/threading/mutex.h>
@@ -35,26 +35,98 @@ diff -up ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.cpp.gbx10 ./fawkes-0.4.2/s
  using namespace fawkes;
  
  
+@@ -78,23 +78,23 @@ HokuyoUrgGbxAcquisitionThread::init()
+ 
+   __cfg_device = config->get_string((__cfg_prefix + "device").c_str());
+ 
+-  __laser = new HokuyoLaser();
+-  std::auto_ptr<HokuyoLaser> laser(__laser);
++  __laser = new Sensor();
++  std::auto_ptr<Sensor> laser(__laser);
+   std::string port_options = "type=serial,device=" + __cfg_device + ",timeout=1";
+   try {
+-    __laser->Open(port_options);
++    __laser->open(port_options);
+   } catch (flexiport::PortException &e) {
+     throw Exception("Connecting to URG laser failed: %s", e.what());
+   }
+ 
+-  HokuyoSensorInfo info;
+-  __laser->GetSensorInfo(&info);
+-  __data = new HokuyoData();
++  SensorInfo info;
++  __laser->get_sensor_info(info);
++  __data = new ScanData();
+ 
+-  __first_ray      = info.firstStep;
+-  __last_ray       = info.lastStep;
++  __first_ray      = info.first_step;
++  __last_ray       = info.last_step;
+   __num_rays       = __last_ray - __first_ray;
+-  __front_ray      = info.frontStep;
++  __front_ray      = info.front_step;
+   __front_idx      = __front_ray - __first_ray;
+   __slit_division  = info.steps;
+ 
+@@ -116,7 +116,7 @@ HokuyoUrgGbxAcquisitionThread::init()
+   logger->log_info(name(), "Angular Range: %f deg", __angular_range);
+ 
+   alloc_distances(__number_of_values);
+-  __laser->SetPower(true);
++  __laser->set_power(true);
+ 
+   laser.release();
+ }
+@@ -129,7 +129,7 @@ HokuyoUrgGbxAcquisitionThread::finalize(
+   _distances = NULL;
+ 
+   logger->log_debug(name(), "Stopping laser");
+-  __laser->SetPower(false);
++  __laser->set_power(false);
+   delete __laser;
+   delete __data;
+ }
+@@ -153,13 +153,13 @@ HokuyoUrgGbxAcquisitionThread::loop()
+ 
+   try {
+     // GetNewRanges is causes scans/sec to be halfed
+-    __laser->GetRanges(__data);
+-  } catch (HokuyoError &he) {
++    __laser->get_ranges(*__data);
++  } catch (BaseError &he) {
+     logger->log_warn(name(), "Failed to read data: %s", he.what());
+     return;
+   }
+ 
+-  const uint32_t *ranges = __data->Ranges();
++  const uint32_t *ranges = __data->ranges();
+ 
+   _data_mutex->lock();
+ 
 diff -up ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h.gbx10 ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h
---- ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h.gbx10	2012-08-14 17:56:00.408847528 -0400
-+++ ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h	2012-08-14 17:56:19.147548414 -0400
-@@ -28,7 +28,7 @@
+--- ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h.gbx10	2011-02-19 17:24:55.000000000 -0500
++++ ./fawkes-0.4.2/src/plugins/laser/urg_gbx_aqt.h	2012-08-14 18:31:58.145714272 -0400
+@@ -28,9 +28,9 @@
  #include <string>
  #include <map>
  
 -namespace hokuyo_aist {
+-  class HokuyoLaser;
+-  class HokuyoData;
 +namespace hokuyoaist {
-   class HokuyoLaser;
-   class HokuyoData;
++  class Sensor;
++  class ScanData;
  }
+ 
+ class HokuyoUrgGbxAcquisitionThread : public LaserAcquisitionThread
 @@ -48,8 +48,8 @@ class HokuyoUrgGbxAcquisitionThread : pu
   private:
    bool __pre_init_done;
    unsigned int __number_of_values;
 -  hokuyo_aist::HokuyoLaser *__laser;
 -  hokuyo_aist::HokuyoData  *__data;
-+  hokuyoaist::HokuyoLaser *__laser;
-+  hokuyoaist::HokuyoData  *__data;
++  hokuyoaist::Sensor *__laser;
++  hokuyoaist::ScanData  *__data;
  
    std::string  __cfg_name;
    std::string  __cfg_prefix;


More information about the scm-commits mailing list