Code Monkey home page Code Monkey logo

node-ar-drone's Introduction

ar-drone

Build Status

An implementation of the networking protocols used by the Parrot AR Drone 2.0. It appears that 1.0 drones are also compatible.

Install via Github to get the latest version:

npm install git://github.com/felixge/node-ar-drone.git

Or, if you're fine with missing some cutting edge stuff, go for npm:

npm install ar-drone

Introduction

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.

Status

This module is still under heavy development, so please don't be surprised if you find some functionality missing or undocumented.

However, the documented parts are tested and should work well for most parts.

Client

This module exposes a high level Client API that tries to support all drone features, while making them easy to use.

The best way to get started is to create a repl.js file like this:

var arDrone = require('ar-drone');
var client  = arDrone.createClient();
client.createRepl();

Using this REPL, you should be able to have some fun:

$ node repl.js
// Make the drone takeoff
drone> takeoff()
true
// Wait for the drone to takeoff
drone> clockwise(0.5)
0.5
// Let the drone spin for a while
drone> land()
true
// Wait for the drone to land

Now you could write an autonomous program that does the same:

var arDrone = require('ar-drone');
var client  = arDrone.createClient();

client.takeoff();

client
  .after(5000, function() {
    this.clockwise(0.5);
  })
  .after(3000, function() {
    this.stop();
    this.land();
  });

Ok, but what if you want to make your drone to interact with something? Well, you could start by looking at the sensor data:

client.on('navdata', console.log);

Not all of this is handled by the Client library yet, but you should at the very least be able to receive droneState and demo data.

A good initial challenge might be to try flying to a certain altitude based on the navdata.demo.altitudeMeters property.

Once you have managed this, you may want to try looking at the camera image. Here is a simple way to get this as PngBuffers (requires a recent ffmpeg version to be found in your $PATH):

var pngStream = client.getPngStream();
pngStream.on('data', console.log);

Your first challenge might be to expose these png images as a node http web server. Once you have done that, you should try feeding them into the opencv module.

Client API

arDrone.createClient([options])

Returns a new Client object. options include:

  • ip: The IP of the drone. Defaults to '192.168.1.1'.
  • frameRate: The frame rate of the PngEncoder. Defaults to 5.
  • imageSize: The image size produced by PngEncoder. Defaults to null.

client.createREPL()

Launches an interactive interface with all client methods available in the active scope. Additionally client resolves to the client instance itself.

client.getPngStream()

Returns a PngEncoder object that emits individual png image buffers as 'data' events. Multiple calls to this method returns the same object. Connection lifecycle (e.g. reconnect on error) is managed by the client.

client.getVideoStream()

Returns a TcpVideoStream object that emits raw tcp packets as 'data' events. Multiple calls to this method returns the same object. Connection lifecycle (e.g. reconnect on error) is managed by the client.

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(speed) / client.down(speed)

Makes the drone gain or reduce altitude. speed can be a value from 0 to 1.

client.clockwise(speed) / client.counterClockwise(speed)

Causes the drone to spin. speed can be a value from 0 to 1.

client.front(speed) / client.back(speed)

Controls the pitch, which a horizontal movement using the camera as a reference point. speed can be a value from 0 to 1.

client.left(speed) / client.right(speed)

Controls the roll, which is a horizontal movement using the camera as a reference point. speed can be a value from 0 to 1.

client.stop()

Sets all drone movement commands to 0, making it effectively hover in place.

client.calibrate(device)

Asks the drone to calibrate a device. Although the AR.Drone firmware only supports one device that can be calibrated. This function also includes ftrim.

The Magnetometer

Device: 0

The magnetometer can only be calibrated while the drone is flying, and the calibration routine causes the drone to yaw in place a full 360 degrees.

FTRIM

Device: 1

FTRIM essentially resets the Yaw, Pitch, and Roll to 0. Be very cautious of using this function and only calibrate while on flat surface. Never use while flying.

