Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
An implementation of the networking protocols used by the Parrot AR Drone 2.0.
Install via npm:
npm install ar-drone
The AR Drone is an affordable, yet surprisingly capable quadcopter. The drone itself runs a proprietary firmware that can be controlled via WiFi using the official FreeFlight mobile app (available for iOS and Android).
Unlike the firmware, the client protocol is open, and Parrot publishes an SDK (signup required to download) including a good amount of documentation and C code. Their target audience seems to be mobile developers who can use this SDK to create games and other apps for people to have more fun with their drones.
However, the protocol can also be used to receive video and sensor data, enabling developers to write autonomous programs for the upcoming robot revolution.
The drone is controlled by sending UDP packets on port 5556. Because UDP does not guarantee message ordering or delivery, clients must repeatedly send their instructions and include an incrementing sequence number with each command.
For example, the command used for takeoff/landing (REF), with a sequence number of 1, and a parameter of 512 (takeoff) looks like this:
AT*REF=1,512\r
To ease the creation and sending of these packets, this module exposes an
UdpControl
class handling this task. For example, the following program will
cause your drone to takeoff and hover in place.
var arDrone = require('ar-drone');
var control = drone.createUdpControl();
setInterval(function() {
// The emergency: true option recovers your drone from emergency mode that can
// be caused by flipping it upside down or the drone crashing into something.
// In a real program you probably only want to send emergency: true for one
// second in the beginning, otherwise your drone may attempt to takeoff again
// after a crash.
control.ref({fly: true, emergency: true});
// This command makes sure your drone hovers in place and does not drift.
control.pcmd();
// This causes the actual udp message to be send (multiple commands are
// combined into one message)
control.flush();
}, 30);
Now that you are airborne, you can fly around by passing an argument to the
pcmd()
method:
control.pcmd({
front: 0.5, // fly forward with 50% speed
up: 0.3, // and also fly up with 30% speed
});
That's it! A full list of all pcmd()
options can be found in the API docs
below.
With what you have learned so far, you could create a simple program like this:
var arDrone = require('ar-drone');
var control = drone.createUdpControl();
var start = Date.now();
var ref = {};
var pcmd = {};
console.log('Recovering from emergency mode if there was one ...');
ref.emergency = true;
setTimeout(function() {
console.log('Takeoff ...');
ref.emergency = false;
ref.fly = true;
}, 1000);
setTimeout(function() {
console.log('Turning clockwise ...');
pcmd.clockwise = 0.5;
}, 6000);
setTimeout(function() {
console.log('Landing ...');
ref.fly = false;
pcmd = {};
}, 8000);
setInterval(function() {
control.ref(ref);
control.pcmd(pcmd);
control.flush();
}, 30);
Creates a new UdpControl instance where options
can include:
ip
: The drone IP address, defaults to '192.168.1.1'
.port
: The port to use, defaults to 5556
.Enqueues a raw AT*
command. This is useful if you want full control.
For example, a takeoff instructions be send like this:
udpControl.raw('REF', (1 << 9));
Enqueues a AT*REF
command, options are:
fly
: Set this to true
for takeoff / staying in air, or false
to initiate
landing / stay on the ground. Defaults to false
.emergency
: Set this to true
to set the emergency bit, or false
to not
set it. Details on this can be found in the official SDK Guide. Defaults to
false
.Enqueues a AT*PCMD
(progressive) command, options are:
front
or back
: Fly towards or away from front camera direction.left
or/ right
: Fly towards the left or right of the front camera.up
or down
: Gain or reduce altitude.clockwise
or counterclockwise
: Rotate around the center axis.The values for each option are the speed to use for the operation and can range
from 0 to 1. You can also use negative values like {front: -0.5}
, which is
the same as {back: 0.5}
.
Sends all enqueued commands as an UDP packet to the drone.
Documentation to be written ...
Documentation to be written ...
FAQs
A node.js client for controlling Parrot AR Drone 2.0 quad-copters.
The npm package ar-drone receives a total of 114 weekly downloads. As such, ar-drone popularity was classified as not popular.
We found that ar-drone demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.