From: Radu B. R. <ve...@in...> - 2005-05-07 17:08:02
|
I'm not quite sure what you're experiencing here. The exact same code works with Javaclient 1.6.2e just fine. By the way, one small note: - try to use the javaclient.jar file or the classes subdirectory and use "import javaclient.*;" instead of building your code inside the javaclient sources (hence, the need for "package javaclient;"). I now realize the need for some simple examples for our users... We provided the ANT makefile and shell scripts which should build the classes, the jar and the documentation, but we forgot to explain that to our users. :( So your code works fine with player and stage (CVSed) and Javaclient 1.6.2e. What version of player/stage are you using, and how does your config/world file looks like? I'm quite sure this should work with any version, but who knows... nobody is perfect :) Cheers, Radu. On Sat, May 07, 2005 at 05:11:26PM +0100, Hugo Gravato Marques wrote: > > > 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/ > Yours sincerely, Radu Bogdan Rusu -- | Radu Bogdan 'veedee' Rusu | http://www.rbrusu.com | PhD student/teaching assistant | Robotics Research Group, Technical University of Cluj-Napoca[.ro] | The optimist sees a task in every problem. | The pessimist sees a problem in every task. |