Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 1.88 KB

README.md

File metadata and controls

72 lines (48 loc) · 1.88 KB

SweepJs

NodeJS Scanse Sweep LiDAR library.

Requires libsweep.so to be installed.

Quick Start

On Linux:

npm install
npm test

See the examples directory for an example streaming data from the device to the browser in real-time using a Websocket server.

On Windows:

The verison (x86 or x64) of the installed libsweep library must match the installed version of node-gyp. The provided binding.gyp file supports the default installation directories shown below.

Files Installation Directory (x64) Installation Directory (x86)
header files C:/Program Files/sweep/includes/sweep/ C:/Program Files (x86)/sweep/includes/sweep/
lib files C:/Program Files/sweep/lib/ C:/Program Files (x86)/sweep/lib/

If your installation path differs, modify the binding.gyp file.

Install module and run tests with your device's portname. For a device on com port 5:

npm install
node index COM5

Interface

sweep = new Sweep('/dev/ttyUSB0');

sweep.startScanning();
sweep.stopScanning();

// true if device is ready (calibration routine complete + motor speed stabilized)
ready = sweep.getMotorReady();
// integer value between 0:10 (in HZ)
speed = sweep.getMotorSpeed();
// integer value between 0:10 (in HZ)
sweep.setMotorSpeed(Number);

// integer value, either 500, 750 or 1000 (in HZ)
rate = sweep.getSampleRate();
// integer value, either 500, 750 or 1000 (in HZ)
sweep.setSampleRate(Number);

sweep.scan(function (err, samples) {
  handle(err);

  samples.forEach(function (sample) {
    use(sample.angle, sample.distance, sample.signal);
  });
});

sweep.reset();

License

Copyright © 2016 Daniel J. Hofmann

Distributed under the MIT License (MIT).