You appear to have removed the call to read() on the client object from
the original example.
// this blocks until new data comes; 10Hz by default
robot.Read();
It looks like you replaced it with a LaserProxy object.
Without this call, no data will be received and so trying to access the
2nd member of the ranges array using GetRange() will access an allocated
block of memory.
Geoff
Thayne (Mech Stu) wrote:
>
> PlayerClient robot(gHostname, gPort);
> Position2dProxy pp(&robot, gIndex);
> LaserProxy lp(&robot, gIndex);
>
> LaserProxy Read();
>
> std::cout << robot << std::endl;
>
> pp.SetMotorEnable (true);
>
> for(;;)
> {
> double newspeed = 0;
> double newturnrate = 0;
> std::cout<< "points in scan: " << lp.GetCount() <<std::endl;
> std::cout<< "Max Range(m): " << lp.GetMaxRange() <<std::endl;
> std::cout<< "Resolution(D): " << rtod(lp.GetScanRes()) <<std::endl;
> std::cout<< "Range(mm): " << lp.GetCount() <<std::endl<<std::endl;
>
> std::cout<< lp.GetRange(1) <<std::endl;
>
>
>
> This is my modified program from the one inside the libplayer++
> "laserobstacleavoidance"
> when i run the program it gave me "segmentation fault" for the GetRange.
> Can anyone help me?
>
> Cheers in advance..
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Playerstage-users mailing list
Playerstage-users@...
https://lists.sourceforge.net/lists/listinfo/playerstage-users