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

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

Index: wavefront.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/planner/wavefront/wavefront.cc,v
retrieving revision 1.60
retrieving revision 1.60.2.1
diff -C2 -d -r1.60 -r1.60.2.1
*** wavefront.cc        23 Aug 2007 19:58:46 -0000      1.60
--- wavefront.cc        19 Oct 2007 21:58:56 -0000      1.60.2.1
***************
*** 265,270 ****
      double position_x, position_y, position_a;
      // current list of waypoints
!     double waypoints[PLAYER_PLANNER_MAX_WAYPOINTS][2];
      int waypoint_count;
      // current localize pose
      double localize_x, localize_y, localize_a;
--- 265,271 ----
      double position_x, position_y, position_a;
      // current list of waypoints
!     double (*waypoints)[2];
      int waypoint_count;
+     int waypoints_allocated;
      // current localize pose
      double localize_x, localize_y, localize_a;
***************
*** 404,407 ****
--- 405,409 ----
  
    this->waypoint_count = 0;
+   this->waypoints_allocated = 0;
  
    if(SetupPosition() < 0)
***************
*** 817,826 ****
          }
        }
-       else if(this->plan->waypoint_count > PLAYER_PLANNER_MAX_WAYPOINTS)
-       {
-         PLAYER_WARN("Plan exceeds maximum number of waypoints!");
-         this->waypoint_count = PLAYER_PLANNER_MAX_WAYPOINTS;
-       }
        else
          this->waypoint_count = this->plan->waypoint_count;
  
--- 819,828 ----
          }
        }
        else
+         if (this->plan->waypoint_count > this->waypoints_allocated)
+         {
+           this->waypoints = (double (*)[2])realloc(this->waypoints, 
sizeof(this->waypoints[0])*this->plan->waypoint_count);
+           this->waypoints_allocated = this->plan->waypoint_count;
+         }
          this->waypoint_count = this->plan->waypoint_count;
  
***************
*** 1041,1046 ****
  
    // now, get the map data
!   player_map_data_t* data_req;
!   size_t reqlen;
    int i,j;
    int oi,oj;
--- 1043,1047 ----
  
    // now, get the map data
!   player_map_data_t data_req;
    int i,j;
    int oi,oj;
***************
*** 1048,1058 ****
    int si,sj;
  
!   reqlen = sizeof(player_map_data_t) - PLAYER_MAP_MAX_TILE_SIZE;
!   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->plan->size_x) && (oj < this->plan->size_y))
--- 1049,1054 ----
    int si,sj;
  
!   // Grab 640x640 tiles
!   sy = sx = 640;
    oi=oj=0;
    while((oi < this->plan->size_x) && (oj < this->plan->size_y))
***************
*** 1061,1068 ****
      sj = MIN(sy, this->plan->size_y - oj);
  
!     data_req->col = oi;
!     data_req->row = oj;
!     data_req->width = si;
!     data_req->height = sj;
  
      Message* msg;
--- 1057,1064 ----
      sj = MIN(sy, this->plan->size_y - oj);
  
!     data_req.col = oi;
!     data_req.row = oj;
!     data_req.width = si;
!     data_req.height = sj;
  
      Message* msg;
***************
*** 1070,1078 ****
                                          PLAYER_MSGTYPE_REQ,
                                          PLAYER_MAP_REQ_GET_DATA,
!                                         (void*)data_req,reqlen,NULL,
                                          threaded)))
      {
        PLAYER_ERROR("failed to get map data");
-       free(data_req);
        free(this->plan->cells);
        return(-1);
--- 1066,1073 ----
                                          PLAYER_MSGTYPE_REQ,
                                          PLAYER_MAP_REQ_GET_DATA,
!                                         (void*)&data_req,0,NULL,
                                          threaded)))
      {
        PLAYER_ERROR("failed to get map data");
        free(this->plan->cells);
        return(-1);
***************
*** 1103,1107 ****
      }
    }
-   free(data_req);
    return(0);
  }
--- 1098,1101 ----
***************
*** 1245,1255 ****
      player_planner_waypoints_req_t reply;
  
!     if(this->waypoint_count > PLAYER_PLANNER_MAX_WAYPOINTS)
!     {
!       PLAYER_WARN("too many waypoints; truncating list");
!       reply.waypoints_count = 0;
!     }
!     else
!       reply.waypoints_count = this->waypoint_count;
      for(int i=0;i<(int)reply.waypoints_count;i++)
      {
--- 1239,1244 ----
      player_planner_waypoints_req_t reply;
  
!     reply.waypoints_count = this->waypoint_count;
!     reply.waypoints = 
(player_pose2d_t*)calloc(sizeof(reply.waypoints[0]),this->waypoint_count);
      for(int i=0;i<(int)reply.waypoints_count;i++)
      {
***************
*** 1263,1266 ****
--- 1252,1256 ----
                    PLAYER_PLANNER_REQ_GET_WAYPOINTS,
                    (void*)&reply, sizeof(reply), NULL);
+     free(reply.waypoints);
      return(0);
    }

Index: .cvsignore
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/planner/wavefront/.cvsignore,v
retrieving revision 1.1.16.1
retrieving revision 1.1.16.2
diff -C2 -d -r1.1.16.1 -r1.1.16.2
*** .cvsignore  10 Oct 2007 09:26:06 -0000      1.1.16.1
--- .cvsignore  19 Oct 2007 21:58:56 -0000      1.1.16.2
***************
*** 4,5 ****
--- 4,7 ----
  *.la
  *.a
+ .libs
+ *.lo


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