client.config(key, value, callback)

Sends a config command to the drone. You will need to download the drone SDK to find a full list of commands in the ARDrone_Developer_Guide.pdf.

For example, this command can be used to instruct the drone to send all navdata.

client.config('general:navdata_demo', 'FALSE');

callback is invoked after the drone acknowledges the config request or if a timeout occurs.

Alternatively, you can pass an options object containing the following:

  • key: The config key to set.
  • value: The config value to set.
  • timeout: The time, in milliseconds, to wait for an ACK from the drone.

For example:

var callback = function(err) { if (err) console.log(err); };
client.config({ key: 'general:navdata_demo', value: 'FALSE', timeout: 1000 }, callback);

client.animate(animation, duration)

Performs a pre-programmed flight sequence for a given duration (in ms). animation can be one of the following:

['phiM30Deg', 'phi30Deg', 'thetaM30Deg', 'theta30Deg', 'theta20degYaw200deg',
'theta20degYawM200deg', 'turnaround', 'turnaroundGodown', 'yawShake',
'yawDance', 'phiDance', 'thetaDance', 'vzDance', 'wave', 'phiThetaMixed',
'doublePhiThetaMixed', 'flipAhead', 'flipBehind', 'flipLeft', 'flipRight']

Example:

client.animate('flipLeft', 1000);

Please note that the drone will need a good amount of altitude and headroom to perform a flip. So be careful!

client.animateLeds(animation, hz, duration)

Performs a pre-programmed led sequence at given hz frequency and duration (in sec!). animation can be one of the following:

['blinkGreenRed', 'blinkGreen', 'blinkRed', 'blinkOrange', 'snakeGreenRed',
'fire', 'standard', 'red', 'green', 'redSnake', 'blank', 'rightMissile',
'leftMissile', 'doubleMissile', 'frontLeftGreenOthersRed',
'frontRightGreenOthersRed', 'rearRightGreenOthersRed',
'rearLeftGreenOthersRed', 'leftGreenRightRed', 'leftRedRightGreen',
'blinkStandard']

Example:

client.animateLeds('blinkRed', 5, 2)

client.disableEmergency()

Causes the emergency REF bit to be set to 1 until navdata.droneState.emergencyLanding is 0. This recovers a drone that has flipped over and is showing red lights to be flyable again and show green lights. It is also done implicitly when creating a new high level client.

Events

A client will emit landed, hovering, flying, landing, batteryChange, and altitudeChange events as long as demo navdata is enabled.

To enable demo navdata use

client.config('general:navdata_demo', 'FALSE');

See documentation for navadata object

UdpControl

This is a low level API. If you prefer something simpler, check out the Client docs.

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 = arDrone.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 = arDrone.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);

UdpControl API

arDrone.createUdpControl([options]) / new arDrone.UdpControl([options])

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.

udpControl.raw(command, [arg1, arg2, ...])

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));

udpControl.ref([options])

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.

udpControl.pcmd([options])

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}.

udpControl.flush()

Sends all enqueued commands as an UDP packet to the drone.

Video

@TODO Document the low level video API.

Navdata

@TODO Document the low level navdata API.

Environment variables

  • DEFAULT_DRONE_IP

Camera access

You can access the head camera and the bottom camera, you just have to change the config:

// access the head camera
client.config('video:video_channel', 0);

// access the bottom camera
client.config('video:video_channel', 3);

node-ar-drone's People

Contributors

andrew avatar bkw avatar cbumgard avatar domenic avatar eschnou avatar felixge avatar janl avatar janpieper avatar jfsiii avatar marcussorealheis avatar michaelshmitty avatar patrickjs avatar paulhayes avatar phated avatar rmehner avatar rschmukler avatar seanhussey avatar wiseman avatar xxgizmocodexx 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  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

node-ar-drone's Issues

Issue with multiple png/tcp stream to same drone

Since the drone appears to accept only one tcp video connection, creating multiple tcpstream (or using both a tcp and png stream) will cause disconnections and timeouts.

