# problem with visualizing laserscan message on android

Hi,

I am trying to visualize laserscan message on android according to the ros_android_teleop_tutorial. However, what I got was always a dotted diagonal no matter what bag file I use.

I try to modify LaserScanLayer and log the vertices I receive. I do it like this:

String msg = "";
...
public void onNewMessage(LaserScan laserScan) {
...
for (int i = 0; i < ranges.length; i++) {
...
msg += "(" + vertices[3 * i + 3] + "," + vertices[3 * i + 4] + "," + vertices[3 * i + 5]+ ")\n";
...
}
Log.i(TAG, msg);
}


However, according to the log, it seems that the program can not go through the whole for loop, but been cut rudely in the midway. If the ranges.length is 380, only about half of it can be logged, which is shown in the msg log below.

Each complete msg looks like the following, at the end of which we can see that the msg is cut rudely :

06-11 10:09:24.197: I/LaserScan(664): (-1.7374197,-1.7374197,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7249954,-1.7553679,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-13.893168,-14.386794,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-13.767094,-14.507485,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-13.63997,-14.627071,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-2.1781359,-2.3770168,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-2.1432586,-2.3803282,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-2.102527,-2.3764727,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-2.0666199,-2.3773723,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-2.0302088,-2.3770669,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.992676,-2.3747764,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.9540671,-2.3704703,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.988056,-2.4550416,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.9603313,-2.4644709,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.9011965,-2.433417,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.8567567,-2.4197686,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.838579,-2.4398727,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7981837,-2.4301014,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7833744,-2.4545996,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.781049,-2.4969337,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7838547,-2.5476031,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7944058,-2.6108708,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7983943,-2.6662228,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7899609,-2.704329,0.0)
06-11 10:09:24.197: I/LaserScan(664): (-1.7951585,-2.7642944,0.0)
06-11 10:09 ...
edit retag close merge delete

The vertices should be okay if you look at the coordinates (they lie not on a line)! Regarding the limited log you might ran into maximum log size (does that exist?) or the thread got interrupted? .. As I am working also on visualizing Laserscans: Do you experience a delay on your method calls?

( 2012-06-11 03:13:14 -0500 )edit

Hi, thanks for the answer. The weird thing is that sometimes there will be some big blue triangles on the screen, which doesn't look like what I want. Do you also have something like that?

( 2012-06-11 10:42:38 -0500 )edit

As for the delay, right now I am developing on the emulator now, the performance is not good, what i am doing now is just present the laser scan on screen. So I am not sure about your question. Or can you specify more what kind of delay is that?

( 2012-06-11 10:46:11 -0500 )edit

The visualization tutorial normally takes laserscan messages, converts the range values with their angles into vertices and draws a blue triangle-fan with opengl.

( 2012-06-18 00:59:31 -0500 )edit

Regarding the delay: I was reading lasercan msgs at 40Hz and the device couldn't cope with that amount because of performance issues in rosjava, which means that messages came in faster than they can be processed! I could resolve it somewhat by using different different string processing methods.

( 2012-06-18 00:59:40 -0500 )edit

Sort by » oldest newest most voted

As I thought you most likely ran into the limit of maximum length Logcat messages -> http://stackoverflow.com/questions/8888654/android-set-max-length-of-logcat-messages

more