From: Marques, H. G <hg...@es...> - 2006-03-04 19:44:43
|
Hi... I found the reason why it was given the exception. the reason was that = in the method readAll of PlayerClient when the test is.available was = being made some times there was nothing. Since I'm really in a hurry I = made a sort of dirty fix that you might want to have a look: ********************* code public void readAll () { if (isThreaded) return; try { int i=3D0; // Added by HGM while(is.available() =3D=3D 0){ // Added by HGM if (i>10000) break; // Added by HGM i++; // Added by HGM } // Added by HGM while (is.available() !=3D 0){ if (read () =3D=3D PLAYER_MSGTYPE_SYNCH){ break; } } } catch (IOException e) { throw new PlayerException ("[PlayerClient]: Error reading = data",e); } // while (read () !=3D PLAYER_MSGTYPE_SYNCH); } ****************************** end code regards... Hugo ---------------------------------------------------- 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/ =20 -----Original Message----- From: jav...@li... on behalf of = Marques, Hugo G Sent: Sat 04/03/2006 18:17 To: jav...@li... Subject: RE: [Java-player-users] InterfacePosition2D =20 Hello...=20 thanks for the reply... I've double checked my code and there is no = refences (not even in the classpath) to javaclient1.6.5. I already = manage to control the robot's movement but the method setSpeed(int,int) = is in my code of javaclient2: public void setSpeed (int speed, int turnrate) { PlayerPose pp =3D new PlayerPose (); pp.setPx (speed); pp.setPa (turnrate); setVelocity (pp, 1); } I agree with you that it should not be there has it looks compliant with = the previous version but in fact the speed and turnrate are different = now... I also tried to investigate a bit further the ClassCastException and I = believe that the mistake is on the player (or stage) side. It seems to = me that there are variables not properly instantiated and that is = somteimes it works and sometimes don't... the PlayerClient code looks = fine to me...=20 actually the error only happens when I receive only this message from = stage: Player v.2.0.0 Rather than: Player v.2.0.0 selected devices [localhost:6666]: 6666:position2d:0 (stage) 6666:sonar:0 (stage) 6666:laser:0 (stage) 6666:blobfinder:0 (stage) 6666:fiducial:0 (stage) I hope this helps... once again thanks... Hugo ---------------------------------------------------- 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/ =20 -----Original Message----- From: jav...@li... on behalf of Radu = Bogdan Rusu Sent: Sat 04/03/2006 09:30 To: jav...@li... Subject: Re: [Java-player-users] InterfacePosition2D =20 Hi Hugo, Marques, Hugo G wrote: >Hi... > =20 > I just woke up, so I didn't have a chance to look at the problem yet=20 (will do soon), but... >Apart from this error I was wondering how can I make the robot move = smoother and slower since even with setSpeed(1,1) it drives too fast... = At the moment I can't actually control the direction of the movement... = How can I solve this? > =20 > This is not good... setSpeed was removed in Javaclient2 completely!=20 Instead we have setVelocity (PlayerPose,int). PlayerPose has float=20 structures so no need to send integers. Are you using a mix between=20 Javaclient 1.6.5 and Javaclient2 ? >Cheers, >Hugo > =20 > Cheers back :) Radu. --=20 | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting = language that extends applications into web and mobile media. Attend the live = webcast and join the prime developer group breaking into this new coding = territory! http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 _______________________________________________ Java-player-users mailing list Jav...@li... https://lists.sourceforge.net/lists/listinfo/java-player-users |