[Error: TcpVideoStream timeout after 1000 ms.]

What I propose is to replace client.createPngStream() by client.getPngStream() and client.getTcpStream() and have all these based on a single tcp stream instantiated upon first call to one of these methods.

I'll try to experiment with this in the coming days, unless someone as another idea/solution to my problem.

How to capture directly to USB: video_on_usb not working?

Hi,

I would like to use node-ar-drone and capture at the same
time the video directly on a USB-Pen on the AR Drone 2.0.
It works fine if i control the Drone with the iOS/Android App.

In the SDK2.0 PDF (page 87) i found the config: video:video_on_usb
and tried: client.config('video:video_on_usb', true);
but still no video will be captured when i use node/node-ar-drone.

What could be the problem?

Thanks,
Alex

Drone does not hover in fixed position when no command applied

The AT*PCMD command always set the progressive flag to true. This means that the drone never returns to a hovering state when no command is applied (See SDK PDF page 21).

https://github.com/felixge/node-ar-drone/blob/master/lib/control/AtCommandCreator.js#L50

A quick fix would be to set the progressive flag only if the option argument was non empty (i.e. fly order were sent). This seems consistent with the recommendation in the drone SDK.

"Always set the flag (argument 2) bit zero to one to make the drone consider the other arguments.
Setting it to zero makes the drone enter hovering mode (staying on top of the same point
on the ground)."

As anyone succeeded in detecting tags?

Not really an issue, just wondering the correct way to do this.

  1. I've enable vision detect in nav-data:
    -> works great, I receives the visionDetect section in navdata (or at least, I believe it works, there is data in zero, although everything is set to zero).

  2. Configure tag detection:
    client.config('detect:detect_type', '12');
    -> As per the AR Drone sdk, it should enable the roundel detection with bottom camera.

=> Nothing is reported as detected, the "nbDetected" fields remains zero.

I wonder if anyone managed to get this to work.

Have to call takeoff() before getPngStream() when using non-default IP

I was writing a quick project to test the PNG stream with the drone on the ground, when I realized it only works if I'm connected to the drone directly. I am using ardrone-wpa2 to connect the drone to my router so I can upload PNG images to the internet.

It works if the drone is flying. However this code by itself fails:

require("ar-drone").createClient({ip:"192.168.200.30"}).getPngStream();

Running that with NODE_DEBUG set to "net" yields this output:

NET: 9145 connect: find host 192.168.200.30
NET: 9145 _read
NET: 9145 _read wait for connection
NET: 9145 destroy
NET: 9145 close
NET: 9145 close handle
TcpVideoStream error: connect Unknown system errno 64
NET: 9145 emit close
Attempting to reconnect to TcpVideoStream...
NET: 9145 connect: find host 192.168.200.30
NET: 9145 destroy
NET: 9145 close
NET: 9145 close handle

I'm using Node v0.10.21 and ar-drone 0.3.0.

Check connection status

I am trying to build a server that can hold multiple Drone clients and got it working quite find, however I wonder if there is anyway to check if a client is connected or not.

Is there some event in the udpControl:er that I can lissen to?
Right now the only thing I find is however the client sends navdata or not.

Wireless Security (WPA)?

I apologize in advance as I know this is not the proper place to ask this question, but I was unable to find a good site via Google and Stack Overflow doesn't have much related to this particular topic... I figured the users of this project would have a good understanding of what I'm asking; so sorry in advance!

I just found out about this project and have been investigating picking up a programmable quadcopter. The Parrot AR seems to be the most popular choice, but I see that it doesn't use any type of wireless security out of the box and already there are hacking bots out there stealing other drones.

So is there a way to update the Parrot to require some form of wireless security? WPA would be preferred, but even WEP is better than nothing.

If not; is there a similar product to the Parrot drone that allows for custom programming like this (preferably via JavaScript), but that is using some type of encryption to prevent unauthorized users from hijacking your drone?

