From: Radu B. R. <ru...@cs...> - 2007-02-13 17:51:12
|
You must check if the data is available/ready using p2di.isDataReady (see the API documentation for more information) and then print it. We made some examples available some time ago on the web page. Those should run without any problems with the latest P/S/G versions. Cheers, Radu. Mark Bramnik wrote: > Hi > I'm quite a newbie and I have a newbie's question about > Position2Dinterface. > I'm using player-2.0.3 on wbr914 robot and I encountered some problems > using > Position2dinterface. > I use the javaclient-2.0.1.jar > The problem is that I can't see position2D updates while reading the > position data in the infinite loop. > playerv works just fine... > I'm trying to do this way: > > > ................ > > robot = new PlayerClient(ROBOT_IP, ROBOT_PORT); > p2di = robot.requestInterfacePosition2D(0, PlayerConstants.PLAYER_OPEN_MODE > ); > robot.requestDataDeliveryMode(PlayerConstants.PLAYER_DATAMODE_PUSH); > robot.setNotThreaded(); > p2di.setMotorPower(1); > while (runTest) { > robot.readAll(); > positionTest(p2di); // this prints the position2d data on screen > Thread.sleep(1000); > System.out.println("======================================="); > } > > Whats interesing that when I > run the playerv, subscribe to see the position data on playerv screen > and AFTER THAT run my simple program - I Do receive the updated data. > However when I make my robot move, the data reading fails (irrelevant data > is printed). I saw the code from the example (actually my code is c/p from > there... but it doesn't work...). > So could anyone please point me on my problem or provide some working code? > > Any help is highly appreciated :) > Thanks in advance > Mark Bramnik > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Java-player-users mailing list > Jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-player-users -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |