Programming the AR Parrot V2 Drone Using Node.js & JavaScript PDF
Document Details
Uploaded by PamperedSequence
Ronni Kahalani
Tags
Summary
This document describes how to program an AR Parrot V2 drone, focusing on the use of Node.js and Javascript. It provides API details, system ports, and example code snippets for controlling the drone and using available tools. The document also includes various drone types and applications.
Full Transcript
PROGRAMMING THE AR PARROT V2 DRONE USING NODEJS & JAVASCRIPT 2016-08-12 12:15:53 Loading resources...Ok 2016-08-12 12:15:54 Connecting to drone at 192.168.1.1...Ok 2016-08-12 12:15:56 Streaming video from front camera. 2016-08-12 12:15:59 Ready for action...I’m gonna have me some fun ! W...
PROGRAMMING THE AR PARROT V2 DRONE USING NODEJS & JAVASCRIPT 2016-08-12 12:15:53 Loading resources...Ok 2016-08-12 12:15:54 Connecting to drone at 192.168.1.1...Ok 2016-08-12 12:15:56 Streaming video from front camera. 2016-08-12 12:15:59 Ready for action...I’m gonna have me some fun ! WEBSOCKET EMIT TELNET VIDEO SIGNAL COMMANDS & CONFIGURATION FTP DATA & STATUS WEBSOCKET EMIT COMMANDS & DATA & STATUS CONFIGURATION mydroneserver DRONE CLIENT PROXY ar-drone TechPlay A social creative platform, where we explore technologies and make dreams come true WHERE DRONES ARE USED TODAY The military, firefighters and police The private toy & gadget market Nature- and human disasters Postal and packaging industry Doctors Without Borders Nature parks fighting poaching, animal Agriculture control (drone guards / shepherds) The insurance industry Security and surveillance industry Photographers and media professionals Property brokers Transport industry (control of vehicles, Research and environmental monitoring aircraft and ships) Sports events Construction industry Media and entertainment industry Oil and natural resource industries DIY: Do It Yourself products WHERE ELSE COULD DRONES BENEFIT US? THE HUMAN CARRIER DRONE IS HERE! TOP DRONE PRODUCERS CAMERA DRONES DJI PHANTOM 4 DJI PHANTOM 3 SERIES DJI INSPIRE 1 WITH 4K YUNEEC Q500 4K 3DR SOLO PARROT BEBOP RACER DRONES TBS VENDETTA IMMERSIONRC VORTEX 285 IMMERSIONRC VORTEX 250 PRO LUMENIER QAV250 EACHINE RACER 250 PLAY DRONES SYMA X5C HUBSAN X4 BLADE NANO QX OUR DRONE FOR TODAY! LATRAX ALIAS PARROT AR DRONE 2.0 PROTO X FREEFLIGHT - SMARTPHONE APP AR PARROT V2 DRONE SPECS 1GHz 32 bit ARM Cortex A8 processor with 800MHz video DSP TMS320DMC64x 1GB DDR2 RAM at 200 MHz Linux 2.6.32 (BusyBox) Wi-Fi USB 2.0 high speed for extensions 3 axis gyroscope 2000°/second precision 3 axis accelerometer +-50mg precision 3 axis magnetometer 6° precision Pressure sensor +/- 10 Pa precision Ultrasound sensors for ground altitude measurement 60 FPS vertical QVGA camera for ground speed measurement AR PARROT DRONE V2 BusyBox 2.6.32 SYSTEM PORTS Default IP: 192.168.1.1 DATA USB GPS USB WI-FI HUB Telnet Ftp Navdata UDP Video Stream Control UDP Raw Capture TCP Console TCP Control port:23 port:5551 port:5554 port:5555 port:5556 port:5557 port:5558 port:5559 Ftp / FileZilla AT* Commands AT*REF- for takeoff, landing, reset and emergency stop AT*PCMD- for motion, roll, pitch, gaz and yaw AT*FTRIM- sets the reference for the horizontal plane AT*CONFIG- configures the drone AT*CONFIG_IDS- used as identifiers for AT*CONFIG commands AT*LED- sets a LED animation on drone AT*ANIM- sets a flight animation gesture on the drone AT*COMWDG- resets the communication watchdog (debugging) And more… Telnet / puTTYtel Data messages (telemetry) Video via Java, Javascript, FFmpeg... { "header": 1432778632, "droneState": { "flying": 0, "videoEnabled": 0, "visionEnabled": 0, "cameraReady": 1, "travellingEnabled": 0, "usbReady": 0, "motorProblem": 0, cat /data/config.ini "communicationLost": 0, "softwareFault": 0, cat /proc/cpuinfo "lowBattery": 0, cat /proc/meminfo...... and lots of subscribable data sections NODEJS AND JAVASCRIPT API NodeJS is a popular plugin-based JavaScript server platform, which runs locally. Many developers know or have heard of it and it’s a great platform for experiments. Download NodeJS, if it’s not installed. When NodeJS is installed, we need to install the ar-drone NodeJS plugin: Open a NodeJS console and change to your home folder e.g. “C:\Users\”, on Windows 10. Run: npm install ar-drone Later on, you can try the more mission oriented control API ardrone-atonomy NODEJS AND JAVASCRIPT API BEFORE RUNNING ANY DRONE CODE Make sure you have enough space for playing with the drone Create a NodeJS project, in your favorite IDE or a JavaScript file that runs in the context of NodeJS Prepare to leave the Internet, when you connect to the drone WiFi Connect the computer to the drone Wi-Fi Try to telnet (port:23) or ftp (port:5551) on the default host IP 192.168.1.1 (anonymously) RUNNING THE AR-DRONE EXAMPLES Open a NodeJS console, in the folder: \node_modules\ar-drone\examples Run node simpleFlight.js MAKE SURE THE DRONE HAS ENOUGH SPACE TO TAKEOFF !! A “HELLO WORLD” SNIPPET var drone = require("ar-drone"); var client = drone.createClient(); client.takeoff(); client.after(5000, function() { this.clockwise(0.5); }).after(3000, function() { this.stop(); this.land(); }); PROGRAMMING THE DRONE IS EASY! Made this web based drone console, with NodeJS, JQuery, Angular, Web Sockets, WebGL..., in less than a week and I was totally in flow, just like when I played with Lego as a child. THE MISSION PANEL Making it possible to define a mission queue and send a timed and specific navigation-, configuration- and LED mission to the drone, including waiting between commands. THE NAVIGATION PANEL The drone has a set of cool animation gestures, which can be used via the API and the Freeflight mobile app. THE CONFIGURATION PANEL YOU CAN CONFIGURE LOTS OF SETTINGS FOR THE DRONE. general:navdata_demo control:control_level gps:latitude general:navdata_options control:euler_angle_max gps:latitude general:ardrone_name control:control_iphone_tilt gps:altitude general:com_watchdog control:control_vz_max control:control_yaw network:ssid_single_player leds:leds_anim control:outdoor network:ssid_multi_player control:flight_without_shell network:wifi_rate video:video_channel control:indoor_euler_angle_max network:owner_mac video:codec_fps control:indoor_control_vz_max network:wifi_mode video:video_codec control:indoor_control_yaw video:video_slices control:outdoor_euler_angle_max detect:detections_select_h video:video_live_socket control:outdoor_control_vz_max detect:detections_select_v video:bitrate control:outdoor_control_yaw detect:detections_select_v_hsync video:max_bitrate control:flying_mode detect:detect_type video:bitrate_control_mode control:flight_anim detect:enemy_colors video:bitrate_storage control:hovering_range detect:groundstripe_colors video:video_on_usb control:altitude_min detect:enemy_without_shell video:video_file_index control:altitude_max THERE ARE MORE SETTINGS, ON THE DRONE FILE SYSTEM. Via telnet you can access files like, cat /data/config.ini cat /proc/cpuinfo cat /proc/meminfo And a lot of other files and settings. NAVDATA The drone sends a variety of categorized and subscription-enabled data entities Here are some of the them – droneState, demo , rawMeasures, physMeasures, gyroOffsets, eularAngles, references, trims, pwm, altitude, visionRaw, vision, visionPerf, trackersSend, visionDetect, adcDataFrame, videoStream, games, pressureRaw, magneto, windSpeed, kalmanPressure, hdvideoStream, wifi, gps... USING THE DRONE NAVDATA // JS BACKEND: SUBSCRIBING TO NAVDATA FROM THE DRONE, ON THE SERVER SIDE. var drone = require("ar-drone"); var constants = require("ar-drone/lib/constants"); var client = drone.createClient(); var options = ( 1