|
From: Shane H. <sr...@ny...> - 2005-10-20 02:47:58
|
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
|