0% found this document useful (0 votes)
103 views

A Node in Node-Red To Control Parrot Drones: Instructables

This document provides instructions for using Node-Red to control Parrot drones. It includes 4 steps: 1) Install required nodes, 2) Add a flow to control the drone, 3) Add a flow to monitor drone data, 4) View the drone interface in a browser. Wiring the nodes allows sending commands from a dashboard to control a Parrot Jumping mini drone and view its status data in real-time.

Uploaded by

ricklcy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

A Node in Node-Red To Control Parrot Drones: Instructables

This document provides instructions for using Node-Red to control Parrot drones. It includes 4 steps: 1) Install required nodes, 2) Add a flow to control the drone, 3) Add a flow to monitor drone data, 4) View the drone interface in a browser. Wiring the nodes allows sending commands from a dashboard to control a Parrot Jumping mini drone and view its status data in real-time.

Uploaded by

ricklcy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

instructables

A node in Node-Red to control Parrot drones

by alronz

Parrot has many interesting drones such as Bebop, main nodes to control and monitor the data of the
Swing, AR and the Jumping mini drones that can be drone. Currently this node supports only Parrot
controlled and monitored easily using their Android, Jumping mini drones, but the future goal is to support
IOS apps . Parrot provides also an open source SDK all other drones. In this instructable, I will show how
that can be used to write custom applications to to create a simple application using my node to
control them. In this instructable, I will show you how control Parrot Jumping race drone and to monitor its
to use Node-Red which is an open-source graphical data using a nice UI dashboard as shown in the
tool that allows users to wire together hardware screen shot. The video below shows what will be
devices, APIs and applications in an easy drag-and- produced at the end of this instructable:
drop way. Node-Red uses a set of what is called
"Nodes" that are written in javascript and can be
//www.youtube.com/embed/uxqxCBsrc5A
installed using npm. The nodes can be connected
together to produce an application. To use Node-Red
Now let's start with the steps:
to control Parrot drones, I have created a Node called
"node-red-contrib-parrot-drones" that contains two

A node in Node-Red to control Parrot drones: Page 1


Step 1: Install "node-red-contrib-parrot-drones" node in Node-Red

Install the node I created which will be used to control the Parrot drone (as of now only Jumping Drones are
supported). Use the below command:

npm i node-red-contrib-parrot-drones

Alternatively you can use "Manage palette" option in Node-Red UI and search for the node name.

Step 2: Install the dashboard UI node

Install the "node-red-contrib-ui" node using the command below:

npm install node-red-contrib-ui

Alternatively you can use "Manage palette" option in Node-Red UI and search for the node name.

Step 3: Add the control flow