simple me!

hi
new to node.js and node-ar-drone. brilliant stuff which I am using in schools to educate young people. all works well except the animations i.e. if i try to execute animate('flipLeft', 15) it returns 'undefined' as with most others. am i missing something or is this functionality missing?

Thanks
daniel

no take off

hi,

just tried out the lookaround script, but my drone did not take off.

i'm getting the message: RECONNECTING NAVDATA!

using node 0.8.9

Parrot AR Drone 1.0?

Ok, I am lazy and I may try it before wondering.

Is the module compatible with the first release of ar.drone?

If it is not, maybe it would be nice to add a note in the README.

P.S.: I read CONTRIBUTING doc. The note is there. Thanks.

Accessing the bottom camera on the drone

I want to access the image data from the bottom camera and I was hoping that accessing it would be similar to the front camera (eg PngStream).

I started by looking at PaVEParser.js, particularly at data stored in _frame.

Can anyone provide some guidance or help on this? Thanks.

Drone lands on client (re)-connect

I'm not sure about this one and could not trace what happens in the code. Here is my problem:

  • fly the drone (in this case using ardrone-webflight)
  • code crash (i'm a lazy developer and did not properly catch an exception)
  • drone stays in standby mode, hovering over my neighbor garden
  • restart my application
  • drone lands ... not in the best place.. at least this did not happen over the river :-)

If you can point me to where to look; happy to provide a fix.

NavdataReader.char not advancing position?

It looks to me like this code won't advance the reader position:

NavdataReader.prototype.char = function() {
  return this._buffer[ this._offset ];
};

char is called in the magneto option parser, which has some suspicious values in its test:

     radius: -20.9833984375,
      error: {
        mean: 1129450962944,
        variance: -1.9905589299967167e-20
      }

It's also called indirectly via bool in the kalman pressure reader.

reconnecting issue

Hi guys,

If I turn the AR Drone on and off, the open stream doesn't generate any errors but stops working.

I'm thinking if I could connect again then the problems would be solved. However in going down this path I noticed that Client doesn't have a close, while the UdpControl does. Possibly this isn't the correct approach, maybe a reconnect function on client would be more appropriate, then it could call a reconnect method on UdpControl which would just recreate the socket.

Thoughts?

I can hack my local clone, however I'm happy to make changes and resubmit, just not familiar with how that is done on github.

getPngStream gets slower quickly

On the first seconds the png stream is real-time, like a video, but then it gets a consistent ~1s delay between.

I am wondering if Node's buffers / pipes get slammed?

Failed test: Client config(): sends config command 10 times

I dived into the code but could not find the root cause of this. It seems the config is sent twice so I looked for duplicate registration of the timer etc.. but no luck.

Any idea on how to fix this test ?


Failed: Client config(): sends config command 10 times

