From: Holger E. <hol...@da...> - 2009-07-09 15:42:35
|
Thanks, in the meanwhile I've found a solution by searching in the mailing-list archive and in player's interface-description. For instance, when changing the setVelocity in Position2DInterface as follows, the setSpeed-command works: public void setVelocity (PlayerPose vel, int state) { try { sendHeader (PLAYER_MSGTYPE_CMD, PLAYER_POSITION2D_CMD_VEL, 24+4); XdrBufferEncodingStream xdr = new XdrBufferEncodingStream (24+4); xdr.beginEncoding (null, 0); xdr.xdrEncodeDouble(vel.getPx ()); xdr.xdrEncodeDouble (vel.getPy ()); xdr.xdrEncodeDouble (vel.getPa ()); xdr.xdrEncodeByte ((byte)state); ... (and of course, you should not use 10.0f for translational speed, as given in the example below :-) Best Holger -----Original Message----- From: Radu Bogdan Rusu [mailto:ru...@cs...] Sent: Thursday, July 09, 2009 9:42 AM To: jav...@li...; Holger Endert Subject: [Fwd: [JavaPlayerClient] Question] Holger, I'm redirecting your message to the appropriate java-player-users mailing list. Radu. -------- Original Message -------- Subject: [JavaPlayerClient] Question Date: Thu, 9 Jul 2009 09:00:05 +0200 From: Holger Endert <hol...@da...> To: 'ru...@cs...' <ru...@cs...>, 'ma...@ro...' <ma...@ro...> Hello Mr. Rusu & Mr. Batalin, I have a question concerning the compatibility of your java-based player-client with the current version of player (v2.2.0). It seems that connection to player works (a list of devices is printed on the console output), but reading and sending data to player causes the client to crash. My first simple example should let a robot move for a few seconds forwards via the position2d interface, like this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PlayerClient client = new PlayerClient("192.168.1.13", 6665); Position2DInterface ifc = client.requestInterfacePosition2D(0, PlayerConstants.PLAYER_OPEN_MODE); System.out.println("START MOVEMENT"); ifc.setSpeed(10f, 0.0f); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("STOP MOVEMENT"); ifc.setSpeed(0.0f, 0.0f); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do you know if there are any issues with compatibility, and if so, (how) can I fix them? Do I have some bugs in my code? Are there any code-examples that may help? Thanks in advance and best wishes Holger Endert ----------------------------------------- Dipl. Inform. Holger Endert DAI-Labor - Technische Universität Berlin Sekretariat TEL 14, Ernst-Reuter-Platz 7, 10587 Berlin Fon: +49 30 314-74079 Fax: +49 30 314 21799 hol...@da... http://www.dai-labor.de http://www.dainamite.de -- | Radu Bogdan Rusu | http://rbrusu.com/ |