From: Rabotron <cel...@gm...> - 2007-12-04 23:36:16
|
Hello,sorry for my poor english. I'm the same problem with CameraInterface. I am used player 2.1.0 (from CVS) and javaclient2, and i can't get more than one image in the same conexion with javaclient. The java code that i have to put to get more than one image is this: =09while (true) { =09=09=09 =09PlayerClient robot =3D new PlayerClient("localhost", 6665); =09CameraInterface cam =3D robot.requestInterfaceCamera(0, PlayerConstants.PLAYER_OPEN_MODE); =09robot.runThreaded (1, 1); =09=09=09 =09 PlayerCameraData camdata=3Dnull; =09=09=09=20 =09try {=09 =20 =09=09Thread.sleep (500); =09} catch (Exception e) { =09 =09System.out.println("Excepcion al dormir\n"); =09} =09=09=09=09=09=09 =09camdata =3D cam.getData(); =09=09=09=09 =09 byte [] imageData =3D camdata.getImage (); =09=09=09 =09=09=09=09 =09=20 =09 analizarImage (imageData); =09=09=09=09 =09 robot.stop(); =09}=20 in this code i do one conection with javaclient to each loop, getData() and stop javaclient conection,i do this because i only can get the fist image i= n one conection, but i loose my time a lot. If i use this code:=20 =09CameraInterface cam =3D robot.requestInterfaceCamera(0, PlayerConstants.PLAYER_OPEN_MODE); =09robot.runThreaded (1, 1); =09PlayerCameraData camdata=3Dnull; =09=09=20 =09try {=09 =20 =09=09Thread.sleep (500); =09} catch (Exception e) { =09=09System.out.println("Excepcion al dormir\n"); =09} =09=09=09 =09while (true) { =09=09=09=09 =09=09camdata =3D cam.getData(); =09=09byte [] imageData =3D camdata.getImage (); =09=09analizarImage (imageData); =09} i only do one conection with javaclient but i can=C2=B4t get more than one = image with getData(). I probed to do: =09while (true) { =09=09 while(!cam.isDataReady()) robot.readAll(); =09=09.... =09} and =09while (true) { =09=09 while(!cam.isDataReady()); =09=09.... =09} =20 but it is a infinite loop, my cam is ready only one time for conection xDDD I probed too donwload the last version of CameraInterface.java=20 for the SVN ( https://java-player.svn.sourceforge.net/svnroot/java-player/javaclient2/ https://java-player.svn.sourceforge.net/svnroot/java-player/javaclient2/ ) with the new path... and the result is the same. For more information about my proyect visit: http://rabotron.blogspot.com= =20 http://rabotron.blogspot.com or http://www.celtico-celtico.blogspot.com http://www.celtico-celtico.blogspot.com=20 Thanx. Tor --=20 View this message in context: http://www.nabble.com/Problem-with-CameraInte= rface-tf4946248.html#a14161461 Sent from the java-player-users mailing list archive at Nabble.com. |