|
From: Nils O. T. <no...@gm...> - 2005-10-20 08:13:59
|
Hi Shane,
I guess its related to the way you poll your data from the sensor, try
pc.runThreaded (-1, -1);
in the initialization section end delete the si.readData() stuff. As far
as I see from my working code its not necessary this way.
Hope this helps
Ole
Shane Hoversten wrote:
> Hi -
>
> I'm just starting work with playerclient using stage 1.3.5 and I'm
> encountering some really bizarre sonar readings. Here's a code snippet:
>
> ----
> ...
> SonarInterface si = pc.requestInterfaceSonar(0, 'r');
> ...
> while (yes == 1) {
> si.readData();
> int [] r = si.getRanges();
> System.out.println(r[0] + " " + r[1] + " " + r[2] +
> " " +
> r[3] + " " + r[4] + " " + r[5]);
>
> try { Thread.sleep(1000); }
> catch (InterruptedException e) {e.printStackTrace(); }
> }
> ----
>
> As you can see, all it's doing is reading sonar and printing out the
> first six values. The simulated robot that's executing this code is
> completely stationary. And yet, here's a chunk of the readings:
>
> ----
> 5000 5000 5000 5000 5000 5000
> 5000 5000 5000 5000 5000 5000
> 34835 34835 34816 0 0 0
> 4115 34835 34835 34835 34835 34835
> 0 0 0 0 0 0
> 5000 5000 5000 5000 5000 5000
> 0 0 25 0 0 0
> 0 0 0 0 0 0
> 5000 5000 5000 5000 5000 5000
> 5000 5000 5000 5000 5000 5000
> 5000 5000 5000 5000 5000 5000
> 5000 5000 5000 5000 5000 5000
> 5000 5000 5000 5000 5000 5000
> ----
>
> As you can see, I'm getting lots of weird bouncing around. The robot is
> stationary, so the readings shouldn't change (especially since this
> example has the robot in the middle of empty space.) When I execute the
> same program with the same stage world using the C++ client the readings
> are rock steady.
>
> Does anyone know what's going on? Do I need to be checking the status of
> the sonar and waiting for it to be ready or something? (Since there are
> virtually no examples available I'm doing this by looking at the c++
> code that comes with player and trying to backport it. Some real
> examples would be REALLY useful.)
>
> Thanks,
>
> Shane
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Java-player-users mailing list
> Jav...@li...
> https://lists.sourceforge.net/lists/listinfo/java-player-users
>
>
|