Update of /cvsroot/playerstage/code/player/server/drivers/localization/amcl
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11860/server/drivers/localization/amcl

Modified Files:
      Tag: b_thjc_dynamic_arrays
        amcl.cc amcl.h amcl_laser.cc .cvsignore amcl_laser.h 
Log Message:
dynamic array changes to drivers compile, still needs testing
added lots more .cvsignore settings for eclipse

Index: amcl_laser.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/amcl/amcl_laser.cc,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -C2 -d -r1.25 -r1.25.2.1
*** amcl_laser.cc       23 Aug 2007 19:58:44 -0000      1.25
--- amcl_laser.cc       19 Oct 2007 21:58:57 -0000      1.25.2.1
***************
*** 185,191 ****
  
    // allocate space for map cells
!   assert(this->map->cells = (map_cell_t*)malloc(sizeof(map_cell_t) *
!                                                 this->map->size_x *
!                                                 this->map->size_y));
  
    // now, get the map data
--- 185,192 ----
  
    // allocate space for map cells
!   this->map->cells = (map_cell_t*)malloc(sizeof(map_cell_t) *
!                                                   this->map->size_x *
!                                                   this->map->size_y);
!   assert(this->map->cells);
  
    // now, get the map data
***************
*** 197,207 ****
    int si,sj;
  
!   reqlen = sizeof(player_map_data_t) - PLAYER_MAP_MAX_TILE_SIZE + 4;
!   data_req = (player_map_data_t*)calloc(1, reqlen);
    assert(data_req);
  
!   // Tile size
!   sy = sx = (int)sqrt(PLAYER_MAP_MAX_TILE_SIZE);
!   assert(sx * sy < (int)PLAYER_MAP_MAX_TILE_SIZE);
    oi=oj=0;
    while((oi < this->map->size_x) && (oj < this->map->size_y))
--- 198,206 ----
    int si,sj;
  
!   data_req = (player_map_data_t*) malloc(sizeof(player_map_data_t));
    assert(data_req);
  
!   // Tile size, limit to sensible maximum of 640x640 tiles
!   sy = sx = 640;
    oi=oj=0;
    while((oi < this->map->size_x) && (oj < this->map->size_y))
***************
*** 303,307 ****
    ndata->range_count = data->ranges_count;
    ndata->range_max = data->max_range;
!   assert((size_t) ndata->range_count < sizeof(ndata->ranges) / 
sizeof(ndata->ranges[0]));
  
    // Read the range data
--- 302,306 ----
    ndata->range_count = data->ranges_count;
    ndata->range_max = data->max_range;
!   ndata->ranges = new double [ndata->range_count][2];
  
    // Read the range data

Index: .cvsignore
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/amcl/.cvsignore,v
retrieving revision 1.2.18.1
retrieving revision 1.2.18.2
diff -C2 -d -r1.2.18.1 -r1.2.18.2
*** .cvsignore  10 Oct 2007 09:26:05 -0000      1.2.18.1
--- .cvsignore  19 Oct 2007 21:58:57 -0000      1.2.18.2
***************
*** 3,4 ****
--- 3,6 ----
  .deps
  *.la
+ .libs
+ *.lo

Index: amcl.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/amcl/amcl.cc,v
retrieving revision 1.78.2.2
retrieving revision 1.78.2.3
diff -C2 -d -r1.78.2.2 -r1.78.2.3
*** amcl.cc     14 Oct 2007 04:41:47 -0000      1.78.2.2
--- amcl.cc     19 Oct 2007 21:58:57 -0000      1.78.2.3
***************
*** 463,466 ****
--- 463,468 ----
    // Initial hypothesis list
    this->hyp_count = 0;
+   this->hyp_alloc = 0;
+   this->hyps = NULL;
    pthread_mutex_init(&this->best_hyp_lock,NULL);
  
***************
*** 483,486 ****
--- 485,489 ----
    // Delete sensor data queue
    delete[] this->q_data;
+   free(hyps);
  
    // Delete sensors
***************
*** 925,928 ****
--- 928,936 ----
        //pf_vector_fprintf(pose_mean, stdout, "%.3f");
  
+       if (this->hyp_count +1 > this->hyp_alloc)
+       {
+         this->hyp_alloc = this->hyp_count+1;
+         this->hyps = (amcl_hyp_t*)realloc(this->hyps, 
sizeof(amcl_hyp_t)*this->hyp_alloc);
+       }
        hyp = this->hyps + this->hyp_count++;
        hyp->weight = weight;
***************
*** 1005,1009 ****
    pf_vector_t pose;
    pf_matrix_t pose_cov;
!   size_t datalen;
    player_localize_data_t data;
  
--- 1013,1017 ----
    pf_vector_t pose;
    pf_matrix_t pose_cov;
!   //size_t datalen;
    player_localize_data_t data;
  
***************
*** 1163,1167 ****
                    PLAYER_LOCALIZE_REQ_GET_PARTICLES,
                    (void*)&resp);
!     delete [] resp->particles;
      return(0);
    } else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
--- 1171,1175 ----
                    PLAYER_LOCALIZE_REQ_GET_PARTICLES,
                    (void*)&resp);
!     delete [] resp.particles;
      return(0);
    } else if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,

Index: amcl_laser.h
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/amcl/amcl_laser.h,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** amcl_laser.h        23 Aug 2007 19:58:44 -0000      1.12
--- amcl_laser.h        19 Oct 2007 21:58:57 -0000      1.12.2.1
***************
*** 37,44 ****
  class AMCLLaserData : public AMCLSensorData
  {
    // Laser range data (range, bearing tuples)
    public: int range_count;
    public: double range_max;
!   public: double ranges[PLAYER_LASER_MAX_SAMPLES][2];
  };
  
--- 37,47 ----
  class AMCLLaserData : public AMCLSensorData
  {
+   public:
+     AMCLLaserData () {ranges=NULL;};
+     ~AMCLLaserData() {delete [] ranges;};
    // Laser range data (range, bearing tuples)
    public: int range_count;
    public: double range_max;
!   public: double (*ranges)[2];
  };
  

Index: amcl.h
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/amcl/amcl.h,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -d -r1.17 -r1.17.2.1
*** amcl.h      23 Aug 2007 19:58:44 -0000      1.17
--- amcl.h      19 Oct 2007 21:58:57 -0000      1.17.2.1
***************
*** 174,178 ****
    // Current particle filter pose estimates
    private: int hyp_count;
!   private: amcl_hyp_t hyps[PLAYER_LOCALIZE_MAX_HYPOTHS];
    private: pf_vector_t best_hyp;
    private: pthread_mutex_t best_hyp_lock;
--- 174,179 ----
    // Current particle filter pose estimates
    private: int hyp_count;
!   private: int hyp_alloc;
!   private: amcl_hyp_t *hyps;
    private: pf_vector_t best_hyp;
    private: pthread_mutex_t best_hyp_lock;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to