Re: Rangertolaser and hokuyo_aist: Wrong laser output / all bearings are zero

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

Re: Rangertolaser and hokuyo_aist: Wrong laser output / all bearings are zero

Rich Mattes-2
On 11/01/2013 01:19 PM, Uli wrote:

> I use player 3.0.2 and a Hokuyo urglaser device. According to the
> instructions, I implemented rangertolaser and hokuyo_aist to read out the
> data. However, the output values of the ranges and bearings seem to be
> wrong. For instance all the 'bearings' values are zero. Furthermore, some
> 'ranges' are zero which shouldn't be zero at all. I didn't have the problems
> when I used a older player version with the 'urglaser driver'. There is a
> simple program I wrote to test the laser:
>
> CFG-FILE:
>
>        driver
>       (
>       name "hokuyo_aist"
>       provides ["6666:ranger:0"]
>       portopts "type=serial,device=/dev/ttyACM0,timeout=1"
>       pose [0.0 0.0 0.0 0.0 0.0 0.0]
>       #min_angle -0.4
>       #max_angle 0.4
>       baud_rate 115200
>       #verbose true
>       )
>      driver
>      (
>      name "rangertolaser"
>      requires ["6666:ranger:0"] # read from ranger:0
>      provides ["6666:laser:0"] # output results on laser:0
>     )
>
> CPP-FILE:
>
> #include <libplayerc/playerc.h>
>
> int main () {
>
> playerc_client_t * client;
> playerc_ranger_t * ranger;
>
> // Create a client object and connect to the server; the server must
> // be running on "localhost" at port 6665
>   client = playerc_client_create(NULL, "localhost", 6666);
>
> if (playerc_client_connect(client) != 0)
>    {
>      fprintf(stderr, "error: %s\n", playerc_error_str());
>      return -1;
>    }
>
> ranger = playerc_ranger_create(client, 0);
>    if (playerc_ranger_subscribe(ranger, PLAYERC_OPEN_MODE) != 0)
>    {
>      fprintf(stderr, "error: %s\n", playerc_error_str());
>      return -1;
>    }
>
> //sleep (1);
> playerc_client_read(client);
>
> printf("Points:%d Bearings:%d\n", ranger->points_count,
> ranger->bearings_count);
> printf("RangeRes:%.5g BearingRes:%.5g\n", ranger->range_res,
> ranger->angular_res);
> printf("Angle-:%.5g Angle+:%.5g\n", ranger->min_angle, ranger->max_angle);
>
> FILE *filePtr;
> filePtr = fopen("Scan","w");
> float act_rang=0;
> float act_bearing=0;
> for (int j = 0; j < ranger->points_count; j += 1){
> act_rang=ranger->ranges[j];
> act_bearing= (float) (ranger->bearings[j]);
> fprintf (filePtr,"ranges:%.5g bearings:%.5g J:%d\n", act_rang,act_bearing ,
> j);
> }
>
>
>      playerc_ranger_unsubscribe(ranger);
>      playerc_ranger_destroy(ranger);
>      playerc_client_disconnect(client);
>      playerc_client_destroy(client);
>
> return -1;
>
> }
>
> Can anybody help me?
>
>
>
Thanks for providing the code and config file you're using.  The config
file looks good.  As a first step, try running playerprint or playerv on
the laser and ranger interfaces, and see if you get reasonable data out
of both interfaces.  If that works, try calling
playerc_client_read(client) more than once before printing out the data.

Rich

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Playerstage-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-users
Uli
Reply | Threaded
Open this post in threaded view
|

Re: Rangertolaser and hokuyo_aist: Wrong laser output / all bearings are zero

Uli
This post was updated on .
Thank you Rich!!! I already made it work. I use the laser interface instead of the ranger interface. There are also several changes regarding the drivers. The most important change is the following: the error distance of the urglaser driver is 5.6 meters. The new hokuyo_aist driver gives back an error distance of 0 m.