Difference between revisions of "Simple Controller in Player"

From MurrayWiki
Jump to: navigation, search
Line 15: Line 15:

Latest revision as of 16:58, 19 January 2007

Documentation for the Client Libraries can be found at [1]

For C++, the first few lines of a controller (in a .cc file) will look something like:

    using namespace PlayerCc;

    // Connect to Player server
    robot = new PlayerClient(gHostname, gPort);

    // Request sensor data
    pp = new Position2dProxy(robot, gIndex);
    sp = new SonarProxy(robot, gIndex);

This code creates a PlayerClient, the connection between your controller and your robot. In this case, the robot supplies 2d position data (x,y, and theta) and sonar data to the controller.