Wrong Range values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong Range values

tahir yaqub
Hi there
I am getting wrong values for first 180 range values
from a "real" SICK scanner LMS200.
These values are from 0 to 90 with an increment of
0.5.



lp.GetAccess();
RETURN=
lp.Configure(DTOR(-90.0),DTOR(90.0),50,10,false);
usleep(200000);
printf("\n RETURN IS %d\n",RETURN);
       
RETURN2=lp.GetConfigure();      

printf("\n RETURN IS %d\n",RETURN2);
printf("\n  SCAN_COUNT IS %d\n",lp.scan_count);
 printf("\n No Of LASER COUNTS ARE
%d\n",lp.RangeCount());
lp.PrintConfig();
for(int j=0;j<2;j++)
{
lp.GetConfigure();
if(robot.Read())
  {
 
 printf("couldn't read");
    exit(1);
  }
 lp.Print();
    printf("\n");
    for(int i=0;i<lp.scan_count &&
i<PLAYER_LASER_MAX_SAMPLES;i++)
   {  
     //  printf("\nlp.scan[i][0]=%.3f\t ",
lp.scan[i][0]);
     //printf("\tlp.scan[i][1]=%5.3f\n ",
lp.scan[i][1]);
   
   laser_theta[i]=RTOD(lp.scan[i][1]);
   laser_range[i]=lp.scan[i][0]; //Documentation shows
in m but is in mm


 }

}
printf("\n No Of LASER COUNTS ARE
%d",lp.RangeCount());
printf(" SCAN_COUNT IS %d\n",lp.scan_count);
 printf("\n No Of LASER COUNTS ARE
%d\n",lp.RangeCount());
 for(int i=0;i<10;i++)
 printf("\n laser_theta[%d] for testing = %f
laser_range[%d]
=%5.2f",i,laser_theta[i],i,laser_range[i]);
 //GEt the no of range/intensity readings

READINGS=lp.RangeCount();

printf("\n THE NUMBER OF READINGS ARE
%d\n",READINGS);
/////XXXXXXXxx    CONVERTING TO CARTESIAN COORDINATES
XXXXXXXXXXx

 for(int i=0;i<361;i++)
 printf("\n
lsr_range[%d]=%f\tlsr_theta=%f\tCSIAN_x[%d]=%f\t
CARTN_y[%d]=%f",i,laser_range[i],laser_theta[i],i,CARTESIAN_x[i],i,CARTESIAN_y[i]);


THE OUTPUT IS AS FOLLOWING:

laser_theta[0] for testing = -90.000000 laser_range[0]
= 0.00
 laser_theta[1] for testing = -89.500000
laser_range[1] = 0.50
 laser_theta[2] for testing = -89.000000
laser_range[2] = 1.00
 laser_theta[3] for testing = -88.500000
laser_range[3] = 1.50
 laser_theta[4] for testing = -88.000000
laser_range[4] = 2.00
 laser_theta[5] for testing = -87.500000
laser_range[5] = 2.50
 laser_theta[6] for testing = -87.000000
laser_range[6] = 3.00
 laser_theta[7] for testing = -86.500000
laser_range[7] = 3.50
 laser_theta[8] for testing = -86.000000
laser_range[8] = 4.00
 laser_theta[9] for testing = -85.500000
laser_range[9] = 4.50
 THE NUMBER OF READINGS ARE  361


although the lp.print is showing correct values.

What could be the problem.

Thanks

Tahir


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users
Reply | Threaded
Open this post in threaded view
|

Re: Wrong Range values

Toby Collett
Hi,
I dont know specifically what its likely to be, but try running a loop
rather than calling just once, sometimes the laser takes a while to
initialise and you may get some dud readings?

Toby



tahir yaqub wrote:

>Hi there
>I am getting wrong values for first 180 range values
>from a "real" SICK scanner LMS200.
>These values are from 0 to 90 with an increment of
>0.5.
>
>
>
>lp.GetAccess();
>RETURN=
>lp.Configure(DTOR(-90.0),DTOR(90.0),50,10,false);
>usleep(200000);
>printf("\n RETURN IS %d\n",RETURN);
>
>RETURN2=lp.GetConfigure();      
>
>printf("\n RETURN IS %d\n",RETURN2);
>printf("\n  SCAN_COUNT IS %d\n",lp.scan_count);
> printf("\n No Of LASER COUNTS ARE
>%d\n",lp.RangeCount());
>lp.PrintConfig();
>for(int j=0;j<2;j++)
>{
>lp.GetConfigure();
>if(robot.Read())
>  {
>
> printf("couldn't read");
>    exit(1);
>  }
> lp.Print();
>    printf("\n");
>    for(int i=0;i<lp.scan_count &&
>i<PLAYER_LASER_MAX_SAMPLES;i++)
>   {  
>     //  printf("\nlp.scan[i][0]=%.3f\t ",
>lp.scan[i][0]);
>     //printf("\tlp.scan[i][1]=%5.3f\n ",
>lp.scan[i][1]);
>    
>   laser_theta[i]=RTOD(lp.scan[i][1]);
>   laser_range[i]=lp.scan[i][0]; //Documentation shows
>in m but is in mm
>
>
> }
>
>}
>printf("\n No Of LASER COUNTS ARE
>%d",lp.RangeCount());
>printf(" SCAN_COUNT IS %d\n",lp.scan_count);
> printf("\n No Of LASER COUNTS ARE
>%d\n",lp.RangeCount());
> for(int i=0;i<10;i++)
> printf("\n laser_theta[%d] for testing = %f
>laser_range[%d]
>=%5.2f",i,laser_theta[i],i,laser_range[i]);
> //GEt the no of range/intensity readings
>
>READINGS=lp.RangeCount();
>
>printf("\n THE NUMBER OF READINGS ARE
>%d\n",READINGS);
>/////XXXXXXXxx    CONVERTING TO CARTESIAN COORDINATES
>XXXXXXXXXXx
>
> for(int i=0;i<361;i++)
> printf("\n
>lsr_range[%d]=%f\tlsr_theta=%f\tCSIAN_x[%d]=%f\t
>CARTN_y[%d]=%f",i,laser_range[i],laser_theta[i],i,CARTESIAN_x[i],i,CARTESIAN_y[i]);
>
>
>THE OUTPUT IS AS FOLLOWING:
>
>laser_theta[0] for testing = -90.000000 laser_range[0]
>= 0.00
> laser_theta[1] for testing = -89.500000
>laser_range[1] = 0.50
> laser_theta[2] for testing = -89.000000
>laser_range[2] = 1.00
> laser_theta[3] for testing = -88.500000
>laser_range[3] = 1.50
> laser_theta[4] for testing = -88.000000
>laser_range[4] = 2.00
> laser_theta[5] for testing = -87.500000
>laser_range[5] = 2.50
> laser_theta[6] for testing = -87.000000
>laser_range[6] = 3.00
> laser_theta[7] for testing = -86.500000
>laser_range[7] = 3.50
> laser_theta[8] for testing = -86.000000
>laser_range[8] = 4.00
> laser_theta[9] for testing = -85.500000
>laser_range[9] = 4.50
> THE NUMBER OF READINGS ARE  361
>
>
>although the lp.print is showing correct values.
>
>What could be the problem.
>
>Thanks
>
>Tahir
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com 
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by:
>Tame your development challenges with Apache's Geronimo App Server.
>Download it for free - -and be entered to win a 42" plasma tv or your very
>own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
>_______________________________________________
>Playerstage-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/playerstage-users
>
>  
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users