Giter Club home page Giter Club logo

fastestrplidar's Introduction

FastestRplidar MIT License No Maintenance Intended

A Fast Python Library (Helper) for the RPLidar A2 rangefinder scanners.

It is simple, lightweight, fast, Python module for working with RPLidar rangefinder scanners. Currently tested with only RPLidar A2, but should work with RPlidar A1 as well.

This library is an extension or a wrapper for the C++ Slamtec RPLIDAR Public SDK for use in a Python environment. The underlying code is based on C++, but a Python wrapper was generated using the popular SWIG interface. To add, edit or change the codebase, you will need to re-compile using the SWIG inteface.

The idea of using C++ for the underlying codebase is to give it the performance boost that was lacking in similar RPLidar Library.

You can read more about this library in my blog thehapyone - A Fast RPLidarA2 Python Library

Compatibility

  • Python 3. Won't work with Python 2 unless re-complied.
  • Works only with Raspberry Pis or any other ARM-based processor. To make it work with other platforms like Windows or Linux, you will need to re-compile the C++ code.

Note - Know Issues

If you have troubles making this work for your Raspberry PI, it is possible that you will need to re-compile the current binary or you can download the Originals release before new changes began to be introducded. That was definetely compiled for the ARM processor.

If you keep getting the error “wrong ELF class: ELFCLASS64” - This is because you are using a binary complied for a different host machine, you will have to re-compile again for your ARM device.

Supports

  • Supports reading health
  • Can fetch 360 degree scan at once
  • Connect motor and stop motor
  • Some level of compatibility with SkoltechRobotics RPLidar Library

Re-Compiling

Re-Compiling is easy and staight forward. You will require SWIG installed, and have the Slamtec RPLIDAR Public SDK for C++ available Not really needed, I have included the compiled static library file. To re-compile, go to the source directory and download the source files. Navigate to the source directory use the code below in terminal.

// generates the wrapper code. It will generate fastestrplidar_wrap.cxx
swig -c++ -python fastestrplidar.i
// Update the new library by running the setup.py with the below code
python3 setup.py build_ext --inplace

Installing

No special installation is needed. Just download the source code and unzip into your working directory.

Usage example

Simple example:

from myRplidar import RPlidar
# uses the default port ttyUSB0
lidar = RPlidar()

health = lidar.get_health()
print(health)

for i, scan in enumerate(lidar.iter_scans()):
    print('%d: Got %d measurments' % (i, len(scan)))
    if i > 10:
        break
        
# stops lidar and disconnect the driver
lidar.stopmotor()

In addition to it you can view example applications inside examples directory.

Future Changes

I don't intend to make new changes to this repository. It was a one-time project.

fastestrplidar's People

Contributors

purepani avatar thehapyone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.