|
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
Player Server ManualWhat is Player? Player is a robot device server. It gives you simple and complete control over the physical sensors and actuators on your mobile robot. When Player is running on your robot, your client control program connects to it via a standard TCP socket, and communication is accomplished by the sending and receiving of some of a small set of simple messages. Player is designed to be language and platform independent. Your client program can run on any machine that has network connectivity to your robot, and it can be written in any language that can open and control a TCP socket. Client-side libraries are currently available for C, C++, Tcl, LISP, Java, and Python. Player also makes no assumptions about how you might want to structure your robot control programs; i.e., Player is architecturally neutral. Quick-start Guide
The configuration file is a text file describing the set of devices to be instantiated; for example, if you have an ActivMedia Pioneer and a SICKLMS200 scanning laser range finder:
This file instructs the server to create two devices:
Note the important distinction between drivers, interfaces and devices:
Devices are also given an index to facilitate unique addressing (e.g., "laser:0" or "laser:1"); this allows the server to instantiate more than one device with the same interface.
For example, the following code fragment demonstrates a simple client using the libplayerc library.
#include <stdio.h> #include "playerc.h" int main(int argc, const char **argv) { int i; playerc_client_t *client; playerc_position_t *position; // 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", 6665); if (playerc_client_connect(client) != 0) { fprintf(stderr, "error: %s\n", playerc_error_str()); return -1; } // Create a position proxy (device id "position:0") and susbscribe // in read/write mode position = playerc_position_create(client, 0); if (playerc_position_subscribe(position, PLAYER_ALL_MODE) != 0) { fprintf(stderr, "error: %s\n", playerc_error_str()); return -1; } // Enable the robots motors playerc_position_enable(position, 1); // Start the robot turning slowing playerc_position_set_cmd_vel(position, 0, 0, 0.1, 1); for (i = 0; i < 200; i++) { // Read data from the server and display current robot position playerc_client_read(client); printf("position : %f %f %f\n", position->px, position->py, position->pa); } // Shutdown and tidy up playerc_position_unsubscribe(position); playerc_position_destroy(position); playerc_client_disconnect(client); playerc_client_destroy(client); return 0; } This example can be built using the commands:
With the server already started, you can run the example with:
Assuming everything is plugged in and turned on, your robot should scoot across the room. Client libraries also exist for C, C++, Tcl, LISP, Java, and Python. Further informationMore detailed information can be found here:
Generated on Tue May 3 14:15:32 2005 for Player by 1.3.6 |