From: Alberto A. <ame...@IC...> - 2005-12-12 22:19:06
|
Hello everybody, This is the first time I am using javaclient and also Player/Gazebo. I am trying to detect a blue cylinder using blobfinder, but it's not working. I don't know if my problem is the way I am using the java client, or might be related with the color file in cmvision, or other things. In the world file, I have a Pioneer2AT robot with a SonyVID30 camera, and a couple of SimpleSolids, one of which is a cylinder, with <color>0.0 0.0 1</color> (the others are not blue). Then, in the player file, I have driver ( name "gz_camera" provides ["camera:0"] gz_id "camera1" ) driver ( name "cmvision" provides ["blobfinder:0"] requires ["camera:0"] colorfile ["colorfile"] ) The client code I am trying is: PlayerClient robot = new PlayerClient("localhost", 6665); BlobfinderInterface bfi = new robot.requestInterfaceBlobFinder(0,'r'); short numBlobs = 0; bfi.setTrackingColor(0,0,0,0,250,255); while (true) { bfi.readData(); numBlobs = bfi.getBlobCount(); System.out.println("num blobs="+numBlobs); } I get different values back for num blobs (0, 10, 88, 4608, ...), and also sometimes in the client I get an "outofBounds" exception, "Error when reading payload: java.lang.ArrayIndexOutOfBoundsException: 256", I guess that the number of "detected" blobs might be too big. Anybody can help??? Many thanks, Alberto Amengual |
From: Radu B. R. <ru...@cs...> - 2005-12-16 09:49:20
Attachments:
smime.p7s
|
Hello Alberto, Sorry for replying so late (hmm, looks like I'm the only one actually doing that on this mailing list :)). I just uploaded a basic Blobfinder example to the Javaclient examples web page. Maybe that will help. Please modify your source code according to the following guidelines, and try again: - before the while (true), add a line like "robot.runThreaded (-1, -1);" - remove the "bfi.readData();" from the main while loop; - add a delay such as "try { Thread.sleep (100); } catch (Exception e) { }" in the main while loop. I don't know about Gazebo, but I will have a look. Best regards, Radu. -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen Alberto Amengual wrote: > Hello everybody, > > This is the first time I am using javaclient and also Player/Gazebo. I > am trying to detect a blue cylinder using blobfinder, but it's not > working. I don't know if my problem is the way I am using the java > client, or might be related with the color file in cmvision, or other > things. > > In the world file, I have a Pioneer2AT robot with a SonyVID30 camera, > and a couple of SimpleSolids, one of which is a cylinder, with > <color>0.0 0.0 1</color> (the others are not blue). > > Then, in the player file, I have > > driver > ( > name "gz_camera" > provides ["camera:0"] > gz_id "camera1" > ) > > driver > ( > name "cmvision" > provides ["blobfinder:0"] > requires ["camera:0"] > colorfile ["colorfile"] > ) > > The client code I am trying is: > > PlayerClient robot = new PlayerClient("localhost", 6665); > BlobfinderInterface bfi = new robot.requestInterfaceBlobFinder(0,'r'); > short numBlobs = 0; > bfi.setTrackingColor(0,0,0,0,250,255); > while (true) { > bfi.readData(); > numBlobs = bfi.getBlobCount(); > System.out.println("num blobs="+numBlobs); > } > > I get different values back for num blobs (0, 10, 88, 4608, ...), and > also sometimes in the client I get an "outofBounds" exception, > "Error when reading payload: java.lang.ArrayIndexOutOfBoundsException: > 256", I guess that the number of "detected" blobs might be too big. > > Anybody can help??? > > > > Many thanks, > > Alberto Amengual |
From: Alberto A. <ame...@IC...> - 2005-12-17 00:58:49
|
Hi Radu, Thanks a lot, now it works. If you have a minute to briefly explain the threading trick, that'd be great. Or maybe you can point me to some doc. A couple of notes: * I had to do the request for the blobfinder interface in mode 'r', mode 'a' causes a segmentation fault, so "BlobFinderInterface bfi = robot.requestInterfaceBlobfinder(0, 'r');" * I have tried to track a particular color, but it didn't work. For example for orange: "bfi.setTrackingColor(255,255,128,128,0,0)" but the blobs are still the same as without that line. I mean that's no big problem, then I just have to go through the blobs and look for the orange one. Probably that line is not enough, because on the client I get a "Need to handle a EAR message", and on the server "PlayerQueue::Push(): trying to push from non-allocated queue". Best, Alberto Radu Bogdan Rusu wrote: > Hello Alberto, > > Sorry for replying so late (hmm, looks like I'm the only one actually > doing that on this mailing list :)). I just uploaded a basic Blobfinder > example to the Javaclient examples web page. Maybe that will help. > > Please modify your source code according to the following guidelines, > and try again: > - before the while (true), add a line like "robot.runThreaded (-1, -1);" > - remove the "bfi.readData();" from the main while loop; > - add a delay such as "try { Thread.sleep (100); } catch (Exception e) { > }" in the main while loop. > > I don't know about Gazebo, but I will have a look. > > Best regards, > Radu. > |
From: Radu B. R. <ru...@cs...> - 2005-12-17 08:48:26
Attachments:
smime.p7s
|
Hi Alberto, The segmentation fault is on Player side. Hopefully v2.0 will not be that "picky" on this little details. :) I am not sure if the Gazebo part (changing the tracked color on the fly) is implemented. I know for a fact that it works fine with a CMUcam2 camera connected to Player, so it might be that the Gazebo driver is not supporting it properly. I'll have a look at Stage today and report later. Cheers, Radu. -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen Alberto Amengual wrote: > Hi Radu, > > Thanks a lot, now it works. If you have a minute to briefly explain > the threading trick, that'd be great. Or maybe you can point me to > some doc. > > A couple of notes: > > * I had to do the request for the blobfinder interface in mode 'r', > mode 'a' causes a segmentation fault, so > "BlobFinderInterface bfi = robot.requestInterfaceBlobfinder(0, 'r');" > > * I have tried to track a particular color, but it didn't work. For > example for orange: > "bfi.setTrackingColor(255,255,128,128,0,0)" but the blobs are still > the same as without that line. I mean that's no big problem, then I > just have to go through the blobs and look for the orange one. > Probably that line is not enough, because on the client I get a "Need > to handle a EAR message", and on the server "PlayerQueue::Push(): > trying to push from non-allocated queue". > > Best, > > Alberto > > > Radu Bogdan Rusu wrote: > >> Hello Alberto, >> >> Sorry for replying so late (hmm, looks like I'm the only one actually >> doing that on this mailing list :)). I just uploaded a basic >> Blobfinder example to the Javaclient examples web page. Maybe that >> will help. >> >> Please modify your source code according to the following guidelines, >> and try again: >> - before the while (true), add a line like "robot.runThreaded (-1, -1);" >> - remove the "bfi.readData();" from the main while loop; >> - add a delay such as "try { Thread.sleep (100); } catch (Exception >> e) { }" in the main while loop. >> >> I don't know about Gazebo, but I will have a look. >> >> Best regards, >> Radu. >> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > _______________________________________________ > Java-player-users mailing list > Jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-player-users |