Import the flow below using Node-Red UI (copy the msg;","outputs":1,"noerr":0,"x":413.5,"y":258,"wires":


text below and import it from the menu in the top right [["2225687d.0c5988"]]},
corner). This flow will allow you to control the {"id":"34fe3d0d.3a46a2","type":"debug","z":"128fc2a1.
Jumping mini drone by sending commands from the 2fc64d","name":"","active":true,"console":"false","com
dashboard that can be accessed from plete":"true","x":878.5,"y":260,"wires":[]},
http://127.0.0.1:1880/ui. {"id":"34469adb.cdf3a6","type":"ui_text_input","z":"12
8fc2a1.2fc64d","tab":"aec1e0f8.c48b4","mode":"text",
[{"id":"2225687d.0c5988","type":"drone- "delay":300,"name":"Speed","topic":"speed","group":"
control","z":"128fc2a1.2fc64d","name":"Drone Movement","order":1,"x":76.5,"y":146,"wires":
Control","settings":"c1e2cbff.a51ca8","x":619.5,"y":25 [["98cd5977.c430c8"]]},
5,"wires":[["34fe3d0d.3a46a2"]]}, {"id":"98cd5977.c430c8","type":"function","z":"128fc2
{"id":"7747f1b8.aadc6","type":"function","z":"128fc2a1 a1.2fc64d","name":"","func":"\nflow.set('speed',msg.p
.2fc64d","name":"","func":"msg.command = ayload);\n\nreturn
msg.payload;\nmsg.payload = {};\n\nvar speed =
flow.get('speed') || 0;\n\nmsg.payload.speed =
speed;\nreturn

A node in Node-Red to control Parrot drones: Page 2


msg;","outputs":"1","noerr":0,"x":219,"y":145,"wires": Animation Stop\n\n\n\n Slalom\n\n\n\n Spiral\n\n\n\n
[[]]}, Spin Posture\n\n\n\n Spin Jump\n\n\n\n
{"id":"ef8de3aa.e35a9","type":"ui_button_row","z":"12 Ondulation\n\n\n\n Metronome\n\n\n\n Slow
8fc2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Up- Shake\n\n\n\n Tap\n\n\n\n Spin\n\n\n\n Long Jump
Right","topic":"","group":"Movement","order":1,"toggle Kicker\n\n\n\n Long Jump Jumper\n\n\n\n High
":false,"buttons": Jump\n","storeOutMessages":true,"fwdInMessages":t
[{"payload":"forward","icon":"keyboard_arrow_up","col rue,"x":81.5,"y":453,"wires":[["7747f1b8.aadc6"]]},
or":"Blue","on_icon":"alarm_on","on_color":"red"}, {"id":"e17316ed.020258","type":"ui_template","z":"128
{"payload":"right","icon":"keyboard_arrow_right","color fc2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Postur
":"Blue","on_icon":"keyboard_arrow_down","on_color es","group":"Posture","order":1,"format":"\n
":"Blue"}],"inputs":0,"x":81.5,"y":204,"wires": Kicker\n\n\n\n Jumper\n\n\n\n
[["7747f1b8.aadc6"]]}, Standing\n","storeOutMessages":true,"fwdInMessage
{"id":"457c0395.e4103c","type":"ui_button_row","z":"1 s":true,"x":68.5,"y":379,"wires":[["7747f1b8.aadc6"]]},
28fc2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Do {"id":"c4c919df.d8cc08","type":"ui_template","z":"128f
wn- c2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Media",
Left","topic":"","group":"Movement","order":1,"toggle":f "group":"Media","order":1,"format":"\n Take
alse,"buttons": Picture\n\n\n\n Get Video
[{"payload":"backward","icon":"keyboard_arrow_down
","color":"Blue","on_icon":"alarm_on","on_color":"red"
},
{"payload":"left","icon":"keyboard_arrow_left","color":"
Blue","on_icon":"keyboard_arrow_down","on_color":"
Blue"}],"inputs":0,"x":81,"y":259,"wires":
[["7747f1b8.aadc6"]]},
{"id":"3c81b436.8cff3c","type":"ui_button_row","z":"12
8fc2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Stop"
,"topic":"","group":"Movement","order":1,"toggle":false
,"buttons":
[{"payload":"stop","icon":"clear","color":"Blue","on_ico
n":"alarm_on","on_color":"red"}],"inputs":0,"x":71,"y":3
11,"wires":[["7747f1b8.aadc6"]]},
{"id":"c0378e04.5fddd","type":"ui_template","z":"128fc
2a1.2fc64d","tab":"aec1e0f8.c48b4","name":"Animati
ons","group":"Animations","order":1,"format":"\n

Step 4: Add the data flow

A node in Node-Red to control Parrot drones: Page 3


Import the flow below using Node-Red UI (copy the Data","settings":"c1e2cbff.a51ca8","x":124,"y":254,"wi
text below and import it from the menu in the top right res":[["40d7160b.ec11b8","df9a2af4.9817d8"]]},
corner). This flow will allow you to monitor the data of {"id":"40d7160b.ec11b8","type":"debug","z":"c560f4ff.
the Jumping mini drone. The data can be shown in b48658","name":"","active":true,"console":"false","co
the dashboard that can be accessed from mplete":"true","x":226.5,"y":405,"wires":[]},
http://127.0.0.1:1880/ui. {"id":"d48ed1a5.b6436","type":"ui_text","z":"c560f4ff.b
48658","tab":"aec1e0f8.c48b4","name":"Posture
[{"id":"1a312d3.7f9ead3","type":"drone-
data","z":"c560f4ff.b48658","name":"Drone

Status","group":"Data","order":1,"format":" Status","group":"Data","order":1,"format":"
{{msg.payload.posture}}","x":747,"y":238,"wires":[]}, {{msg.payload.batteryStatus}}","x":740.5,"y":185,"wire
{"id":"63758a61.c32d54","type":"ui_text","z":"c560f4ff. s":[]},
b48658","tab":"aec1e0f8.c48b4","name":"Drone {"id":"df9a2af4.9817d8","type":"switch","z":"c560f4ff.b
Status","group":"Data","order":1,"format":" 48658","name":"","property":"topic","propertyType":"m
{{msg.payload.status}}","x":734.5,"y":289,"wires":[]}, sg","rules":[{"t":"eq","v":"batteryPercentage","vt":"str"},
{"id":"e8dc38cc.64e188","type":"ui_text","z":"c560f4ff. {"t":"eq","v":"batteryStatus","vt":"str"},
b48658","tab":"aec1e0f8.c48b4","name":"Jump Load {"t":"eq","v":"posture","vt":"str"},
Status","group":"Data","order":1,"format":" {"t":"eq","v":"status","vt":"str"},
{{msg.payload.jumpLoad}}","x":759.5,"y":343,"wires": {"t":"eq","v":"jumpLoad","vt":"str"},
[]}, {"t":"eq","v":"jumpMotor","vt":"str"},
{"id":"9310d160.4c77d","type":"ui_text","z":"c560f4ff.b {"t":"eq","v":"message","vt":"str"}],"checkall":"true","ou
48658","tab":"aec1e0f8.c48b4","name":"Jump Motor tputs":7,"x":344,"y":255,"wires":[["8209fbee.1afdb8"],
Status","group":"Data","order":1,"format":" ["3742a1ee.5b2ebe"],["d48ed1a5.b6436"],
{{msg.payload.jumpMotor}}","x":752.5,"y":402,"wires": ["63758a61.c32d54"],["e8dc38cc.64e188"],
[]}, ["9310d160.4c77d"],
{"id":"d5ee8c50.8f28b","type":"ui_text","z":"c560f4ff.b ["d5ee8c50.8f28b","eb5f127c.3ed38","1ba3b1fb.5c0b
48658","tab":"aec1e0f8.c48b4","name":"Messages"," ce"]]},
group":"Data","order":1,"format":" {"id":"eb5f127c.3ed38","type":"switch","z":"c560f4ff.b4
{{msg.payload.message}}","x":730.5,"y":458,"wires": 8658","name":"","property":"payload.buf","propertyTy
[]}, pe":"msg","rules":
{"id":"3742a1ee.5b2ebe","type":"ui_text","z":"c560f4ff. [{"t":"nnull"}],"checkall":"true","outputs":1,"x":368,"y":5
b48658","tab":"aec1e0f8.c48b4","name":"Battery 13,"wires":[["7e79f4c2.bfd0ec"]]},
{"id":"c8897980.48bd18","type":"debug","z":"c560f4ff.
b48658","name":"","active":true,"console":"false","co
mplete":"true","x":719.5,"y":660,"wires":[]},
{"id":"7e79f4c2.bfd0ec","type":"function","z":"c560f4ff.
b48658","name":"","func":"var originalBuf =
msg.payload.buf;\nvar buf = new
Buffer(originalBuf);\nmsg.payload =
buf;\nmsg.payload.image = true;\nreturn

msg;\n","outputs":1,"noerr":0,"x":515,"y":521,"wires": Percentage","group":"Data","order":1,"format":"
[["da8b21cb.331d2","c8897980.48bd18"]]}, {{msg.payload.batteryPercentage}}","x":742.5,"y":126,
{"id":"b7c91a07.d30a18","type":"ui_template","z":"c56 "wires":[]},{"id":"c1e2cbff.a51ca8","type":"drone-
0f4ff.b48658","tab":"aec1e0f8.c48b4","name":"","grou config","z":"","ip":"192.168.2.1","droneType":"Jumping
p":"Image","order":1,"format":"","storeOutMessages":t
rue,"fwdInMessages":true,"x":1002,"y":616,"wires":
[[]]},
{"id":"da8b21cb.331d2","type":"switch","z":"c560f4ff.b

A node in Node-Red to control Parrot drones: Page 4


48658","name":"","property":"payload.image","propert
yType":"msg","rules":
[{"t":"true"}],"checkall":"true","outputs":1,"x":671,"y":52
1,"wires":[["86a6069c.3b2b18"]]},
{"id":"1ba3b1fb.5c0bce","type":"debug","z":"c560f4ff.b
48658","name":"","active":true,"console":"false","com
plete":"true","x":177.5,"y":579,"wires":[]},
{"id":"86a6069c.3b2b18","type":"base64","z":"c560f4ff
.b48658","name":"","x":861,"y":542,"wires":
[["b7c91a07.d30a18"]]},
{"id":"8209fbee.1afdb8","type":"ui_text","z":"c560f4ff.b
48658","tab":"aec1e0f8.c48b4","name":"Battery

Step 5: Connect to the drone

Switch on the drone and connect to its wifi network.

Step 6: Start the node-red flow

Start the Node-Red flow be clicking the "deploy" red button in the right top corner.

Step 7: Control and monitor the drone from browser

You can now control the drone easily and access its data including video frames "images" from the dashboard that
can be accessed using "http://127.0.0.1:1880/ui" as shown in the screen shot.

A node in Node-Red to control Parrot drones: Page 5


Step 8: Be creative !

There are many great IBM Watson services that have nodes in Node-Red and can be integrated with my node to
produce cool ideas. Examples are below:

Use Speech-to-Text, Text-to-Speech nodes to control and interact with your drone.
Use Visual Recognition node to identify objects, faces, and images returned by the drone and
control the drone accordingly.
Ofcourse, you can control your drone from the internet using IBM IoT platform using this node.
Control the drone based on user mood and behavior using Personality Insights, or Tone Analyzer
nodes.
Sky is the limit, please see the other possible nodes.

Please contact me for any issues or questions at [email protected]

Thanks Ahmed :)

Viel Erfolg

Thanks Basma :)

Thanks for sharing :)

Thanks Swansong :)

A node in Node-Red to control Parrot drones: Page 6


A node in Node-Red to control Parrot drones: Page 7

You might also like