• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..28-Oct-2017-

examples/H28-Oct-2017-2721

.clang-formatH A D28-Oct-20172.6 KiB9189

.gitignoreH A D28-Oct-201733 43

README.mdH A D28-Oct-20171.9 KiB7348

binding.gypH A D28-Oct-20171.3 KiB3837

common.gypiH A D28-Oct-20171.1 KiB2928

package.jsonH A D28-Oct-2017352 2019

sweepjs.ccH A D28-Oct-20178.1 KiB278201

sweepjs.hH A D28-Oct-20171 KiB5330

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