From: Leo N. <leo...@gm...> - 2009-04-14 08:04:23
|
If you get a "NullPointerException" you should also know which line it is thrown from. I guess it's thrown from the "while(lsri.isDataReady());" as lsri may be null if "robot.requestInterfaceLaser (0, PlayerConstants.PLAYER_OPEN_MODE);" is unable to locate the laser interface. Anyway try to get more info on the NullPointerException and post the whole stacktrace if you need more help. Bests Leo 2009/4/10 Skuld <tan...@ho...> > > What is your version of JavaClient? > > I don't work a lot on JavaClient, but I know that you have to call > (directly > or not) > a function whose name is Read() (PlayerClient in the c++ native library), > in > order to retrieve data from > Player/Stage, to fill up fields of your structure, and then you can reach > data by > functions like getRanges(). > So your first call of getRanges, "lsri.getData().getRanges();", can't fill > these fields. It's useless. > Maybe you have to call readAll() (of the class PlayerClient in javaClient) > if you're not in threaded > mode, or call runThreaded(0,0) if you implemented the Runnable interface. > Those functions will call > an equivalent of Read. > I guess that "isDataReady" doesn't ask a reading from Player/Stage, but > only check if, in the most recent data retrieved, there is data about > laser. > But you > still have to retrieve it. > > If it doesn't work, check your "robot" creation. Maybe it's your > nullpointer > error' source. > > Do you know the name of the function which cause the error? > > > kevinl wrote: > > > > Hi all, > > I don't know how to use the laserInterface, so I run the following code > > for a try: > > lsri = robot.requestInterfaceLaser (0, PlayerConstants.PLAYER_OPEN_MODE); > > while(lsri.isDataReady()); > > lnum=lsri.getData().getRanges_count(); > > lsri.getData().getRanges(); > > ldata=lsri.getData().getRanges(); > > > > I get the error of "NullPointerException". Could you advise me on how to > > use the laserInterface? And I am confused with the method "public void > > readData(PlayerMsgHdr header)" , how can I get a PlayerMsgHdr variable? > > > > Thanks a lot, > > kevin. > > > > > > -- > View this message in context: > http://www.nabble.com/Problems-with-laserinterface-tp22986701p22987951.html > Sent from the java-player-users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Java-player-users mailing list > Jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-player-users > -- ************************************** Leonardo Nomdedeu Calvente leo...@gm... |