Position info obtained does not match the gazebo's displayed info

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Position info obtained does not match the gazebo's displayed info

ysong
Hi All,
     I met a problem when using gazebo simulator:
     The position informations obtained by calling the related functions
are not as the same as the ones displayed on the right side of Gazebo
GUI. And applying the same program to the stage simulator, the data
obtained equals to the one that is displayed on the stage map.
     Could anyone give me a hint of the possible reasons that may cause
this problem please?
     Thanks in advance.
                  Regards
     yang

The test program below:

> #include <stdio.h>
> #include <unistd.h>
> #include <libplayerc/playerc.h>
> int main(int argc, const char **argv)
> {
>         int i;
>         playerc_client_t *client;
>         playerc_position2d_t *position2d;
>
>         // Create a client and connect it to the server.
>         client =playerc_client_create(NULL, "localhost", 6665);
>         if (0 != playerc_client_connect(client))
>         return -1;
>
>         // Set the datamode and replace rule to avoid data buffering
>         if (playerc_client_datamode(client, PLAYERC_DATAMODE_PULL) != 0)
>         {
>                 fprintf(stderr, "error: %s\n", playerc_error_str());
>                 return -1;
>         }
>
>         if (playerc_client_set_replace_rule(client, -1, -1,
> PLAYER_MSGTYPE_DATA, -1, 1) != 0)
>         {
>                 fprintf(stderr, "error: %s\n", playerc_error_str());
>                 return -1;
>         }
>
>         // Create and subscribe to a position2d device.
>         position2d = playerc_position2d_create(client, 0);
>         if (playerc_position2d_subscribe(position2d, PLAYER_OPEN_MODE))
>         return -1;
>        
>         // Make the robot drive
>         playerc_position2d_set_cmd_vel(position2d, 0.1,0, 0,1);
>         for (i = 0; i < 50; i++)
>         {      
>                 // Wait for new data from server
>                 playerc_client_read(client);
>
>                 // Print current robot pose
>                 printf("position2d : %f %f %f\n", position2d->px,
> position2d->py, position2d->pa);
>         }
>         // Stop the robot.
>         playerc_position2d_set_cmd_vel(position2d, 0, 0, 0, 1);
>         // Shutdown
>         playerc_position2d_unsubscribe(position2d);
>         playerc_position2d_destroy(position2d);
>         playerc_client_disconnect(client);
>         playerc_client_destroy(client);
>
>         return 0;
> }

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo