From: Radu B. R. <ru...@cs...> - 2006-03-06 09:24:33
|
Okay. Committed... Basically we added a read timeout (I went through the C/C++ code and noticed that there is something similar there). Use <PlayerClient>.setReadTimeout/getReadTimeout. Default should be 100ms (measuring with System.currentTimeMillis). Of course, these changes affect the non-threaded version of Javaclient2 only. The threaded one, will try to poll continuously. I did some tests and it seems to work fine (Although it was very hard 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 was sending integers instead of floats), so I fixed it now. It would be best to use setVelocity though, or if you have any proposals to make 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 Heading/Position controller (PID), which I changed too, to use floats (but not tested yet!). SonarInterface had a bug. The last value of the values array wasn't being read. So all of them fixed in the CVS. (co -P javaclient2). If you find even more bugs, I wouldn't mind giving you commit rights, as you seem to use 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 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 > 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 >> 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=0; // Added by HGM >> while(is.available() == 0){ // Added by HGM >> if (i>10000) break; // Added by HGM >> i++; // Added by HGM >> } // Added by HGM >> >> while (is.available() != 0){ >> if (read () == PLAYER_MSGTYPE_SYNCH){ >> break; >> } >> } >> } catch (IOException e) { >> throw new PlayerException ("[PlayerClient]: Error reading >> data",e); >> } >> // while (read () != 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 >> 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 >> 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 = 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... >> 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: >> >> >> >>> Hi... >>> >>> >>> >> >> I just woke up, so I didn't have a chance to look at the problem yet >> (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? >>> >>> >>> >> >> This is not good... setSpeed was removed in Javaclient2 completely! >> Instead we have setVelocity (PlayerPose,int). PlayerPose has float >> structures so no need to send integers. Are you using a mix between >> Javaclient 1.6.5 and Javaclient2 ? >> >> >> >>> Cheers, >>> Hugo >>> >>> >>> >> >> Cheers back :) >> Radu. >> >> >> > -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |