/vlp16-go

Go SDK for Velodyne VLP-16 LiDAR sensors.

Primary LanguageGoMIT LicenseMIT

VLP-16 Go

PkgGoDev GoReportCard Codecov

Go SDK for reading and parsing data from Velodyne VLP-16 (a.k.a. Puck) sensors.

Documentation

See the VLP-16 product page and the VLP-16 packet structure specification.

Installing

$ go get -u go.einride.tech/vlp16

Examples

Listen for VLP-16 packets

package main

import (
	"context"
	"fmt"
	"os"

	"go.einride.tech/vlp16"
)

func main() {
	if len(os.Args) < 2 {
		fmt.Println("usage: vlp16-listen <port>")
		os.Exit(1)
	}
	// Bind UDP packet listener.
	listener, err := vlp16.ListenUDP(context.Background(), fmt.Sprintf("0.0.0.0:%s", os.Args[1]))
	if err != nil {
		panic(err)
	}
	// Listen for and print packets.
	for {
		if err := listener.ReadPacket(); err != nil {
			panic(err)
		}
		fmt.Println(listener.SourceIP(), listener.Packet().ProductID)
		fmt.Println(listener.RawPacket())
		fmt.Println()
	}
}