On Thu, 22 Jul 2004, Jason Fleischer wrote:
> Recently on the Player discussion board you posted a method for getting
> 500kbps out of a SICK through and RS422/USB converter. At the end of your
> post you said
> > (4) Use your favorite piece of software (Player), and you"ve got laser
> scans at 75Hz.
> Currently I'm settomg up to use a SICK for the first time here. So this
> statement raises a question for me:
> How many scans / second would you get at 38.4kbps?
> It seems to me (from reading the manual) that to get a scan you send a
> command, wait for an ACK, and get a reply. Most of the total comm is the
> data, so at .5 deg resolution and 180 deg field of view you're looking at
> something under 400 bytes for transferring a scan. This would imply that
> even 38400 should give you 75Hz scan refresh.
> Although the SICK manuals state that "real-time measurement" can be had at
> 500kbps, nowhere that I can find does it mention what real-time means, i.e.,
> how many scans per second the device makes. Given the sound the device makes
> when operating, I find it had to believe that the mirror is only rotating at
> 75Hz So this raises the corrallary question:
> Is there a reduction in scan rate just due to the overhead of Player and the
> vagaries of serial communication? Is a faster communication rate necessary
> even to get 75Hz scan refresh?
(I'm CCing to the users' list, since this may be of general interest)
Commence brain dump:
The data rate you can expect from the laser is influenced by a number
of factors, but Player overhead is not one of them.
The mirror in the laser does in fact rotate at 75 Hz, so that's its
'natural' frequency. It can only sample once per degree, which means
the laser can generate a 180-degree scan, with resolution of 1 degree,
every 1/75th of a second.
If you want 0.5 degree resolution, the laser actually takes two scans at
1 degree resolution, with the second scan offset by 0.5 degrees, then
interlaces them to produce a single scan with 0.5 degree resolution.
This, of course, requires 1/37.5 seconds.
If you want 0.25 degree resolution, this interlacing requires 4 scans,
which takes 1/18.75 seconds. This mode is further complicated by the
fact that there's a limit of 401 readings per scan, so if you want 0.25
degree resolution, you also have to reduce the angular aperture to <=
So that's how fast the laser can generate scans. How fast can it shove
them down the serial line? Much slower than you might think.
A 180-degree scan, at 1-degree resolution, is 180 readings, at 2 bytes
per reading. That's 360 bytes. Assuming a perfect 38.4Kbps line with
zero overhead, you can send 360-byte packets at about 13.3Hz (remember
that the small 'b' in 'Kbps' means *bits*, not *bytes*):
38400 / 8.0 / 360.0 = 13.3
In practice, you see a data rate of between 10Hz and 12Hz, depending
on the quality of the serial cable. If you want 0.5 degree resolution,
then each scan is doubled in size, to around 720 bytes. The data rate is
correspondingly halved, so these packets can theoretically be sent over
a 38.4Kbps line at 6.67Hz. In practice, you see a rate of around 5Hz.
Now, if you have a 500Kbps RS422 line (e.g., using a USB-serial
converter), then the serial line is no longer the rate-limiting component.
You can get data as fast as the laser generates it. So, in 1-degree mode,
you'll get scans at 75Hz. In 0.5-degree mode, you'll get them 37.5Hz.
And so on.
A final note, specific to Player. Player sends data to clients at
a fixed, but configurable, rate. By default, this rate is 10Hz, but
it can be set by each client to match its needs. If your client wants
laser scans at, say 75Hz, and doesn't want to miss any, it must request
to receive data at a rate >= 75Hz. It's best in such a situtation to
request 100Hz, which is about as fast as Player can run on Linux (at
least with a 2.4 kernel).
Btw, I'm currently working through how to implement a new data delivery
mode that will send *all* data, regardless of how fast it's produced...
Brian P. Gerkey gerkey@...
Stanford AI Lab http://ai.stanford.edu/~gerkey