AssertionError: 2 == 1
    at Object.test.config(): sends config command 10 times (/data/eschenal/private/Workspace/node-ar-drone/test/unit/test-Client.js:345:14)
    at TestCase.run (/data/eschenal/private/Workspace/node-ar-drone/node_modules/utest/lib/TestCase.js:30:10)
    at Collection._runTestCase (/data/eschenal/private/Workspace/node-ar-drone/node_modules/utest/lib/Collection.js:42:6)
    at Collection.run (/data/eschenal/private/Workspace/node-ar-drone/node_modules/utest/lib/Collection.js:23:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Spin not stable

I tried to use

$ node repl.js
// Make the drone takeoff
drone> takeoff()
true
// Wait for the drone to takeoff
drone> clockwise(0.5)
0.5
// Let the drone spin for a while
drone> land()
true

The clockwise function cause the drone behave very strange.
It doesn't rotate at the original place. Instead there is a huge drift along side with rotation.

Get only selected data from navdata

As I scanned the code, node-ar-drone can select a subset of navdata. In thşs way, the volume of the navdata can be smaller. However, I could not find any example about it. Can you provide an example about navdata selection. For example, what can we write if we want only gps and wind data?

A GPS example

I am a new developer for Ar Drone. I am trying to develop a waypoint based navigation project. Can you give a sample code for accessing GPS data from Ar Drone?

animate commands don't work.

Hi there,

The drone seems to be ignoring all animate commands like flips.For example:

var arDrone = require('ar-drone');
var client = arDrone.createClient();

client.takeoff();

client
.after(3000, function() {
this.animate('flipLeft', 15);
})
.after(1000, function() {
this.stop();
this.land();
});

Just takes off and then lands. Is there a reason for this?

Solid Gray image from png stream.

I think I must have an incompatible version of ffmpeg as when I save the png buffers that are coming from the pngstream, they are just grey images, albeit the correct size.

What feature of ffmpeg are we using to decode the video? Could I be missing that codec?

control from node running on the drone?

has anyone figured out how to bypass wifi and send commands locally? not necessarily talking about reimplementing firmware here, just acting as a client to the existing API

Rotates off Axis using REPL

Hi - Thanks for this earth and sky-shatteringly awesome module.

Just one thing I've been running into (except for trees, etc.):

When I send the rotate left or right command to the drone using the REPL, the drone does not rotate in place but makes a wide curve as it rotates.

Have you run into this and if so do you have any advice about how to adjust things to rein it in?

Thanks,
Robert

Push a new release to npm?

It's been a while and a lot of things have been merged. Time to push 0.2.0 ? (since some API wrt video have changed , it seems to be more than just a micro revision).

TcpVideoStream and PngStream not working with AR Drone 1.0

Hi!
I try take video from AR Drone 1.0 and I get err :(

  1. From PngStream I dont get any data
  2. From TcpVidoeStream I get error:
    Error: connect ECONNREFUSED
    at errnoException (net.js:776:11)
    at Object.afterConnect as oncomplete

Please help me =)

Support for V1 video

Hey,

Been doing some work integrating with a custom server that uses node-ar-drone to connect to a parrot V1, a web based client connects to the server and can control the Parrot.

Problem is that the video stream is based on TCP, which is only for V2. For V1 it is streamed via UDP, which is initialised by sending a UDP packet to the video port on the drone. To make matters worse, the 'codecs' appear to be custom, derived from mjpeg and h.264.

Looking at the doco it appears the mjpeg would be the easiest, however I understand if you don't wish to support backward compatibility with the V1. The effort to support one of the types is kinda wasted as less and less V1 drones are around.

I might have a crack at it if I have time. I would rather not bother and work with a V2, alas I only have access to a V1 at the moment.

NPM install

@felixge first of all thanks for all the work, I couldnt install it via NPM only by using git://github.com/felixge/node-ar-drone.git . Perhaps this is intentionally at this moment.

Issue with altitude in parser or drone?

I ran a simple script that console.log the altitudeMeters value as it lifted off, then after 3 seconds it would land.

Although the drone lifted to no higher than maybe 1 metre, but definitely not 2 metres (i.e. it was lower than my height - 160cm), here's the altitudeMeters value:

0
0.06
0.31
0.74
1.31
3.15
3.69
4.09
4.49
4.96
5.27
5.71
5.98
6.16
6.4
6.52
6.65
6.84
6.8
6.8
6.77
6.74
6.74
6.48
6.45
6.42
6.26
5.97
5.8
5.55
5.15
4.69
4.18
3.64
3.12
2.6
2.23
2.05
1.8
0

So around 6m it's hovering, then it lands - but it's definitely not 6m high.

That all said - could this be just duff data coming from the drone? I've looked through the PDF SDK docs and it definitely refers to min & max altitude as millimetres, so I think the calc is right. So could this be a parsing issue or just the drone giving false data?

Throw LowBatteryException

AR Drone does not take off if the battery is low (afaik less than 20%). Client code does not receive any Exception about that

Support for uploading ephemeris

As far as I know the Flight Recorder GPS requires ephemeris to be uploaded from the app. It would be nice to be able to do this and get a faster fix without having to use the app.

I see the Free Flight app send the following GPS-related commands, but I don't know yet how it's actually uploading the ephemeris:

AT*CONFIG=1355,"gps:longitude","-118.277018"
AT*CONFIG=1366,"gps:altitude","115.649048"
AT*CONFIG=1378,"gps:accuracy","65.000000"
AT*CONFIG=1386,"gps:ephemeris_uploaded","RESET"
AT*CONFIG=1468,"gps:ephemeris_uploaded","f437ec69aa76c90f4fe8d64b3122016a"

serial console on drone outputs debug information

this isn't the correct repo for this question but I don't know where else to put it :)

