From: Shane H. <sr...@ny...> - 2005-11-18 03:13:22
|
Hi everyone - I'm trying to get fiducials to work with stage 1.3.5, player 1.6.5, and the latest javaclient. My worldfile seems to be ok, since on the stage GUI I can see the little numbers that come up when a fiducial comes in range of the laser finder, but just for reference here's a robot from the worldfile: shane_pioneer( color "blue" name "robot1" port 6666 pose [3.753 7.901 -2.915 ] fiducial_id 88) Here is the function that updates the fiducials: /////////////////////////////////////////////// public void updateFid() { FiducialInterface fi = getFidInterface(); int numFids = fi.getFiducialCount(); boolean isReady = fi.isIDReady(); pl("numFids is " + numFids + " isReady " + isReady); if (numFids > 0 && isReady == true) { PlayerFiducialItem[] fs = fi.getFiducials(); for (PlayerFiducialItem fItem : fs) { if (fItem == null) { pl("Null fi!"); break; } else { pl (getName() + " fItem.id " + fItem.getID()); } } } } Here is an excerpt of what it outputs: ---- [Fiducial] : Error when reading payload: java.lang.NullPointerException [Fiducial] : Error when reading payload: java.lang.NullPointerException numFids is 2 isReady false numFids is 2 isReady false numFids is 2 isReady false [Fiducial] : Error when reading payload: java.lang.NullPointerException numFids is 2 isReady false [Fiducial] : Error when reading payload: java.lang.NullPointerException numFids is 2 isReady false numFids is 2 isReady false numFids is 2 isReady false [Fiducial] : Error when reading payload: java.lang.NullPointerException ---- I'm at a loss for what's going on. The numFids count is right - there are indeed two fiducial objects in range. If I move the robot around and get it out of range - so that numFids is 0 - all these NullPointerExceptions go away. (Note that these NullPointerException messages are coming in on stderr - it's javaclient generating them, not my code.) It's weird that javaclient/player knows there are 2 fids, but none of them ever get returned, and isReady is always false. (Note that if you take out the isReady == true test it prints out "Null fi!" every time - there's no fiducial info there.) Does anyone have any clue about what's going on? Advice of what I can try next? Working code samples that show how to work with the fiducial interface? Thanks a lot. Shane PS: In the interest of science, or karma, I'll donate all of my code to the javaclient project when I'm done with it, so newbies can have some working examples to look at. It's been really frustrating that there's so little actual working code available that does anything, not just for javaclient but for player/stage in general. I don't get it; this is open source, is it not? We're all about sharing here? |