Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 28-Oct-2017 | - | ||||
examples/ | H | 28-Oct-2017 | - | 27 | 21 | |
.clang-format | H A D | 28-Oct-2017 | 2.6 KiB | 91 | 89 | |
.gitignore | H A D | 28-Oct-2017 | 33 | 4 | 3 | |
README.md | H A D | 28-Oct-2017 | 1.9 KiB | 73 | 48 | |
binding.gyp | H A D | 28-Oct-2017 | 1.3 KiB | 38 | 37 | |
common.gypi | H A D | 28-Oct-2017 | 1.1 KiB | 29 | 28 | |
package.json | H A D | 28-Oct-2017 | 352 | 20 | 19 | |
sweepjs.cc | H A D | 28-Oct-2017 | 8.1 KiB | 278 | 201 | |
sweepjs.h | H A D | 28-Oct-2017 | 1 KiB | 53 | 30 |
README.md
1# SweepJs 2 3NodeJS Scanse Sweep LiDAR library. 4 5Requires `libsweep.so` to be installed. 6 7### Quick Start 8 9On Linux: 10 11```bash 12npm install 13npm test 14``` 15 16See the [examples](examples) directory for an example streaming data from the device to the browser in real-time using a Websocket server. 17 18On Windows: 19 20The 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. 21 22| Files | Installation Directory (x64) | Installation Directory (x86) | 23| ------------ | :--------------------------------------: | :--------------------------------------------: | 24| header files | C:/Program Files/sweep/includes/sweep/ | C:/Program Files (x86)/sweep/includes/sweep/ | 25| lib files | C:/Program Files/sweep/lib/ | C:/Program Files (x86)/sweep/lib/ | 26 27If your installation path differs, modify the `binding.gyp` file. 28 29Install module and run tests with your device's portname. For a device on com port 5: 30 31```bash 32npm install 33node index COM5 34``` 35 36 37### Interface 38 39```javascript 40sweep = new Sweep('/dev/ttyUSB0'); 41 42sweep.startScanning(); 43sweep.stopScanning(); 44 45// true if device is ready (calibration routine complete + motor speed stabilized) 46ready = sweep.getMotorReady(); 47// integer value between 0:10 (in HZ) 48speed = sweep.getMotorSpeed(); 49// integer value between 0:10 (in HZ) 50sweep.setMotorSpeed(Number); 51 52// integer value, either 500, 750 or 1000 (in HZ) 53rate = sweep.getSampleRate(); 54// integer value, either 500, 750 or 1000 (in HZ) 55sweep.setSampleRate(Number); 56 57sweep.scan(function (err, samples) { 58 handle(err); 59 60 samples.forEach(function (sample) { 61 use(sample.angle, sample.distance, sample.signal); 62 }); 63}); 64 65sweep.reset(); 66``` 67 68### License 69 70Copyright © 2016 Daniel J. Hofmann 71 72Distributed under the MIT License (MIT). 73