npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-parrot-drone

v0.1.0

Published

extendable node module to allow control of any Parrot Mini Drone

Downloads

10

Readme

node-parrot-drone for node

A fully featured implementation of the Parrot SDK for node.js so you can do stuff with drones!

Control Any Parrot Drone

This is the core module for connecting to and controlling any Parrot drone with JavaScript via node! It is designed to be extended with new drone projects, classes and commands as they are created by Parrot.

This module contains the core code for such extensions with all shared information and commands. It is responsible for connecting, receiving and sending messages, automated responses, parsing data and populating drone status as well as dispatching drone events, updates and status changes.

Contributing

  • Star
  • Fork
  • Make awesome changes
  • Merge from this repo's Master branch to make sure you don't have conflicts
  • Submit a PR
  • Have a beer, milkshake, raw juice, or just feel good inside knowing you helped move the JS drone community forward!

This module is Beta as of February 2017

To use the module install it via npm

npm i node-parrot-drone

Connecting to a drone


    const parrot=require('node-parrot-drone');

    const drone=new parrot.Wifi;

    function connected(){
      console.log('connected');
    }

    //the drone will emit a connected event
    drone.on(
        'connected',
        connected
    );

    //optionally you can pass a callback to the connect method if you prefer
    drone.connect(connected);

Listening for all messages from the drone

There will be a lot of messages, but you can check for the ones you like using the projectID, classID and commandName. This is especially useful when debugging or hacking a new drone.


    drone.on(
        'message',
        function(message){
          console.log(message);
        }
    );

Listening for changes on specific drone argument sets

This is probably the most useful way to monitor your drones state.


    //debug or see non automatic messages (pings, pongs, etc. are not bubbled)
    drone.on(
        'message',
        function(message){
          console.log(message);
        }
    );

    drone.on(
        'responseError',
        function(message){
          console.log('The drone sent a malformed message. Probably not important.');
          console.log(message);
        }
    );

    drone.on(
        'messageSent',
        function(data){
          console.log('Debug your messages if needed.');
          console.log(data);
        }
    );

    drone.on(
        '*',
        function(type,data){
          console.log('OMG listening to all events...');
          console.log(type,data);
        }
    );

    function batteryStateChanged(commandRef){
      //commandRef is a reference to the command itself in the project state
      console.log('battery is now at %d percent',commandRef.percent);
    }

    //listen for changes on the command state
    drone.projects.common.BatteryStateChanged.on(
        'change',
        batteryStateChanged
    );

    //or listen for the specific event on the drone
    drone.on(
        'batteryStateChanged',
        batteryStateChanged
    );

Sending commands or updating values on your drone


    const project=drone.projects.common;

    //build a message requesting all settings
    const getSettingsState=drone.message.build(
      project.id,
      project.settings.id,
      project.settings.allSettings
    );

    //build a message requesting all common states, like battery percent :)
    const getCommonState=drone.message.build(
      project.id,
      project.common.id,
      project.common.allStates
    );

    //update the magnetoCalibration value on the project state
    drone.message.command=project.calibration.magnetoCalibration;

    //build a message with the updated value
    const calibrate=drone.message.build(
      project.id,
      project.calibration.id,
      project.calibration.magnetoCalibration
    );

    //send all the commands to the drone
    drone.message.send(getSettingsState);
    drone.message.send(getCommonState);
    drone.message.send(calibrate);

Really verbose logging about messages and drone connectivity

Put these lines in before connecting to see detailed TCP and UDP info.


    drone.discovery.config.silent=false;
    drone.d2c.config.silent=false;

License

DBAD