[go: up one dir, main page]

Skip to content

cansik/sweep-processing

Repository files navigation

Sweep for Processing Build Status Build status codebeat badge

Use the Scanse Sweep LIDAR with processing.

Introduction

Sweep for Processing is a port of the Scanse Sweep LIDAR library for processing. It gives you full access to the C API and adds some processing specfic methods to it.

Currently it is still under development and ONLY tested on MacOS.

LIDAR Example

Example of the LIDAR with FX2D

Example

Basic

To get sample data from the LIDAR sensor, you have to create a new SweepSensor and call the start method. The start method needs the path to the Sweep COM port.

import ch.bildspur.sweep.*;

SweepSensor sweep;

void setup()
{
  size(600, 300, FX2D);

  sweep = new SweepSensor(this);
  sweep.start("/dev/tty.usbserial-DO004HM4");
}

In draw you then just have to read the new samples from the device.

void draw()
{
	// do your stuff
	
	// read samples
	List<SensorSample> samples = sweep.getSamples()
	
	// do drawing
}

It is recommended to save the reference to the list of samples in a own variable and only use getSamples() once in a draw loop. Otherwise it is not guaranteed, that the samples are from the same scan (Concurrency).

Based on BasicExample

Asynchronous

With version 0.3 it is possible to start the device asynchronous and set the set the motor speed and sample rate through the constructor (thanks to @felixerdy).

import ch.bildspur.sweep.*;

SweepSensor sweep;

void setup()
{
  size(600, 300, FX2D);

  sweep = new SweepSensor(this);
  sweep.startAsync("/dev/tty.usbserial-DO004HM4", 5, 500);
}

It is recommended to use this method if the processing main thread should not be blocked by the start of the sweep device.

Based on AsyncExample