Skip to content

Instantly share code, notes, and snippets.

@miya0001
Last active January 30, 2019 18:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miya0001/b28f39e71e6dc0ca1a6b72cf6e2628ed to your computer and use it in GitHub Desktop.
Save miya0001/b28f39e71e6dc0ca1a6b72cf6e2628ed to your computer and use it in GitHub Desktop.
Tello + Node.js example
#!/usr/bin/env node
'use strict'
const PORT = 8889;
const HOST = '192.168.10.1';
const dgram = require('dgram');
const client = dgram.createSocket('udp4');
const sendCommand = (command) => {
const message = Buffer.from(command);
client.send(message, 0, message.length, PORT, HOST, (err, bytes) => {
if (err) throw err;
});
}
// See official documentation.
// https://dl-cdn.ryzerobotics.com/downloads/tello/20180910/Tello%20SDK%20Documentation%20EN_1.3.pdf
sendCommand('command')
// 離陸
sendCommand('takeoff')
// 5秒後に時計回りで180度
setTimeout(() => {
sendCommand('cw 180')
}, 5000)
// 10秒後に着陸
setTimeout(() => {
sendCommand('land')
}, 10000)
@miya0001
Copy link
Author

試し方

  • Node.js をインストール https://nodejs.org/ja/
  • このファイルを任意のファイル名でパソコンに保存
  • PCをTelloのWifiに接続する
  • cmd.exe (Windows)またはTerminal.app(Mac)で以下のコマンドを実行する
node path/to/tello.js

path/to/tello.js の部分はファイル名。たとえばデスクトップに保存した場合は ~/Desktop/tello.js になります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment