From: Marques, H. G <hg...@es...> - 2006-03-06 14:34:53
|
Hi Radu... It sounds like a good solution. Unfortunately, I never quite got the = conditions to force the error... however, I would assume that if you = have many programs open (like I had) it would be more likely the error = to apear as player would not have time to reply before the line = "is.available()" in the JavaClient. Indeed I had two agents, a simple = one for tests and a second one which has a graphical interface with = loads of stuff associated with it, and the bug appear much more often in = the second one than in the first one... Hope this helps... Thanks (for both replies) 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: Mon 06/03/2006 09:24 To: jav...@li... Subject: Re: [Java-player-users] Javaclient2 = java.lang.ClassCastException: javaclient2.LaserInterface dirty fix =20 Okay. Committed... Basically we added a read timeout (I went through the C/C++ code and=20 noticed that there is something similar there). Use=20 <PlayerClient>.setReadTimeout/getReadTimeout. Default should be 100ms=20 (measuring with System.currentTimeMillis). Of course, these changes=20 affect the non-threaded version of Javaclient2 only. The threaded one,=20 will try to poll continuously. I did some tests and it seems to work fine (Although it was very hard=20 for me to replicate the error. Can you please tell me what did you do to = get it often? I would like to test some more). As I said in my previous e-mail, setSpeed was faulty (meaning that it=20 was sending integers instead of floats), so I fixed it now. It would be=20 best to use setVelocity though, or if you have any proposals to make=20 some wrappers for it, I would be glad to incorporate them into the tree. = Basically, setSpeed was still there because it was needed by the=20 Heading/Position controller (PID), which I changed too, to use floats=20 (but not tested yet!). SonarInterface had a bug. The last value of the values array wasn't=20 being read. So all of them fixed in the CVS. (co -P javaclient2). If you find even=20 more bugs, I wouldn't mind giving you commit rights, as you seem to use=20 it heavily, so another developer would really make development (patching = at least) faster. Check http://java-player.sourceforge.net/examples.php for some fresh 2.x = examples, including a couple of test methods for various interfaces (in=20 Javaclient2Test). Gotta run to the uni now, so talk to you later. Tell me if you encounter = more problems. Cheers, Radu Radu Bogdan Rusu wrote: > Hi Hugo, > > First of all, MANY THANKS for the bug reports! > > I managed to fix both bugs, but the CVS at SF doesn't work for me=20 > right now. I will try to commit the changes in the morning. > > I also found a bug in the SonarInterface, and fixed that one too. > > Cheers, > Radu. > > Marques, Hugo G wrote: > >> Hi... >> >> I found the reason why it was given the exception. the reason was=20 >> 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=20 >> 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=20 >> 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/ >> >> >> >> >> >> >> >> -----Original Message----- >> From: jav...@li... on behalf of=20 >> Marques, Hugo G >> Sent: Sat 04/03/2006 18:17 >> To: jav...@li... >> Subject: RE: [Java-player-users] InterfacePosition2D >> >> >> Hello... >> thanks for the reply... I've double checked my code and there is no=20 >> refences (not even in the classpath) to javaclient1.6.5. I already=20 >> manage to control the robot's movement but the method=20 >> 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=20 >> with the previous version but in fact the speed and turnrate are=20 >> different now... >> >> I also tried to investigate a bit further the ClassCastException and=20 >> 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... >> 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/ >> >> >> >> >> >> >> >> -----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 >> >> Hi Hugo, >> >> >> Marques, Hugo G wrote: >> >> =20 >> >>> Hi... >>> >>> >>> =20 >> >> I just woke up, so I didn't have a chance to look at the problem yet=20 >> (will do soon), but... >> >> =20 >> >>> Apart from this error I was wondering how can I make the robot move=20 >>> smoother and slower since even with setSpeed(1,1) it drives too=20 >>> fast... At the moment I can't actually control the direction of the=20 >>> 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 ? >> >> =20 >> >>> Cheers, >>> Hugo >>> >>> >>> =20 >> >> Cheers back :) >> Radu. >> >> =20 >> > --=20 | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |