Giter Site home page Giter Site logo

node-rolling-spider's Introduction

Rolling Spider for Node.js

An implementation of the networking protocols (Bluetooth LE) used by the Parrot MiniDrone - Rolling Spider and Airborne Night Drone - MACLANE. This offers an off-the-shelf $99 USD drone that can be controlled by JS -- yay!

Prerequisites:

To install:

npm install rolling-spider

Status

Stable!

Getting Started

There are a few steps you should take when getting started with this. We're going to learn how to get there by building out a simple script that will take off, move forward a little, then land.

Connecting

To connect you need to create a new Drone instance.

var RollingSpider = require("rolling-spider");
var rollingSpider = new RollingSpider();

After you've created an instance you now have access to all the functionality of the drone, but there is some stuff you need to do first, namely connecting, running the setup, and starting the ping to keep it connected.

var RollingSpider = require("rolling-spider");
var rollingSpider = new RollingSpider();

// NEW CODE BELOW HERE

rollingSpider.connect(function() {
  rollingSpider.setup(function() {
    rollingSpider.flatTrim();
    rollingSpider.startPing();
    rollingSpider.flatTrim();
    console.log('Connected to drone', rollingSpider.name);
  });
});

Taking off, moving, and landing

We're now going to create a function that takes a drone and then by using a sequence of temporal tasks creates a timed sequence of calls to actions on the drone.

We recommend using temporal over a series of setTimeout chained calls for your sanity. Please abide by this when playing with the drone and ESPECIALLY if filing a ticket.

'use strict';

var RollingSpider = require('rolling-spider');
var temporal = require('temporal');
var rollingSpider = new RollingSpider();

rollingSpider.connect(function() {
  rollingSpider.setup(function() {
    rollingSpider.flatTrim();
    rollingSpider.startPing();
    rollingSpider.flatTrim();

    temporal.queue([
      {
        delay: 5000,
        task: function () {
          rollingSpider.takeOff();
          rollingSpider.flatTrim();
        }
      },
      {
        delay: 3000,
        task: function () {
          rollingSpider.forward({steps: 12});
        }
      },
      {
        delay: 5000,
        task: function () {
          rollingSpider.land();
        }
      },
      {
        delay: 5000,
        task: function () {
          temporal.clear();
          process.exit(0);
        }
      }
    ]);
  });
});

Done!

And there you have it, you can now control your drone.

Flying Multiple MiniDrones

Spider Swarm

Previous versions of the rolling-spider library required you to specify the UUID for your drone through a discover process. This has been removed in favor of just using the first BLE device that broadcasts with "RS_" as its localname. If you are flying multiple minidrones or in a very populated BLE area, you will want to use the discovery process in order to identify specifically the drone(s) you want to control. Use the Discovery Tool to get the UUID of all nearby BLE devices.

If you want to fly multiple drones at once, please use the Swarm API for that. An example of the swarm, as well as other examples, is available in the eg/ directory. Source Code Sample

Client API

RollingSpider.createClient([options]) or new RollingSpider([options])

Options

  • uuid: The uuid (Bluetooth UUID) or the Published Name (something like RS_XXXXXX) of the drone. Defaults to finding first announced. Can be a list of uuids that are separated by a comma (in the case of a string) or as an array of strings.
  • logger: The logging engine to utilize. Defaults to debug, but you could provide console.log or other similar logging system that can accept strings and output them.
  • forceConnect: When set to true, this will not wait for the bluetooth module to settle. This is necessary for some known use cases.

client.connect([callback])

Connects to the drone over BLE. callback is invoked when it is connected or receives an error if there is a problem establishing the connection.

client.setup([callback])

Sets up the connection to the drone and enumerate all of the services and characteristics. callback is invoked when setup completes or receives an error if there is a problem setting up the connection.

client.on('battery', callback)

Event that is emitted on battery change activity. Caution, battery drains pretty fast on this so this may create a high velocity of events.

client.takeoff(callback) or client.takeOff(callback)

Sets the internal fly state to true, callback is invoked after the drone reports that it is hovering.

client.land(callback)

Sets the internal fly state to false, callback is invoked after the drone reports it has landed.

client.up([options], [callback]) / client.down([options], [callback])

Options

  • speed at which the drive should occur, a number from 0 to 100 inclusive.
  • steps the length of steps (time) the drive should happen, a number from 0 to 100 inclusive.

Makes the drone gain or reduce altitude. callback is invoked after all the steps are completed.

client.clockwise([options], [callback]) / client.counterClockwise([options], [callback]) or client.turnRight([options], [callback]) / client.turnLeft([options], [callback])

Options

  • speed at which the rotation should occur
  • steps the length of steps (time) the turning should happen, a number from 0 to 100 inclusive.

Causes the drone to spin. callback is invoked after all the steps are completed.

client.forward([options], [callback]) / client.backward([options], [callback])

  • speed at which the drive should occur, a number from 0 to 100 inclusive.
  • steps the length of steps (time) the drive should happen, a number from 0 to 100 inclusive.

Controls the pitch. callback is invoked after all the steps are completed.

client.left([options], [callback]) / client.right([options], [callback]) or client.tiltLeft([options], [callback]) / client.tiltRight([options], [callback])

  • speed at which the drive should occur, a number from 0 to 100 inclusive.
  • steps the length of steps (time) the drive should happen, a number from 0 to 100 inclusive.

Controls the roll, which is a horizontal movement. callback is invoked after all the steps are completed.

client.frontFlip([callback])

Causes the drone to do an amazing front flip.

client.backFlip([callback])

Causes the drone to do an amazing back flip.

client.leftFlip([callback])

Causes the drone to do an amazing left flip. DO NOT USE WITH WHEELS ON!!!

client.rightFlip([callback])

Causes the drone to do an amazing right flip. DO NOT USE WITH WHEELS ON!!!

client.takePicture([callback])

Causes the drone to take a picture with bottom camera.

client.calibrate([callback]) or client.flatTrim([callback])

Resets the trim so that your drone's flight is stable. It should always be called before taking off.

client.signalStrength(callback)

Obtains the signal strength as an RSSI value returned as the second parameter of the callback.

client.disconnect([callback])

Disconnects from the drone if it is connected.

client.emergancy([callback]) or client.emergency([callback])

Causes the drone to shut off the motors "instantly" (sometimes has to wait for other commands ahead of it to complete... not fully safe yet)

Swarm API

If you have more than one (or ten) Rolling Spiders, you will eventually want to control them all as a single, somewhat unified swarm. This became such a common request, we made it part of the API for the RollingSpider. This will allow you to initialize a set of members, defined or otherwise, and broadcast commands to them all at once.

Common implementation boilerplate

var Swarm = require('rolling-spider').Swarm;
var swarm = new Swarm({timeout: 10});

swarm.assemble();

swarm.on('assembled', function () {
  // For The Swarm!!!!!
});

new Swarm(options)

Options (anything additional is passed on to individual members upon initialization)

  • membership: The uuid(s) or the Published Name(s) of the drone that are members of the swarm. If left empty/undefined, it will find any and all Rolling Spiders it can possibly find.
  • timeout: The number of seconds before closing the membership forcibly. Use this to ensure that membership enrollment doesn't last forever.
  • forceConnect: When set to true, this will not wait for the bluetooth module to settle. This is necessary for some known use cases.

swarm.assemble([callback])

Initiates the swarm collection process. This will attempt to seek out bluetooth RollingSpiders that have been identified in the membership or isMember validation components and enrolls them into the swarm.

swarm.closeMembership([callback])

Stops the open membership process and sets the swarm to active.

swarm.at(id, [callback])

Returns (or executes provided callback) with the swarm member that has the provided id value for localName or UUID. Use this to issue commands to specific drones in the swarm.

swarm.isMember(device)

Returns true if the provide device should be admitted as a member of the swarm or false if it should be ignored. Can be overridden for more complex membership definition.

swarm.release([callback])

Releases all of the drones from the swarm.

Broadcasted Commands e.g. swarm.takeOff([options], [callback])

All other commands for the swarm follow the command structure of an individual RollingSpider and it is broadcast to all roughly at the same time (bluetooth isn't always exact.) The signature is the same for all of the commands and passes options and a callback to the function.

node-rolling-spider's People

Contributors

abadi199 avatar aredridel avatar brianarn avatar caccialdo avatar christhebaron avatar dancunnington avatar deadprogram avatar garetht avatar girliemac avatar gorhgorh avatar kevinold avatar lynnaloo avatar marianodominguez avatar mcollina avatar midnightsuyama avatar n0bisuke avatar pavelbely avatar reconbot avatar resseguie avatar rwaldron avatar sandeepmistry avatar shiva02 avatar speixoto avatar voodootikigod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-rolling-spider's Issues

Bluetooth issue on High Sierra preventing takeoff after landing.

Hi hi hi!
I'm using MacOS High Sierra 10.13.2
Noble does not work currently from the master branch for High Sierra. To work around this, there is a pull request open with High Sierra support: noble/noble#689
This is working ok to control the drone and take off, however, after landing, it will not take off again. It seems that the Noble High Sierra pull request does not register notifications correctly.

I have confirmed that isNotification being passed to .getCharacteristic is always false on the High Sierra Pull Request. When isNotification is always false, node-rolling-spider will not emit flyingStatusChange on lines 285-291. This keeps the state of flying to false after it lands and prevents take off. When I comment out lines 287-290, or manually set this.status.flying = false in the land function, then it will take off and land and take off again.
https://github.com/voodootikigod/node-rolling-spider/blob/master/lib/drone.js#L285-L291

I don't know enough about how bluetooth works inside the Noble library to fix this registration of notifications. I also don't understand what the isNotification check is used for and why I can comment it out and it seems to be ok?

Thanks everyone!

Not all membership take off

Re,

All the member does not take off.

This is my swarm var :
"var swarm = new Swarm({membership:'RS_A112233,RS_B112233,RS_C112233',timeout: 10});
I can not control all the drones, only one of them takes off and not necessarily the same at each execution. Can you help me again ?

Thanks a lot

Shiva02

Free fall take-off

Do any of you have any idea if it is possible to add a support for free fall take-off? The app has this feature, so it should be also possible to access/implement. Any kind of help would be appreciated.

Thanks!

camera support?

would be nice to have api to access a camera. Not sure if firmware supports live data transfer ( still or video) but at least "grab a picture and save it" api. Happy to submit a code if anyone managed to document / dump camera commands.

subsequent members of swarm is not a member

rollingspider RollingSpider.Swarm#assemble +0ms
rollingspider RollingSpider Swarm Assemble: Mambo_524131, Mambo_524140, Mambo_524144 +3ms
rollingspider RollingSpider.on(stateChange) +2ms
rollingspider RollingSpider#poweredOn +214ms
rollingspider RollingSpider.Swarm#assemble.on(discover) +67ms
rollingspider RollingSpider.Swarm#isMember +1ms
rollingspider EST is not a member +0ms
rollingspider RollingSpider.Swarm#assemble.on(discover) +187ms
rollingspider RollingSpider.Swarm#isMember +0ms
rollingspider Mambo_524140 is not a member +0ms
1: Mambo_524140 (e249e7b866ec48aba569b7173872b419), RSSI -62
rollingspider RollingSpider.Swarm#assemble.on(discover) +275ms
rollingspider RollingSpider.Swarm#isMember +0ms
rollingspider undefined is not a member +1ms
rollingspider RollingSpider.Swarm#assemble.on(discover) +1s
rollingspider RollingSpider.Swarm#isMember +0ms
rollingspider Mambo_524144 is not a member +0ms
2: Mambo_524144 (6090d4c686924d55bb2825f43cce59cb), RSSI -48
rollingspider RollingSpider.Swarm#assemble.on(discover) +2ms
rollingspider RollingSpider.Swarm#isMember +0ms
rollingspider Mambo_524131 is a member +0ms
3: Mambo_524131 (1635255bfc794b4f8fe37d0f2c4663c5), RSSI -55
rollingspider Mambo_524131 is connected +353ms
rollingspider RollingSpider#setup +1ms
rollingspider RollingSpider#handshake +1s
rollingspider Mambo_524131 is setup +214ms
rollingspider RollingSpider#flatTrim +0ms
rollingspider RollingSpider#startPing +1ms
rollingspider 1/3 +1ms
rollingspider Flying status: undefined +357ms

Only the first declared member of the membership is recognised as a member of the swarm. Subsequent members the string is not a member.

Why does not proceed?

I have recently begun to try this project which is very good.

I runned the sample code written in README.md, but cannot proceed.
It not come back from this.peripheral.discoverAllServicesAndCharacteristics in Drone.prototype.setup method on lib/drone.js.
Above this method, I added the code 'console.log(this);', and got data.

++++++
peripheral:
{ _noble:
{ state: 'poweredOn',
_bindings: [Object],
_peripherals: [Object],
_services: [Object],
_characteristics: [Object],
_descriptors: [Object],
_events: [Object],
_discoveredPeripheralUUids: [Object],
_allowDuplicates: undefined },
uuid: 'xxxxxxxxxxx',
address: 'xx:xx:xx:xx:xx:xx',
advertisement:
{ localName: 'RS_xxxx',
txPowerLevel: undefined,
manufacturerData: ,
serviceData: [],
serviceUuids: [] },
rssi: -30,
services: null,
state: 'connected',
_events: {} },
++++++

So, I think that I could connect to rolling-spider, but terminal console don't come back from discoverAllServicesAndCharacteristics method.
"services: null" has filed a cause?
I tryed to replace 'discoverAllServicesAndCharacteristics' method to 'discoverServices' , it has been able to get the service.

++++++
Found device with local name: RS_xxxx
connected to peripheral: xxxxxxxxxxx
discovered the following services:
0 uuid: 1800
1 uuid: 1801
++++++

I tryed the version 0.1.1, 1.0.0, 1.0.9.

Regards.

Drone status

Hi,

I'm using the latest version on a Swat drone.
The main problem is that connecting to a drone which is already flying is working well, but always shows flying is 'false'. Example:
{"status": {"flying": false, "stateValue": 0, "battery": 32}

Since the drone is in the air, this is wrong...

Thanks,
DD.

Can get info about drone, cannot 'connect' to drone?

Hi, first post, I hope I don't make too many mistakes.

I've installed your great lib, but can't seem to get control of my rolling spider. For example,

$ node node_modules/rolling-spider/eg/keyboard.js

just hangs. With debug output I see:

rollingspider RollingSpider#connect +0ms
  rollingspider RollingSpider.on(stateChange) +3ms
  rollingspider RollingSpider#poweredOn +9ms
  rollingspider RollingSpider.on(discover) +38ms
  rollingspider Peripheral { _noble: Noble { state: 'poweredOn', _bindings: EventEmitter { _state: 'poweredOn', _addresses: [Object], _addresseTypes: [Object], _connectable: [Object], _pendingConnection: false, _connectionQueue: [], _handles: {}, _gatts: {}, _aclStreams: {}, _hci: [Object], _gap: [Object], _events: [Object], _eventsCount: 20, onSigIntBinded: [Function: bound ], _scanServiceUuids: [] }, _peripherals: { e0145e22[redacted]: [Circular] }, _services: { e0145e22[redacted]: {} }, _characteristics: { e0145e22[redacted]: {} }, _descriptors: { e0145e22[redacted]: {} }, _discoveredPeripheralUUids: [ 'e0145e22[redacted]' ], _events: { warning: [Object], discover: [Function: bound ], stateChange: [Function: bound ] }, _eventsCount: 3, _allowDuplicates: undefined }, id: 'e0145e22[redacted]', uuid: 'e0145e22[redacted]', address: 'e0:14:5e:22:3d:6a', addressType: 'random', connectable: true, advertisement: { localName: 'RS_W023[redacted]', txPowerLevel: undefined, manufacturerData: <Buffer 43 00 cf 19 00 09 01 00>, serviceData: [], serviceUuids: [] }, rssi: -44, services: null, state: 'disconnected' } +0ms
  rollingspider RS_W023[redacted] +19ms
  rollingspider Fuzzy match found: RS_W023[redacted] <e0145e22[redacted]> +0ms
  rollingspider RollingSpider#down +4s
  rollingspider RollingSpider#down when it's not in the air isn't going to do anything +1ms

Sorry if the redacting makes the output useless, I'm not sure how much of that info you need, nor which is actually unique.

I've tried turning it (the drone) off and on again, to no avail.

Thanks for any help you might be able to offer me.

"You must have bluetooth enabled and be connected to a drone" error

Not sure if this repo is active but giving this a try:
I'm running this in Ubuntu 16.04 64.
Installed all pre-reqs.
connected ubuntu to the Maclane drone
then ran the discover.js with sudo in a terminal
got noble: unknown peripheral <addr> connected
immediately after got noble: unknown peripheral <addr> disconnected
then i ran sudo node reconnect.js in a different terminal (reconnect.js is a bit modified to just do the take off and landing)

i get the following error:

Prepare for take off!  Maclan_033049
/home/remzi/Desktop/workspace/node-rolling-spider/lib/drone.js:342
      throw e;
      ^

Error: You must have bluetooth enabled and be connected to a drone before executing a command. Please ensure Bluetooth is enabled on your machine and you are connected.
    at Drone.writeTo (/home/remzi/Desktop/workspace/node-rolling-spider/lib/drone.js:338:13)
    at Drone.flatTrim (/home/remzi/Desktop/workspace/node-rolling-spider/lib/drone.js:631:8)
    at /home/remzi/Desktop/workspace/node-rolling-spider/eg/reconnect.js:17:9
    at Drone.<anonymous> (/home/remzi/Desktop/workspace/node-rolling-spider/lib/drone.js:144:11)
    at Peripheral.<anonymous> (/home/remzi/Desktop/workspace/node-rolling-spider/node_modules/noble/lib/peripheral.js:38:7)
    at Peripheral.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at Peripheral.emit (events.js:188:7)
    at Noble.onConnect (/home/remzi/Desktop/workspace/node-rolling-spider/node_modules/noble/lib/noble.js:151:16)
    at emitTwo (events.js:106:13)

Am i missing something?

takeOff never completes

Calling yourDrone.takeOff() never seems to complete or invoke its callback. My drone does take off, hovering a couple of feet off the floor, and stays there as the script hangs.

Cannot call method 'discoverAllServicesAndCharacteristics' of null

OS X 10.9.5
XCode Version 6.2 (6C131e)
Node v0.10.34

Code: (ping.js)

var RollingSpider = require("rolling-spider");
var myDrone = new RollingSpider();

myDrone.connect(function() {
  myDrone.setup(function() {
    myDrone.startPing();
  });
});

Full error: (node ping)

/Users/Resseguie/Documents/drone/node_modules/rolling-spider/lib/drone.js:216
  this.peripheral.discoverAllServicesAndCharacteristics(function (error, servi
                  ^
TypeError: Cannot call method 'discoverAllServicesAndCharacteristics' of null
    at Drone.setup (/Users/Resseguie/Documents/drone/node_modules/rolling-spider/lib/drone.js:216:19)
    at /Users/Resseguie/Documents/drone/ping.js:5:11
    at null.<anonymous> (/Users/Resseguie/Documents/drone/node_modules/rolling-spider/lib/drone.js:188:11)
    at Noble.emit (events.js:95:17)
    at Noble.onStateChange (/Users/Resseguie/Documents/drone/node_modules/rolling-spider/node_modules/noble/lib/noble.js:66:8)
    at emit (events.js:95:17)
    at nobleBindings.startScanning.args.kCBMsgArgOptions (/Users/Resseguie/Documents/drone/node_modules/rolling-spider/node_modules/noble/lib/mac/mavericks.js:73:8)
    at emit (events.js:95:17)
    at nobleBindings.sendCBMsg.sendXpcMessage.kCBMsgId (/Users/Resseguie/Documents/drone/node_modules/rolling-spider/node_modules/noble/lib/mac/mavericks.js:43:8)
    at emit (events.js:95:17)

I tried with both the npm version of rolling-spider and the latest from the voodootikigod/node-rolling-spider repo. No errors on npm install.

Is the latest version of XCode (and thus Yosemite) required?

Error when trying to run flip commands

On latest master (1.2.1) I receive the following error when issuing a flip command from eg/keyboard.js.

Below is the output:

Configured for Rolling Spider! RS_R107537
ready for flight
takeoff
takeoff
takeoff

/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/characteristic.js:60
callback(null);
^
TypeError: object is not a function
at Characteristic. (/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/characteristic.js:60:7)
at Characteristic.g (events.js:180:16)
at Characteristic.emit (events.js:92:17)
at Noble.onWrite (/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/noble.js:279:20)
at emit (events.js:106:17)
at nobleBindings.write (/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/mac/yosemite.js:550:10)
at Noble.write (/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/noble.js:272:19)
at Characteristic.write (/Users/kold/github_clones/node-rolling-spider/node_modules/noble/lib/characteristic.js:64:15)
at Drone.writeTo (/Users/kold/github_clones/node-rolling-spider/lib/drone.js:342:49)
at frontFlip (/Users/kold/github_clones/node-rolling-spider/lib/drone.js:605:10)

Minor code cleanup commit has issues with "has no method startsWith"

TypeError: Object Mars_025763 has no method 'startsWith'
TypeError: Object Mars_025763 has no method 'startsWith'
  at Function.Drone.isDronePeripheral (/Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/lib/drone.js:94:19)
  at [object Object].<anonymous> (/Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/lib/drone.js:133:25)
  at Noble.emit (events.js:95:17)
  at Noble.onDiscover (/Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/node_modules/noble/lib/noble.js:144:10)
  at [object Object].emit (events.js:106:17)
  at [object Object].<anonymous> (/Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/node_modules/noble/lib/mac/yosemite.js:181:12)
  at /Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/node_modules/noble/lib/mac/uuid-to-address.js:22:5
  at tryParseBuffer (/Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/node_modules/noble/node_modules/bplist-parser/bplistParser.js:25:5)
  at /Users/moheebzara/Projects/Plugins/meshblu-rolling-spider/node_modules/rolling-spider/node_modules/noble/node_modules/bplist-parser/bplistParser.js:33:7
  at fs.js:272:14
  at Object.oncomplete (fs.js:108:15)

support for Parrot Mambo?

Discover.js does not see the Parrot Mambo minidrones. Are there any modifications i can do to make Mambo discoverable?

Requires reboot after running script

First of all thanks for working on this... great job 👍 I will be using it in a @nodeschool talk this Saturday.

I've noticed that you seem to need to remove the battery after each successful connection, are you able to close the connection so that it may be reopened again?

Drone not flying...

I used the discover.js program to discover my rolling spider, then ran a test program. Node.js cmd prompt shows that the program is running, and there no errors, but still the drone won't take off. I've tried this program with my rolling spider before, and it has worked, meaning there is no fault within the program. However, it is inconsistent and only sometimes takes off. I've waited 5 minutes before for the drone to do something, but still no reaction. Whats more, after i kill the program since the drone doesn't take off, and try to run it again, it gives me a "noble warning, unknown peripheral exxxxxxxxxxxx. Please help as i enjoyed the flights with the rolling spider the times it did work.

How to connect several drones

Hi everyone, i try to take off 2 rolling spider at the same time by creating two instances and by specifying their uuid but the program sequence is random, sometimes drone 1 and sometimes drone 2, the other times both. Can you help me, can i have a simple example?
Thanks, best regards

Seb V

Fails to install with Node 10 due to logitech-dual-action-controller

Error Report

When attempting to npm install rolling-spider with Node 10, the optional logitech-dual-action-controller dependency causes a failure due to it's reliance on the node-hid package

https://github.com/voodootikigod/node-rolling-spider/blob/master/package.json#L61-L63
https://github.com/olizilla/node-logitech-dual-action-controller/blob/master/package.json#L16

The logitech-dual-action-controller package is needed to power the Logitech Dual Action Controller utilized within gamepad.js however this is not critical for connectivity to Parrot Mini Drones. Can this be abstracted to a plugin?

Setup

╰─ node -v
v10.14.1
╰─ npm -v
6.4.1

Error Dump

─ npm install rolling-spider

> [email protected] install /Users/jon/Side/personal/dev-setup/node_modules/node-hid
> node-gyp rebuild

  CC(target) Release/obj.target/hidapi/hidapi/mac/hid.o
../hidapi/mac/hid.c:255:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if (chars_copied == len)
                    ~~~~~~~~~~~~ ^  ~~~
../hidapi/mac/hid.c:295:20: warning: comparison of integers of different signs: 'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                if (used_buf_len == len)
                    ~~~~~~~~~~~~ ^  ~~~
2 warnings generated.
  LIBTOOL-STATIC Release/hidapi.a
  CXX(target) Release/obj.target/HID/src/HID.o
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
../../nan/nan_new.h:29:56: warning: 'ToInteger' is deprecated [-Wdeprecated-declarations]
To<v8::Integer>(v8::Handle<v8::Integer> i) { return i->ToInteger(); }
                                                       ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2456:10: note: 'ToInteger' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version",
         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
../../nan/nan_new.h:34:56: error: no matching member function for call to 'ToInt32'
To<v8::Int32>(v8::Handle<v8::Integer> i)   { return i->ToInt32(); }
                                                    ~~~^~~~~~~
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2437:43: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
                                          ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2450:30: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<Int32> ToInt32(Isolate* isolate) const);
                             ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
../../nan/nan_new.h:39:65: error: too few arguments to function call, single argument 'context' was not specified
To<v8::Uint32>(v8::Handle<v8::Integer> i)  { return i->ToUint32(); }
                                                    ~~~~~~~~~~~ ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2435:3: note: 'ToUint32' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToUint32(
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:416:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:49:38: error: too few arguments to function call, expected 2, have 1
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
         ~~~~~~~~~~~~~~~~~~~~~~      ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:5035:3: note: 'New' declared here
  static Local<Value> New(Isolate* isolate, bool value);
  ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:49:60: error: expected '(' for function-style cast or type construction
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                          ~~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:49:62: error: expected expression
  return v8::BooleanObject::New(value).As<v8::BooleanObject>();
                                                             ^
../../nan/nan_implementation_12_inl.h:158:22: warning: 'New' is deprecated [-Wdeprecated-declarations]
  return v8::RegExp::New(pattern, flags);
                     ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:5109:10: note: 'New' has been explicitly marked deprecated here
  static V8_DEPRECATED("Use maybe version",
         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:166:10: error: no matching function for call to 'Compile'
  return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:1510:51: note: candidate function not viable: no known conversion from 'v8::Isolate *' to 'Local<v8::Context>' for 1st argument
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
                                                  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:1537:51: note: candidate function not viable: requires 4 arguments, but 2 were provided
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
                                                  ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:173:10: error: no matching function for call to 'Compile'
  return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:1510:51: note: candidate function not viable: no known conversion from 'v8::Isolate *' to 'Local<v8::Context>' for 1st argument
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
                                                  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:1537:51: note: candidate function not viable: requires 4 arguments, but 2 were provided
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
                                                  ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:206:9: error: cannot initialize a parameter of type 'v8::NewStringType' with an rvalue of type 'v8::String::NewStringType'
        v8::String::kNormalString, length);
        ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2803:64: note: passing argument to parameter 'type' here
      Isolate* isolate, const uint8_t* data, v8::NewStringType type,
                                                               ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:217:61: error: cannot initialize a parameter of type 'v8::String::ExternalOneByteStringResource *' with an lvalue of type 'v8::String::ExternalStringResource *'
  return v8::String::NewExternal(v8::Isolate::GetCurrent(), value);
                                                            ^~~~~
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2862:64: note: passing argument to parameter 'resource' here
                                ExternalOneByteStringResource* resource));
                                                               ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:229:28: warning: 'New' is deprecated [-Wdeprecated-declarations]
  return v8::StringObject::New(value).As<v8::StringObject>();
                           ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:5052:3: note: 'New' has been explicitly marked deprecated here
  V8_DEPRECATED("Use Isolate* version",
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/HID.cc:35:
In file included from ../../nan/nan.h:111:
In file included from ../../nan/nan_new.h:191:
../../nan/nan_implementation_12_inl.h:237:30: error: no member named 'CompileUnbound' in 'v8::ScriptCompiler'
  return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
         ~~~~~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:244:30: error: no member named 'CompileUnbound' in 'v8::ScriptCompiler'
  return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
         ~~~~~~~~~~~~~~~~~~~~^
In file included from ../src/HID.cc:35:
../../nan/nan.h:255:32: warning: 'BooleanValue' is deprecated [-Wdeprecated-declarations]
      || optionsObj->Get(opt)->BooleanValue();
                               ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2474:3: note: 'BooleanValue' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/HID.cc:35:
../../nan/nan.h:259:32: warning: 'BooleanValue' is deprecated [-Wdeprecated-declarations]
      && optionsObj->Get(opt)->BooleanValue();
                               ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2474:3: note: 'BooleanValue' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/HID.cc:35:
../../nan/nan.h:324:27: error: redefinition of 'NanEnsureHandleOrPersistent'
  NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
                          ^
../../nan/nan.h:319:17: note: previous definition is here
  v8::Handle<T> NanEnsureHandleOrPersistent(const v8::Handle<T> &val) {
                ^
../../nan/nan.h:344:27: error: redefinition of 'NanEnsureLocal'
  NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Handle<T> &val) {
                          ^
../../nan/nan.h:334:27: note: previous definition is here
  NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Local<T> &val) {
                          ^
../../nan/nan.h:374:39: error: no member named 'IdleNotification' in 'v8::Isolate'
    return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms);
           ~~~~~~~~~~~~~~~~~~~~~~~~~  ^
../../nan/nan.h:560:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'
      v8::Isolate::GCEpilogueCallback callback
      ~~~~~~~~~~~~~^
../../nan/nan.h:566:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate'
      v8::Isolate::GCEpilogueCallback callback) {
      ~~~~~~~~~~~~~^
../../nan/nan.h:571:20: error: no type named 'GCPrologueCallback' in 'v8::Isolate'
      v8::Isolate::GCPrologueCallback callback
      ~~~~~~~~~~~~~^
../../nan/nan.h:577:20: error: no type named 'GCPrologueCallback' in 'v8::Isolate'
      v8::Isolate::GCPrologueCallback callback) {
      ~~~~~~~~~~~~~^
../../nan/nan.h:659:15: error: no template named 'WeakCallbackData' in namespace 'v8'
    const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> > &data) {
          ~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
make: *** [Release/obj.target/HID/src/HID.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.1/bin/node" "/usr/local/Cellar/node@10/10.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jon/Side/personal/dev-setup/node_modules/node-hid
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> [email protected] install /Users/jon/Side/personal/dev-setup/node_modules/xpc-connection
> node-gyp rebuild

  CXX(target) Release/obj.target/binding/src/XpcConnection.o
../src/XpcConnection.cpp:103:41: warning: 'IntegerValue' is deprecated [-Wdeprecated-declarations]
    xpcObject = xpc_int64_create(value->IntegerValue());
                                        ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2476:3: note: 'IntegerValue' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/XpcConnection.cpp:113:40: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
    Local<Object> valueObject = value->ToObject();
                                       ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/XpcConnection.cpp:123:40: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
    Local<Object> valueObject = value->ToObject();
                                       ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/XpcConnection.cpp:143:89: error: too few arguments to function call, expected 2, have 1
      Local<Value> propertyValue = object->GetRealNamedProperty(propertyName->ToString());
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:3562:3: note: 'GetRealNamedProperty' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty(
  ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:416:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/XpcConnection.cpp:143:79: warning: 'ToString' is deprecated [-Wdeprecated-declarations]
      Local<Value> propertyValue = object->GetRealNamedProperty(propertyName->ToString());
                                                                              ^
/Users/jon/.node-gyp/10.14.1/include/node/v8.h:2454:10: note: 'ToString' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
         ^
/Users/jon/.node-gyp/10.14.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/XpcConnection.cpp:254:12: warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations]
      Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
           ^
../node_modules/nan/nan.h:980:3: note: 'MakeCallback' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
  ^
../node_modules/nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/XpcConnection.cpp:263:12: warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations]
      Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
           ^
../node_modules/nan/nan.h:980:3: note: 'MakeCallback' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
  ^
../node_modules/nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
6 warnings and 1 error generated.
make: *** [Release/obj.target/binding/src/XpcConnection.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.1/bin/node" "/usr/local/Cellar/node@10/10.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jon/Side/personal/dev-setup/node_modules/xpc-connection
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/bluetooth-hci-socket):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux,android,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/node-hid):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/xpc-connection):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
added 10 packages from 12 contributors and audited 116 packages in 11.756s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

`this` scoping issues with `setTimeout`

It appears as though the line setTimeout(rollingSpider.land, 5000); fails with an undefined error because setTimeout is setting this to the global scope. I'd be willing to contribute a fix if it's not being worked on. (Solution here)

// WORKS
setTimeout(function() { rollingSpider.land(); }, 5000);

// BREAKS 
setTimeout(rollingSpider.land, 5000);

...

/Users/rafy/Developer/drone-js-1/node_modules/rolling-spider/lib/drone.js:584
  this.logger('RollingSpider#land');
       ^

TypeError: this.logger is not a function
    at Timeout.land [as _onTimeout] (/Users/rafy/Developer/drone-js-1/node_modules/rolling-spider/lib/drone.js:584:8)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

Docs for Bluetooth API?

Hi,

I'm hoping to use this library as the basis for a Web Bluetooth demo. In order to do that, I'm hoping to better understand the underlying Bluetooth API - how to construct the right commands for the drone.

Please may I ask: were there any particular docs that you used to figure out what exactly you needed to write to the characteristics, which services and characteristics you needed, etc? I've been Googling around and hunting around on the Parrot Developers website, but haven't found anything yet...

Thanks!

Night Drone Supprt

Just had a new issues that I could not find specifically referenced and thought I'd let you know. The new night drones seem to have a new name prefix (Swat_) so to make them discoverable I added the following:

localName.indexOf('Swat_')=== 0) to the drone.js

Hope this helps someone else.

J

command execution unreliable

first of all thanx for the really cool stuff here.
iam trying to start with some really simple commands, as documented in the readme or in the eg.
just takeoff, forward an land (using temporal). but if i execute the same script several times in a row, i always get different results. which means sometimes all 3 commands are execute, sometimes just takeoff and land and sometimes takeoff, forward and then nothing which means the script ends and the spider is still in the air. iam using a old netbook with a more modern usb bt dongle (4.0). could this problem be bt releated, some connection problems maybe? what else could be the reason for such behaviour?

thanx in advanced

drone not responding

when i start the program three things happen. 1, it flies (very rarely) 2. nothing 3. noble warning unknown peripheral exxxxxxxxx. what do i do?

NPM installation issue

Hi, I have issues with rolling spider, here is my console output.
I have followed the NoBLE prequisites.

C:\Windows\system32>npm install rolling-spider

> [email protected] install C:\Windows\system32\node_modules\usb
> node-pre-gyp install --fallback-to-build

[usb] Success: "C:\Windows\system32\node_modules\usb\src\binding\usb_bindings.no
de" is installed via remote

> [email protected] install C:\Windows\system32\node_modules\bluetooth-
hci-socket
> node-gyp rebuild


C:\Windows\system32\node_modules\bluetooth-hci-socket>if not defined npm_config_
node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..
\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp: binding.gyp not found (cwd: C:\Windows\system32\node_modules\bluetooth-hci-
socket) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_module
s\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:198:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\bluetooth-hci-socket
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'C:\Windows\system32\
package.json'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: logitech-dual-action-controller@
git+https://github.com/voodootikigod/node-logitech-dual-action-controller.git (n
ode_modules\rolling-spider\node_modules\logitech-dual-action-controller):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: No git binary found in $PATH
npm WARN enoent ENOENT: no such file or directory, open 'C:\Windows\system32\pac
kage.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modul
es\xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-conne
[email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":
"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node
_modules\bluetooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] insta
ll: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
added 32 packages and updated 1 package in 9.342s

C:\Windows\system32>

Note that I tested on my MacBook Air also, it worked but the onboard bluetooth adapter is not compatible with BLE (it's a late 2010)

EDIT : I managed to make it work with a USB bluetooth dongle that was enough recent to support BLE on my macbook air. note that I had to disable the integrated bluetooth with a "nvram bluetoothHostControllerSwitchBehavior=always" command.
Managed to test 10 take-off/landings, worked everytime on my mac.
Still get the issue on windows, but you can close the issue if you want.

thanks in advance for your answers :)

Swarm Support

Currently this is designed for 1:1 process to drone mapping. I want SWARMS!!!!

Usign cylon-rolling-spider with Meteor

Hi!

Recently I have been starting to develop APPs based on Meteor, and I would like to develop an APP that allow users to drive a rolling spider using your package.

Despite Meteor has not implemented a "require" method to load NPM packages, I was capable of loading packages using meteorhacks:npm and cosmos:browserify (using chalk as an example). However, when I am trying to do the same with your package an error is triggered.

Do I have to set any additional dependence to the package or do any additional step to make it work? Right know I am a bit lost U.U

Cannot connect to my minidrone

Hi,
I tried to connect to my rolling spider. I'm new with nodejs, maybe I did something wrong. I ran from terminal 'sudo node discover.js' but nothing happend. Running this should print on terminal the drone nearby my laptop, right? I have installed on my laptop ubuntu 14.04, linux version 3.16

Direct Bluetooth commands

hi voodootikigod,

I am trying to send the commands direct over BLE Serial from my Arduino.
I got it connected but sending the handshake or other commands does
not work do i have to convert them somehow?
BTSerial.write("fb0f, fb0e, fb1b, fb1c, fd22, fd23, fd24, fd52, fd53, fd54"); //Handshake delay(2000); BTSerial.write("fa0b, 0x02, 00aa, 0x02, 0x00, 0x01, 0x00"); //Take off

best regards
moe-the-fabber

Support parrot cargo ?

According to doc, the difference with rolling spider is the lego pieces, wonder if software is too different.

I was able to connect to device, but it seems it does not hold naming convention:

rollingspider Peripheral { _noble: Noble { state: 'poweredOn', _bindings: EventEmitter { _state: 'poweredOn', _addresses: [Object], _addresseTypes: [Object], _connectable: [Object], _pendingConnection: false, _connectionQueue: [], _handles: {}, _gatts: {}, _aclStreams: {}, _hci: [Object], _gap: [Object], _events: [Object], _eventsCount: 20, onSigIntBinded: [Function: bound ], _scanServiceUuids: [] }, _peripherals: { '68644b1f30cc': [Object], e014e7343da3: [Circular] }, _services: { '68644b1f30cc': {}, e014e7343da3: {} }, _characteristics: { '68644b1f30cc': {}, e014e7343da3: {} }, _descriptors: { '68644b1f30cc': {}, e014e7343da3: {} }, _discoveredPeripheralUUids: [ '68644b1f30cc', 'e014e7343da3' ], _events: { warning: [Object], discover: [Function: bound ], stateChange: [Function: bound ] }, _eventsCount: 3, _allowDuplicates: undefined }, id: 'e014e7343da3', uuid: 'e014e7343da3', address: 'e0:14:e7:34:3d:a3', addressType: 'random', connectable: true, advertisement: { localName: 'Travis_050419', txPowerLevel: undefined, manufacturerData: <Buffer 43 00 cf 19 09 09 01 00>, serviceData: [], serviceUuids: [] }, rssi: -59, services: null, state: 'disconnected' } +0ms rollingspider Travis_050419 +3ms

Can't get it working

Really nice what you have here, appreciate it enormously.

And I apologies for my in-adequateness.

I've installed noble prerequisites on my ubuntu but when I try your example it doesn't execute. I've run the noble example enter-exit.js. It outputs my drone. Though connections still elude me.

I've updated the RS with the newest parrot drivers. Am I missing something???

When I run the eg/keyboard.js and try to takeoff I get:

Error: You must have bluetooth enabled and be connected to a drone before executing a command. 
Please ensure Bluetooth is enabled on your machine and you are connected.

Discover works fine, but unable to run index.js with success

Colleague is running successful with Mac, I am running Ubuntu 14.04 with noble, temporal, rolling-spider, and bluetooth-hci-socket node modules.

Discover showed my minidrone
1: RS_B075911 (e014b3783d48), RSSI -54

When I run index.js, just hangs

Any advice is appreciated,
also any pointers on how to get debugging or logging on also appreciated.

Apologies if I sound dumb..... still getting up to speed with node

Thanks for this great piece of code/functionality

Error after landing swarm and solved (perhaps)

Hi,

When i use swarm.js in eg directory an when i press "q" for landing and error appears "this.members = []"
I change line 220 in swarm.js in lib directory :
this.members = [] ---> changed to this.membership = [];
And it works...

Connection Issue / Constant Rebooting drone

NODE-ROLLING-SPIDER Team,

First off, great job! This is awesome work. I am having issues with connecting to the rolling spider. I first tried just copy / pasting your posted code, and it works here and there, but there. I have to constantly turn the drone off, or restart my laptop to get the done to connect.

I have tried adding done.disconnect(); at the end of my scripts to try and force a clean disconnect before I run again to no avail.

Any insight would be helpful.

-D7

Not in the air?

Hey,

I am playing around the example script, all good, takes off, goes forward, and lands.

I tried to add a frontflip command between existing tasks but in the console I see Calling RollingSpider#frontFlip when it's not in the air isn't going to do anything

while my robot is in the air, and flying...
what could be wrong?

in the same time: it looks like I have to reset it everytime I want him to execute a program, even after calling disconnect at the end of the program.

Thanks

Problem at 'npm install rolling-spider'

I have node version as v6.11.1 and ubuntu 4.8.

But, if i do 'npm install rolling-spider' on terminal, I get these errors

Anyone knows why it happened ?

npm WARN deprecated [email protected]: bad semver, NANv2 change means we shoudl be v0.5.0, NANv1 is 0.4.0

> [email protected] install /home/himadri/node_modules/logitech-dual-action-controller/node_modules/node-hid
> node-gyp rebuild

make: Entering directory '/home/himadri/node_modules/logitech-dual-action-controller/node_modules/node-hid/build'
  CC(target) Release/obj.target/hidapi/hidapi/libusb/hid.o
../hidapi/libusb/hid.c:47:20: fatal error: libusb.h: No such file or directory
compilation terminated.
hidapi.target.mk:97: recipe for target 'Release/obj.target/hidapi/hidapi/libusb/hid.o' failed
make: *** [Release/obj.target/hidapi/hidapi/libusb/hid.o] Error 1
make: Leaving directory '/home/himadri/node_modules/logitech-dual-action-controller/node_modules/node-hid/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Linux 4.8.0-58-generic
gyp ERR! command "/usr/local/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/himadri/node_modules/logitech-dual-action-controller/node_modules/node-hid
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

Access to sensor data?

Hello. Is it possible to access the rolling spider sensor data? I am excited about the swarm potential but I would like to detect and respond to proximity to other drones, perhaps using the ultrasonic sensor. Thank you.

Syntax error for multi drone swarm

I am able to get a single parrot drone to take off and follow commands using the standard single connection script, but I am unable to manually activate multiple drones using the swarm script.

What is the syntax of adding multiple drones to the swarm?

Windows Support ?!

Hi i cant join the fun to fly my Rolling-Spider with Node,
because i can`t install this module on my Windows 8 or 10 Machine.
Following message appears:

λ npm install rolling-spider
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules \\npm\\bin\\npm-cli.js" "install" "rolling-spider"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: [email protected]
npm ERR! notsup Valid OS:    darwin,linux
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

Thanks in advance

How to use this.logger instead of console.log

Hello,
I try to use the "logger" option in the settings like in a doc constructor in drone.js file:
/**

  • Constructs a new RollingSpider
  • @param {Object} options to construct the drone with:
    • {String} uuid to connect to. If this is omitted then it will connect to the first device starting with 'RS_' as the local name.
    • logger function to call if/when errors occur. If omitted then uses console#log
  • @constructor
    */

But I can not.
I try :
var mydrone = new RollingSpider({uuid : "RS_R112233"}, logger);
or
var mydrone = new RollingSpider({uuid : "RS_R112233", logger = true});

Do you have a solution maybe?
Best regard

Swarm with different trajectory

Hello everyone.
Is it possible to make a different trajectory for each drones of swarm ?
May be using an index element of the swarm like this :
swarm.membership[0].takeOff()
If you have an idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.