bmegli / xv11lidar-test

Test for XV11 lidar (character/raw binary synchronized output)
GNU General Public License v3.0
6 stars 2 forks source link

XV11 LIDAR test

Preamble 1

This repository is phased out from ev3dev-mapping. Some information here may be not up-to-date for a while. Precisely: http://www.ev3dev.org/docs/tutorials/using-xv11-lidar/ was updated to always load dc-motor driver manually. This change is not reflected here yet. If you want to use this code with 2-wire soldered motor change the output port mode to dc-motor and use dc-motor instead of tacho-motor.

Preamble 2

Using this repository for anything apart from rough testing is not recommended. Especially redirecting continous binary output (you will have no way to tell when the communication fails and it fails sometimes). This implementation is also not resitant to losing sync with laser.

Overview

This is code for XV11 LIDAR test. The test outputs semicolon separated distance data for angles 0-359. The output can be redirected to file, transferred to PC and plotted.

If you just want simple C/C++ library to communicate with the LIDAR see xv11lidar repository.

LIDAR test

Instructions Assumptions

Building the xv11test

Instructions are for compiling the code directly on EV3 (get the files to EV3 and use ssh)

Running the test

Results plot

The file xv11plot.ods is Open Document Spreadsheet with the formulas for converting xv11test angle/distance output to 2D points graph. You can open xv11plot.ods in OpenOffice Calc, Microsoft Excel or any other software supporting Open Document Spreadsheets.

To make a plot:

See your own plot and note how to convert LIDAR angle/distance output and apply geometric correction in the spreadsheet

Example Plot

Alt text

Working with binary data

If you are working in C/C++ you can use xv11lidar library with functions InitLaser, ReadLaser and CloseLaser.

Warning - deprecated

See Preamble 2, using this repository in this way is not recommended.

If you don't feel comfortable with C/C++ code or don't want to write UART communication code, you can run xv11test with -raw argument and pipe its output to your application in any language.

See also examples subdirectory for C, C# and Java examples.

The xv11test syntax to get synchronized binary output is following:

xv11test terminal_device -raw [frames_per_read] [frames_limit]

Where:

By piping xv11test with -raw argument to your application you can read binary LIDAR data from your standard input.

Assumptions for those use cases are the same as before (port in other-uart mode, motor spinning, etc.)

Example 1 - 360 degree scan piped to other_program

./xv11test /dev/tty_in1 -raw | ./other_program

Or the same explicitly - read/write in chunks of 15 frames, limit to 90 frames (each 4 degrees):

./xv11test /dev/tty_in1 -raw 15 90 | ./other_program

Example 2 - 360 degree scan redirected to binary file

./xv11test /dev/tty_in1 -raw > scan360.bin

Example 3 - 360 degree scan redirected to binary file and used in other_program

./xv11test /dev/tty_in1 -raw > scan360.bin
./other_program < scan360.bin

Example 4 - continuous binary data piped to other_program

./xv11test /dev/tty_in1 -raw 15 0 | ./other_program