Code Monkey home page Code Monkey logo

nodetello's People

Contributors

sovgvd 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodetello's Issues

Question: stick position

Hi @SovGVD

I've been combing through your repo trying to get something in JS to use the low-level packet API.

I had a question about this bit in your code:

// TODO... this string manipulation is soooo slow!
var tmp_roll     = "00000000000"+(parseInt(1024 + 660 * this.stickData.roll) & 0x07ff).toString(2); tmp_roll=tmp_roll.substr(-11);
var tmp_pitch    = "00000000000"+(parseInt(1024 + 660 * this.stickData.pitch) & 0x07ff).toString(2); tmp_pitch=tmp_pitch.substr(-11);
var tmp_throttle = "00000000000"+(parseInt(1024 + 660 * this.stickData.throttle) & 0x07ff).toString(2); tmp_throttle=tmp_throttle.substr(-11);
var tmp_yaw      = "00000000000"+(parseInt(1024 + 660 * this.stickData.yaw) & 0x07ff).toString(2); tmp_yaw=tmp_yaw.substr(-11);
//var tmp_boost    = "00000000000"+(parseInt(1024 + 660 * 0)).toString(2);

Why are you adding 11 0's and then substr'ing them right off immediately after?

I realise this is code ported from go & python and whatever else is out there, but I'm a bit confused about the stick position packets and that's the bit I need to get working :)

Cheers

Add note about installing mplayer first?

Hi, when I ran node app.js on a Mac, I got:

Error: spawn mplayer ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:19)
...

I solved this by installing mplayer (with brew install mplayer). Perhaps it might be worth mentioning this in the README in case others might come across it too?

Dangerous bitwise manipulation in nodetello.js

The following code

nodetello/lib/nodetello.js

Lines 408 to 410 in 66ae74e

this.setStickData = function(fast, roll, pitch, thr, yaw){
this.stickData = (fast << 44) | (yaw << 33) | (thr << 22) | (pitch << 11) | (roll)
}

is considered potentially dangerous because:

  1. All numbers in JavaScript are represented as double1, which means you can only have integers in the range [โˆ’253, +253],
  2. (Most important) bitwise operators treat their operands as a sequence of 32 bits2 and return a signed 32-bit integer3, so the code (fast << 44) | (yaw << 33) will not work as expected. (Actually, you can try 1 << 32 and see how it goes)

Since this code is used to control the drone, IMO it's really dangerous and may hurt users. How do you think?

Refs:

  1. Number value - ECMAScript Latest Draft (ECMA-262)
  2. Bitwise operators - MDN
  3. The Left Shift Operator - ECMAScript Latest Draft (ECMA-262)

Cannot start the app.js

when I try to start the app.js with node app.js
the following error happens:

(node:25512) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
tello_control listening 0.0.0.0:51615
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'D:\nodetello\video\1535987841691.video.h264'
Emitted 'error' event at:
    at lazyFs.open (internal/fs/streams.js:273:12)
    at FSReqWrap.oncomplete (fs.js:139:20)

Hope to know if I am having an issue or not, any way to fix that? Thanks

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.