|Source:||LMSdemo.c [16 kB]|
LMS-200 is a 2-D laser scanner (Figure 1) manufactured by SICK optics. It is equipped with a Class 1 infrared laser and operated with the principle of time-of-flight. By putting a rotating mirror as shown in Figure 2, the laser scanner can scan at a fairly fast rate. It provides either 100 or 180 degree coverage with 0.25, 0.5 or 1.0 degree angular resolution. The range resolution is in the order of mm.
By default, SICK optics only distributes a demo program, which runs in Windows. Although the company has released the serial communication protocol, to ensure the unit works fine in Linux, it is handy to have a small utility program. Therefore, I decided to write my own demo program in C. The program is supposed to be ANSI C and POSIX compliant. Feel free to download the code and distribute it as you like.
I have access to a LMS200-30106 unit. However, the serial communication protocol for laser scanner in the same product family, e.g. LMS-220, LMS-211, LM-221, should be more or less the same. The electronics of the laser scanner can support fairly fast updating speed. The serial link is the bottle neck (if you don't buy their special 500kbps card). Therefore, it makes sense to use the fastest transfer mode (38400 bps) once after power up. On the other hand, it should be reset to the default of 9600bps after use. The SIGINT, SIGTERM etc are thus trapped to ensure the laser scanner is properly reset before quitting from the prorgram.
Starting from version 0.3.0, LMSdemo supports the 500k baud mode
via a USB to RS422 converter. Thanks for the contribution of
Knoedler along with a few other enhancements.
Figure 1: LMS-200.
Figure 2: Mirror mechanism of the LMS-200 laser scanner.
|Compile:||gcc -Wall -oLMSdemo LMSdemo.c|
Alternatively, you can this script that probes a number of configurations.