|
From: Hugo G. M. <hg...@es...> - 2005-05-07 16:11:46
|
Hello...
I've tried to make a small java class in order to understand the way the
interaction between the java client, the player and stage works.
So far I manage to get information about some sensors and move the robot
around... However I found a problem that I don't understand why it
happens... When I run the code below I have the information about the
position of the robot updated every step... And that is OK... But when I
uncomment the (apparently innocent) LaserInterface line I stop having that
information updated and it prints always the same position. Can someone help
me please...
Thanks...
hugo
******************************* CODE **********************
package javaclient;
public class Test {
public static void main(String[] args) {
String hostToConnect = args[0];
int portToConnect = Integer.parseInt(args[1]);
System.out.println(" Host: "+hostToConnect+" Port: "+portToConnect);
PlayerClient robot = new PlayerClient (hostToConnect, portToConnect);
PositionInterface ppd = robot.requestInterfacePosition(0, 'a');
// LaserInterface lpd = robot.requestInterfaceLaser(0, 'a');
robot.runThreaded(-1, -1);
for(int i = 0; ; i++) {
robot.readAll();
for(int j = 0; j < 100000000; j++){}
ppd.setSpeed(100, 0);
System.out.println(ppd.getX() + " " + ppd.getY());
}
}
}
----------------------------------------------------
Hugo Gravato Marques, University of Essex, PhD Student
PHONE: +44 (0)7854917241, England or +351 962482416, Portugal
ADDRESS: University of Essex, Department of Computer Science,
Wivenhoe Park, Colchester Essex, CO4 3SQ, UK
WEB: http://privatewww.essex.ac.uk/~hgmarq/
|