Simple Controller in Player: Difference between revisions
From Murray Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 15: | Line 15: | ||
[[Category:PlayerStage]] | [[Category:PlayerStage]] | ||
[[Category:MVWTfest]] | |||
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.