the Tx serial port on the motherboard of the drone is intended as a debug console. so when you connect to it via serial it will spew out a bunch of data. reading data into the drone over serial works just fine but I can't figure out how to disable the drones console debugging.

anyone have any ideas? yesterday I mounted a robot arm to a drone but was unable to teach the drone how to open and close the arm programmatically because of this limitation

20 instead of 6 images? (AssertionError)

Can someone please tell me, why 6 png images are expected by this test? Using ffmpeg is broken on my maschine because ffmpeg is deprecated and I only get two data events but if I change using ffmpeg to avconv, i get 20 png images (3 broken, 17 with a printer and a cup).

See #60 to find out why I want to use avconv instead of ffmpeg.

Environment

OS: Ubuntu 12.04
Node: 0.8.25
NPM: 1.2.30
node-ar-drone: 031d2e3

Using ffmpeg (deprecated)

$ npm test

> [email protected] test /home/jan/workspace/node-ar-drone
> node test/run.js

[0:00:01 0 14/17 82.4% node test/integration/video/PngEncoder/test-sample-encode.js]

  assert.js:102
    throw new assert.AssertionError({

  AssertionError: 2 == 6
      at process.<anonymous> (/home/jan/workspace/node-ar-drone/test/integration/video/PngEncoder/test-sample-encode.js:23:10)
      at process.EventEmitter.emit (events.js:96:17)

[0:00:01 1 16/17 100.0% node test/integration/video/TcpVideoStream/test-connection-timeout.js]

Using avconv

Diff: https://gist.github.com/janpieper/7081811 (prototype)

$ npm test

> [email protected] test /home/jan/workspace/node-ar-drone
> node test/run.js

[0:00:01 0 14/17 82.4% node test/integration/video/PngEncoder/test-sample-encode.js]

  assert.js:102
    throw new assert.AssertionError({
          ^
  AssertionError: 20 == 6
      at process.<anonymous> (/home/jan/workspace/node-ar-drone/test/integration/video/PngEncoder/test-sample-encode.js:23:10)
      at process.EventEmitter.emit (events.js:96:17)

[0:00:01 1 16/17 100.0% node test/integration/video/TcpVideoStream/test-normal-connection.js]

Unable to get Client data (navdata) when controlling through UDP

I'm using the UDPControl to pass commands to the drone, but need to be able to access battery level and other metrics using navdata. As far as I can see, using the Client class is the only way to access this. Whenever I create a client as well as a UDPControl, however, things get wonky. What's the best way to do this?

Thanks in advance!

Failed integration test: test/integration/video/PngEncoder/test-sample-encode.js

This test is skipped in travis due to a ffmpeg dependency but still fails locally. No clue if the issue is in the underlying code, or in the test. It seems the issue comes from the number of frames extracted from the test file not being 6 but 5.


[0:00:01 0 13/17 76.5% node test/integration/video/PngEncoder/test-sample-encode.js]

assert.js:102
throw new assert.AssertionError({
^
AssertionError: 5 == 6
at process. (/data/eschenal/private/Workspace/node-ar-drone/test/integration/video/PngEncoder/test-sample-encode.js:23:10)
at process.EventEmitter.emit (events.js:88:17)

test-parseNavdata tests failing due to broken navdata.bin fixture

test/fixtures/navdata.bin contains the following GPS "option" packet at offset 0x76c:

00000760:                     1b00 0c00 0000 0000          ........
00000770: 0000 0000 ffff 0800 068e 0000            ............

It declares itself as a GPS option (0x001b) with length 12 (0x000c), but a real GPS option as sent by firmware version 2.4.7 is a lot bigger. This results in a lot of RangeError: Trying to access beyond buffer length failures.

I can fix it by replacing with a real GPS option packet, but I just want to make sure that the existing test data wasn't recorded from real hardware--if it is, then maybe the GPS option parser needs to be able to handle it?

More protocol commands

These seem to be the other commands used in the protocol. These don't seem to be currently implemented in the client (yet).

AT*REF=%d,%d
AT*PMODE=%d,%d
AT*MISC=%d,%d,%d,%d,%d
AT*GAIN=%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d
AT*ANIM=%d,%d,%d
AT*VISP=%d,%d,%d,%d,%d,%d,%d,%d,%d,%d
AT*VISO=%d,%d
AT*CAP=%d,%d,%d
AT*ZAP=%d,%d
AT*CAD=%d,%d,%d
AT*FTRIM=%d
AT*MTRIM=%d,%d,%d,%d
AT*POL=%d,%d,%d,%d,%d,%d
AT*PCMD=%d,%d,%d,%d,%d,%d
AT*PCMD_MAG=%d,%d,%d,%d,%d,%d,%d,%d
AT*CONFIG=%d,"%s","%s"
AT*CONFIG_IDS=%d,"%s","%s","%s"
AT*CTRL=%d,%d,%d
AT*LED=%d,%d,%d,%d
AT*COMWDG=%d
AT*PWM=%d,%d,%d,%d,%d
AT*AFLIGHT=%d,%d
AT*CALIB=%d,%d
AT*VICON=%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d

Obviously, it will take some more work to figure each of these out, but this should be a good starting point based on /bin/program.elf.

This was from version ardrone2_v2.3.3.

Socket binding collision

So I got node running on the drone (hurray) but I can't run node-ar-drone on it and have it connect to itself. (since the drone already owns the navdata port)

https://github.com/felixge/node-ar-drone/blob/master/lib/navdata/UdpNavdataStream.js#L39 seems to be the culprit. If I comment this out it doesn't seem to break anything and it allows me to run the REPL on the drone via telnet (mindfuck)

Is there a reason for the line that I'm missing or should it actually be removed? I looked at https://github.com/joyent/node/blob/master/test/simple/test-dgram-pingpong.js and it seems like you don't need to bind a client socket to a port

Problem with demo.altitude

Hello:
I am new with the node-ar-node and I am trying to use the altitude section within the navdata to read what the current height of the drone is (I move the drone by hand). But I don't get anything back. What is wrong?

var arDrone = require('ar-drone')
  ,  arDroneConstants = require('ar-drone/lib/constants')
  ;

function navdata_option_mask(c){
    return 1 << c;
}
var navdata_options = (
    navdata_option_mask(arDroneConstants.options.DEMO)

);

var drone1 = new arDrone.createClient();
drone1.config('general:navdata_demo', false);
drone1.config('general:navdata_options', navdata_options);

drone1.on('navdata', function (d) {

        console.log(d.demo.altitude);

});

And returns :

TypeError: Cannot read property 'altitude' of undefined

Have I to change something in /lib/navdata/parseNavdata.js ?

Thank you

Activate GPS navdata

Even with the Flight Recorder GPS accessory, from a cold boot the AR.Drone doesn't send GPS data as part of navdata.

The following command will cause the drone to begin including GPS data (this is what the iOS app sends):

client.config('general:navdata_options', 777060865);
// 777060865 = 101110010100010000001000000001
// The default options value is
//     65537 = 000000000000010000000000000001

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.