Created
January 25, 2019 23:43
-
-
Save dbaldwin/d53e92f2bfe4f42e7a55d3e99ad9df71 to your computer and use it in GitHub Desktop.
Node-RED Flow for Sending Commands to Tello and Receiving Responses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"2e9fa6db.59b79a","type":"tab","label":"Send Command and Wait for Response to Proceed","disabled":false,"info":""},{"id":"ceb0910c.e28dd","type":"debug","z":"2e9fa6db.59b79a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":770,"y":80,"wires":[]},{"id":"cc7f1214.9bc0a","type":"inject","z":"2e9fa6db.59b79a","name":"","topic":"","payload":"command takeoff land","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":180,"wires":[["fdc7329e.d0c75"]]},{"id":"f362f3e3.67806","type":"function","z":"2e9fa6db.59b79a","name":"Simple triggered queue","func":"// if queue doesn't exist, create it\ncontext.queue = context.queue || [];\ncontext.busy = context.busy || false;\n\n// if the msg is a trigger one release next message\nif (msg.hasOwnProperty(\"trigger\")) {\n if (context.queue.length > 0) {\n var m = context.queue.shift();\n return {payload:m};\n }\n else {\n context.busy = false;\n }\n}\nelse {\n if (context.busy) {\n // if busy add to queue\n context.queue.push(msg.payload);\n }\n else {\n // otherwise we are empty so just pass through and set busy flag\n context.busy = true;\n return msg;\n }\n}\n\nreturn null;","outputs":1,"noerr":0,"x":450,"y":140,"wires":[["ceb0910c.e28dd","ad0d47b8.271348"]]},{"id":"bb905f09.5fb23","type":"function","z":"2e9fa6db.59b79a","name":"set trigger","func":"// handle the return from the exec in here \n// if all is good then set msg.trigger property to exist\nmsg.trigger = 1;\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":360,"wires":[["f362f3e3.67806"]]},{"id":"ad0d47b8.271348","type":"udp out","z":"2e9fa6db.59b79a","name":"","addr":"192.168.10.1","iface":"","port":"8889","ipv":"udp4","outport":"9000","base64":false,"multicast":"false","x":610,"y":220,"wires":[]},{"id":"82928eb.a5c357","type":"udp in","z":"2e9fa6db.59b79a","name":"","iface":"","port":"9000","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":140,"y":360,"wires":[["2f4f7992.f10396"]]},{"id":"fdc7329e.d0c75","type":"split","z":"2e9fa6db.59b79a","name":"","splt":" ","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":250,"y":80,"wires":[["f362f3e3.67806"]]},{"id":"2f4f7992.f10396","type":"switch","z":"2e9fa6db.59b79a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ok","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":360,"wires":[["bb905f09.5fb23"],["5d0ba82.301d258","a9b1d93b.5062e8"]]},{"id":"5d0ba82.301d258","type":"play audio","z":"2e9fa6db.59b79a","name":"","voice":"","x":470,"y":420,"wires":[]},{"id":"a9b1d93b.5062e8","type":"debug","z":"2e9fa6db.59b79a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":480,"wires":[]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment