14 #include <libplayerc/playerc.h> 17 "Usage: ptest <string>\n" 18 " where <string> is comprised of any number of the following characters:\n" 25 playerc_laser_t *laser =
26 playerc_laser_create(client, 0);
27 if (playerc_laser_subscribe(laser, PLAYER_OPEN_MODE))
31 for(i = 0; i < 100; i++)
34 playerc_client_read(client);
37 playerc_laser_unsubscribe(laser);
38 playerc_laser_destroy(laser);
46 playerc_position2d_t *position =
47 playerc_position2d_create(client, 0);
48 if (playerc_position2d_subscribe(position, PLAYER_OPEN_MODE))
52 if (playerc_position2d_set_cmd_vel(position, 0, 0, DTOR(40.0), 1) != 0)
56 for( i = 0; i < 100; i++)
59 playerc_client_read(client);
62 printf(
"position : %f %f %f\n",
63 position->px, position->py, position->pa);
66 playerc_position2d_unsubscribe(position);
67 playerc_position2d_destroy(position);
76 playerc_client_t *client;
87 printf(
"Attempting to connect to a Player server on %s:%d\n",
91 client = playerc_client_create(NULL, host, port);
92 if (playerc_client_connect(client) != 0)
94 puts(
"Failed. Quitting." );
98 puts(
"Connected. Running tests." );
101 size_t len = strlen( argv[1] );
103 for( i=0; i<len; i++ )
115 printf(
"unrecognized test '%c'\n", argv[1][i] );
118 puts(
"Disconnecting" );
120 playerc_client_disconnect(client);
121 playerc_client_destroy(client);
int test_position(playerc_client_t *client)
int test_laser(playerc_client_t *client)
int main(int argc, const char **argv)