Update of /cvsroot/playerstage/code/stage/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15825/src
Modified Files:
Tag: b_thjc_dynamic_arrays
p_blobfinder.cc p_bumper.cc p_fiducial.cc p_graphics2d.cc
p_laser.cc p_map.cc p_sonar.cc
Log Message:
changes to use dynamic arrays
Index: p_bumper.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_bumper.cc,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** p_bumper.cc 23 Aug 2007 19:58:49 -0000 1.3
--- p_bumper.cc 12 Sep 2007 09:51:28 -0000 1.3.2.1
***************
*** 66,78 ****
{
size_t bcount = len / sizeof(stg_bumper_sample_t);
-
- // limit the number of samples to Player's maximum
- if( bcount > PLAYER_BUMPER_MAX_SAMPLES )
- bcount = PLAYER_BUMPER_MAX_SAMPLES;
-
pdata.bumpers_count = bcount;
for( int i=0; i<(int)bcount; i++ )
! pdata.bumpers[i] = sdata[i].hit ? 1 : 0;
}
--- 66,74 ----
{
size_t bcount = len / sizeof(stg_bumper_sample_t);
pdata.bumpers_count = bcount;
+ pdata.bumpers = new uint8_t[bcount];
for( int i=0; i<(int)bcount; i++ )
! pdata.bumpers[i] = sdata[i].hit ? 1 : 0;
}
***************
*** 81,84 ****
--- 77,81 ----
PLAYER_BUMPER_DATA_STATE,
&pdata, sizeof(pdata), NULL);
+ delete [] pdata.bumpers;
}
***************
*** 89,93 ****
{
if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
! PLAYER_BUMPER_GET_GEOM,
this->addr) )
{
--- 86,90 ----
{
if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
! PLAYER_BUMPER_REQ_GET_GEOM,
this->addr) )
{
***************
*** 103,110 ****
// limit the number of samples to Player's maximum
- if( bcount > PLAYER_BUMPER_MAX_SAMPLES )
- bcount = PLAYER_BUMPER_MAX_SAMPLES;
-
pgeom.bumper_def_count = bcount;
for( int i=0; i<(int)bcount; i++ )
--- 100,105 ----
// limit the number of samples to Player's maximum
pgeom.bumper_def_count = bcount;
+ pgeom.bumper_def = new player_bumper_define_t[bcount];
for( int i=0; i<(int)bcount; i++ )
***************
*** 120,126 ****
this->driver->Publish( this->addr, resp_queue,
PLAYER_MSGTYPE_RESP_ACK,
! PLAYER_BUMPER_GET_GEOM,
(void*)&pgeom, sizeof(pgeom), NULL );
!
return 0; // ok
}
--- 115,121 ----
this->driver->Publish( this->addr, resp_queue,
PLAYER_MSGTYPE_RESP_ACK,
! PLAYER_BUMPER_REQ_GET_GEOM,
(void*)&pgeom, sizeof(pgeom), NULL );
! delete [] pgeom.bumper_def;
return 0; // ok
}
Index: p_sonar.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_sonar.cc,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** p_sonar.cc 23 Aug 2007 19:58:49 -0000 1.10
--- p_sonar.cc 12 Sep 2007 09:51:28 -0000 1.10.2.1
***************
*** 69,79 ****
size_t rcount = len / sizeof(stg_ranger_sample_t);
- // limit the number of samples to Player's maximum
- if( rcount > PLAYER_SONAR_MAX_SAMPLES )
- rcount = PLAYER_SONAR_MAX_SAMPLES;
-
//if( son->power_on ) // set with a sonar config
{
sonar.ranges_count = rcount;
for( int i=0; i<(int)rcount; i++ )
--- 69,76 ----
size_t rcount = len / sizeof(stg_ranger_sample_t);
//if( son->power_on ) // set with a sonar config
{
sonar.ranges_count = rcount;
+ sonar.ranges = new float[rcount];
for( int i=0; i<(int)rcount; i++ )
***************
*** 86,89 ****
--- 83,87 ----
PLAYER_SONAR_DATA_RANGES,
&sonar, sizeof(sonar), NULL);
+ delete [] sonar.ranges;
}
***************
*** 107,115 ****
memset( &pgeom, 0, sizeof(pgeom) );
- // limit the number of samples to Player's maximum
- if( rcount > PLAYER_SONAR_MAX_SAMPLES )
- rcount = PLAYER_SONAR_MAX_SAMPLES;
-
pgeom.poses_count = rcount;
for( int i=0; i<(int)rcount; i++ )
--- 105,110 ----
memset( &pgeom, 0, sizeof(pgeom) );
pgeom.poses_count = rcount;
+ pgeom.poses = new player_pose3d_t[rcount];
for( int i=0; i<(int)rcount; i++ )
***************
*** 125,129 ****
PLAYER_SONAR_REQ_GET_GEOM,
(void*)&pgeom, sizeof(pgeom), NULL );
!
return 0; // ok
}
--- 120,124 ----
PLAYER_SONAR_REQ_GET_GEOM,
(void*)&pgeom, sizeof(pgeom), NULL );
! delete [] pgeom.poses;
return 0; // ok
}
Index: p_blobfinder.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_blobfinder.cc,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** p_blobfinder.cc 23 Aug 2007 19:58:49 -0000 1.10
--- p_blobfinder.cc 12 Sep 2007 09:51:28 -0000 1.10.2.1
***************
*** 61,66 ****
// limit the number of samples to Player's maximum
- if( bcount > PLAYER_BLOBFINDER_MAX_BLOBS )
- bcount = PLAYER_BLOBFINDER_MAX_BLOBS;
player_blobfinder_data_t bfd;
--- 61,64 ----
***************
*** 75,78 ****
--- 73,77 ----
bfd.height = cfg->scan_height;
bfd.blobs_count = bcount;
+ bfd.blobs = new player_blobfinder_blob_t[bcount];
// now run through the blobs, packing them into the player buffer
***************
*** 119,122 ****
--- 118,122 ----
PLAYER_BLOBFINDER_DATA_BLOBS,
&bfd, sizeof(bfd), NULL);
+ delete [] bfd.blobs;
}
Index: p_laser.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_laser.cc,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -d -r1.20 -r1.20.2.1
*** p_laser.cc 23 Aug 2007 19:58:49 -0000 1.20
--- p_laser.cc 12 Sep 2007 09:51:28 -0000 1.20.2.1
***************
*** 80,84 ****
pdata.ranges_count = pdata.intensity_count = cfg->samples;
pdata.id = this->scan_id++;
!
for( int i=0; i<cfg->samples; i++ )
{
--- 80,85 ----
pdata.ranges_count = pdata.intensity_count = cfg->samples;
pdata.id = this->scan_id++;
! pdata.ranges = new float[pdata.ranges_count];
! pdata.intensity = new uint8_t[pdata.intensity_count];
for( int i=0; i<cfg->samples; i++ )
{
***************
*** 94,97 ****
--- 95,100 ----
PLAYER_LASER_DATA_SCAN,
(void*)&pdata, sizeof(pdata), NULL);
+ delete [] pdata.ranges;
+ delete [] pdata.intensity;
}
}
Index: p_map.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_map.cc,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -d -r1.13 -r1.13.2.1
*** p_map.cc 23 Aug 2007 19:58:49 -0000 1.13
--- p_map.cc 12 Sep 2007 09:51:28 -0000 1.13.2.1
***************
*** 172,176 ****
// initiall all cells are 'empty'
! memset( mapresp->data, -1, sizeof(uint8_t) * PLAYER_MAP_MAX_TILE_SIZE );
printf( "Stage computing map tile (%d,%d)(%d,%d)...",
--- 172,178 ----
// initiall all cells are 'empty'
! mapresp->data_count = mapresp->width * mapresp->height;
! mapresp->data = new int8_t[mapresp->data_count];
! memset( mapresp->data, -1, sizeof(uint8_t) * mapresp->data_count );
printf( "Stage computing map tile (%d,%d)(%d,%d)...",
***************
*** 223,227 ****
// }
- mapresp->data_count = mapresp->width * mapresp->height;
//printf( "Stage publishing map data %d bytes\n",
--- 225,228 ----
***************
*** 232,235 ****
--- 233,237 ----
PLAYER_MAP_REQ_GET_DATA,
(void*)mapresp, mapsize, NULL);
+ delete [] mapresp->data;
free(mapresp);
Index: p_graphics2d.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_graphics2d.cc,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** p_graphics2d.cc 23 Aug 2007 19:58:49 -0000 1.6
--- p_graphics2d.cc 12 Sep 2007 09:51:28 -0000 1.6.2.1
***************
*** 142,146 ****
! double pts[PLAYER_GRAPHICS2D_MAX_POINTS][2];
for(unsigned int p=0; p<pcmd->points_count; p++ )
--- 142,146 ----
! double (*pts)[2] = new double[pcmd->points_count][2];
for(unsigned int p=0; p<pcmd->points_count; p++ )
***************
*** 153,164 ****
if( pcmd->filled )
! {
! stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->fill_color));
! stg_rtk_fig_polygon( this->fig,
0,0,0,
pcmd->points_count,
pts,
TRUE );
! }
stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->color) );
--- 153,164 ----
if( pcmd->filled )
! {
! stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->fill_color));
! stg_rtk_fig_polygon( this->fig,
0,0,0,
pcmd->points_count,
pts,
TRUE );
! }
stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->color) );
***************
*** 168,171 ****
--- 168,172 ----
pts,
FALSE );
+ delete [] pts;
return 0; //ok
}
Index: p_fiducial.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_fiducial.cc,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** p_fiducial.cc 23 Aug 2007 19:58:49 -0000 1.10
--- p_fiducial.cc 12 Sep 2007 09:51:28 -0000 1.10.2.1
***************
*** 78,89 ****
// fcount );
! if( fcount > PLAYER_FIDUCIAL_MAX_SAMPLES )
! {
! PRINT_WARN2( "A Stage model has detected more fiducials than"
! " will fit in Player's buffer (%u/%u)\n",
! (uint) fcount, PLAYER_FIDUCIAL_MAX_SAMPLES );
! fcount = PLAYER_FIDUCIAL_MAX_SAMPLES;
! }
!
for( int i=0; i<(int)fcount; i++ )
{
--- 78,82 ----
// fcount );
! pdata.fiducials = new player_fiducial_item_t[fcount];
for( int i=0; i<(int)fcount; i++ )
{
***************
*** 120,123 ****
--- 113,117 ----
PLAYER_FIDUCIAL_DATA_SCAN,
&pdata, sizeof(pdata), NULL);
+ delete [] pdata.fiducials;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit