Content-Type: multipart/mixed; boundary=Apple-Mail-19--283388010 --Apple-Mail-19--283388010 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Hi = Lantao,

I had the same problem. Thanks for = bringing it up to this forum.
I made a patch file (attached) = for the below's slightly changed code.

I = have two questions to your change:
1) Is the following line = only cosmetic for playerv GUI or something = else?
"scanData.scan.ranges[rangeCount-1] =3D 0;  //@TODO = the last beam is set to be 0, to seperate the gui = range-plotting"

2) What if the ranger returns = as Geoff says values between 0.0 and 0.2 (thus they do not equal = "0")? 


Thanks and kind = regards,
Sebastian


Code = in patch file:

for (int ii =3D 0; ii < = rangeCount; ii++){
  curRangeData =3D = rangeData[ii];
  if( 0 =3D=3D curRangeData = )
    scanData.scan.ranges[ii] =3D = config.max_range;
  else
   =  scanData.scan.ranges[ii] =3D static_cast<float> = (curRangeData);
}
scanData.scan.ranges[rangeCount-1] = =3D 0;  //@TODO the last beam is set to be 0, to seperate the gui = range-plotting

= --Apple-Mail-19--283388010 Content-Disposition: attachment; filename=rangertolaser.cc.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="rangertolaser.cc.patch" Content-Transfer-Encoding: 7bit 194a195 > double curRangeData = 0; 246,247c247,254 < for (int ii = 0; ii < rangeCount; ii++) < scanData.scan.ranges[ii] = static_cast (rangeData[ii]); --- > for (int ii = 0; ii < rangeCount; ii++){ > curRangeData = rangeData[ii]; > if( 0 == curRangeData ) > scanData.scan.ranges[ii] = config.max_range; > else > scanData.scan.ranges[ii] = static_cast (curRangeData); > } > scanData.scan.ranges[rangeCount-1] = 0; //@TODO the last beam is set to be 0, to seperate the gui range-plotting --Apple-Mail-19--283388010 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Hi = Geoff and all,

My robot runs well now, and to wrap up this = problem:

My solution is simple, which may also prove that my = doubt is reasonable.
I modified the rangertolaser.cc file and reset = all those ranges which
have a return value of 0, to be = config.range_max (e.g. 5.6 for hokuyo
driver). Please see my attached = pictures to see the results.
In picture1, there are 6 figures, the = first three are the results before
my modification, and in order they = are the outputs of ranger:0, laser:0,
ranger:1, as from the cfg file = in my previous email; The last three
figures are the counterparts of = after modification.
Picture2 just shows that my amcl is running and = seems good.

I don't know if my solution is correct or not, but = just works well for
my project...


The parts that I = modified is (in rangertolaser.cc):

// Copy the data into the = laser message format
if (rangeData !=3D NULL)
{
= scanData.scan.ranges_count =3D rangeCount; //the print out result = shows
this value is 682
if ((scanData.scan.ranges =3D new = float[rangeCount]) =3D=3D NULL)
{
PLAYER_ERROR ("Failed to allocate = memory for range data");
return 0;
= }
= for (int ii =3D 0; ii < rangeCount; ii++){
= scanData.scan.ranges[ii] =3D static_cast<float> = (rangeData[ii]);
//lantao, reset the free space = range value to be max
if(!rangeData[ii])
= scanData.scan.ranges[ii] =3D config.max_range;
= scanData.scan.ranges[rangeCount-1] =3D 0;  //@TODO the last = beam is set
to be 0, to seperate the gui range-plotting
= }
= = = = = = =
}

Thank you.

Lantao
= = --Apple-Mail-19--283388010--