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

dronelib

v1.0.3

Published

Control your Chinese drone from Node.js

Downloads

10

Readme

dronelib

Control Chinese drones with Node.js.

I tested this on a "Propel Ultra-X + WiFi", but it should work on any similar model.

Features

  • Move your drone (throttle, direction, turning)
  • Auto take-off
  • Calibrate gyro
  • Unlock motor

Example

First, make sure you are connected to your drone's AP.

const { Drone } = require('dronelib')

const drone = new Drone()

// Enabling will start sending commands to your drone
// and the lights on it should stop blinking
drone.enable()

// Take flight!
drone.takeOff()

Fields

throttle

This is the current throttle of the drone. It ranges from 0-254. Equivalent to pushing the left stick up or down.

Set it below 128 to make it go down, set it above 128 to make it go up.

// FULL THROTTLE!
drone.throttle = 254

turn

The current turn value of the drone. It ranges from 0-254. Equivalent to pushing the left stick left or right.

Set it below 128 to make it turn left, set it above 128 to make it turn right.

// Spin left!
drone.turn = 0

forwardBackward

The current forward/backward direction value of the drone. It ranges from 0-254. Equivalent to pushing the right stick up or down.

Set it below 128 to make it go forward, set it above 128 to make it go backward.

// I hope it doesn't run into any trees
drone.forwardBackward = 254

leftRight

The current left/right direction value of the drone. It ranges from 0-254. Equivalent to pushing the right stick left or right.

Set it below 128 to make it go left, set it above 128 to make it go right.

// Moves the drone slightly left
drone.leftRight = 100

currentCommand

The command that is currently being sent to the drone. You probably shouldn't touch this directly, and instead use one of the provided command methods.

Methods

enable()

Use this method to start sending commands to the drone. While enabled, this library will send a message to the drone every 100ms. This is how the drone knows it hasn't disconnected from the client.

disable()

Use this method to stop sending commands to the drone.

takeOff()

Take flight! This is equivalent to pressing the "Auto Take-Off/Land" button.

land()

Fall with style! This is equivalent to pressing the "Auto Take-Off/Land" button.

calibrateGyro()

Calibrate the drone's gyro. The user should put the drone on a flat surface before this is called.

toggleMotorLock()

Toggle the drone's motor lock. This enables/disables the altitude lock. There's no way to programmatically determine whether it is enabled or disabled.

License

This project is licensed under the GNU GPL v3.