Coder Social home page Coder Social logo

aztennenbaum / velodyne_decoder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valgur/velodyne_decoder

0.0 0.0 0.0 80 KB

C++/Python Velodyne packet decoder with minimal dependencies

License: BSD 3-Clause "New" or "Revised" License

CMake 3.59% C++ 88.62% Python 7.79%

velodyne_decoder's Introduction

velodyne_decoder PyPI Build

Python package and C++ library for Velodyne packet decoding. Intended as a light-weight substitute for the velodyne_driver in ROS with minimal external dependencies.

The resulting decoded data is provided as a structured NumPy array in Python and an array of structs in C++.

array([(8.327308, -2.161341, 0.3599853, 85., 17, -0.04960084),
       (8.323784, -2.9578836, 0.27016047, 102., 15, -0.04959854),
       (8.184404, -2.845847, -0.8741639, 39., 2, -0.04959623), ...,
       (8.369528, -2.8161895, 2.307987, 17., 31, 0.00064051),
       (8.377898, -3.2570598, 1.7714221, 104., 30, 0.00064282),
       (8.358282, -2.8030438, 0.31229734, 104., 16, 0.00064282)],
      dtype={'names': ['x', 'y', 'z', 'intensity', 'ring', 'time'],
             'formats': ['<f4', '<f4', '<f4', '<f4', '<u2', '<f4'], 'offsets': [0, 4, 8, 16, 20, 24], 'itemsize': 32})

The layout of the structs and the array is identical to the PointXYZIRT point clouds output by the ROS driver.

Installation

Wheels are available from PyPI for Linux, MacOS and Windows. Python versions 2.7 and 3.6+ are supported.

pip install velodyne-decoder

Alternatively, you can build and install the development version from source.

sudo apt-get install cmake build-essential python3-dev
pip install git+https://github.com/valgur/velodyne_decoder.git

Usage

Decoding Velodyne data from a ROS bag

from rosbag import Bag
import velodyne_decoder as vd

config = vd.Config()
config.model = '32C'
config.calibration_file = '/opt/ros/noetic/share/velodyne_pointcloud/params/VeloView-VLP-32C.yaml'
config.min_range = 0.3
config.max_range = 130
decoder = vd.ScanDecoder(config)

bagfile = 'xyz.bag'
lidar_topics = ['/velodyne_packets']
cloud_arrays = []
with Bag(bagfile) as bag:
    for topic, scan_msg, ros_time in bag.read_messages(lidar_topics):
        cloud_arrays.append(decoder.decode_message(scan_msg))

config.model and config.calibration_file are required. For a list of supported model IDs see

>>> velodyne_decoder.Config.SUPPORTED_MODELS
['VLP16', '32C', '32E', 'VLS128']

For the calibration file you can use the one provided with the velodyne driver matching your model.

Additional optional config parameters are min_range and max_range in meters and min_angle and max_angle in degrees.

Authors

  • Martin Valgur (@valgur) โ€“ this library.

The core functionality has been adapted from the ROS velodyne driver.

License

BSD 3-Clause License

velodyne_decoder's People

Contributors

valgur avatar aztennenbaum 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.