BreezyLidar - Simple, efficient, Lidar access in Python and C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
c
cpp
examples
python Throws exception on init failure. Sep 23, 2014
.gitignore
LICENSE.md
README.md

README.md

BreezyLidar

BreezyLidar - Simple, efficient, Lidar access for Linux computers in Python and C++

This repository contains everything you need to start working with the popular Hokuyo URG-04LX Lidar unit on your Linux computer. It is designed for robotics applications on a single-board Linux computer like RaspberryPi or ODROID.

BreezyLidar was inspired by the Breezy approach to Graphical User Interfaces developed by my colleague Ken Lambert: an object-oriented Application Programming Interface that is simple enough for beginners to use, but that is efficient enough to scale-up to real world problems. As shown in the following code fragment, the API is extremely simple: a constructor that accepts the port (device) name on which the unit is connected, and method for accessing the scans (range values):

from breezylidar import URG04LX

laser = URG04LX('dev/tty/ACM0')

while True:

scan = laser.getScan()

# do something with scan, like SLAM

Installing for Python

The BreezyLidar installation uses the popular distutils approach to installing Python packages, so all you should have to do is download the repositry, cd to the directory where you put it, and do

sudo python3 setup.py install

For a quick demo, you can then cd to examples and do

make test

This will attempt to connect to the Lidar, print out some information about it, and read 20 scans. I've found that it can take up to half a minute for the URG-04LX to be ready after plugging in its USB cable, so it's best to wait a little between plugging it in and running the program. Depending on how your system is configured, you may need to run the program as root:

sudo make test

or you may need to change the DEVICE specified at the top of urgtest.py to /dev/ttyACM1 or whatever file your URG-04LX maps to.

If you have the Python Tkinter package installed, you can do

python3 urgplot.py

to see a real-time plot of the scans.

To see what other features are available, do

pydoc breezylidar

Installing for C++

Just cd to the cpp directory, and do

sudo make install

This will put the libbreezylidar shareable library in your /usr/local/lib directory. If you keep your shared libraries elsewhere, just change the LIBDIR variable at the top of the Makefile.

For a quick demo, you can then cd to breezylidar/examples and do

make cpptest

Again, you'll need to change the LIBDIR variable at the top of the Makefile in this directory as well, if you don't use /usr/local/lib. You should also have this lib directory in your LD_LIBRARY_PATH environment variable. I do this by putting the following line in my ~/.bashrc file:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

To see what other features are available, go back to the cpp directory and do

make doc

and then open Documentation/html/index.html in a web browser.

Copyright, licensing, and questions

Copyright and licensing information (Gnu LGPL) can be found in the header of each source file. If you have another Lidar model and are interested using BreezyLidar with it, or have any other questions, please contact me.

Acknowledgments

This work was supported in part by a Commonwealth Research Commercialization Fund grant from the Center for Innovative Technology (CRCF #MF14F-011-MS).