Matlab websocket gateway to Ar.Drone
If you have the Instrument Control Toolbox installed, you will be better of with using the native ARDrone-Matlab interface instead of MatWsDrone
.
Install tbxmananger for Matlab per the instructions on its webpage.
Then, in Matlab, run:
>> tbxmanager install matwsdrone wsclient matwebsocks matlabjson eventcollector
to install all dependencies.
Next, install the matwebsocks
library by running
>> matws_install
and restart Matlab (really, this is necessary).
Finally, install Docker and pull two images:
$ docker pull kvasnica/swsb
$ docker pull kvasnica/wspydrone
-
In the terminal window, start the Simple Websocket Broker by
$ docker run -it -p 8025:8025 kvasnica/swsb
-
Make sure your computer is connected to the Ar.Drone via wifi and start the wspydrone gateway:
$ docker run -it --net=host kvasnica/wspydrone
-
In Matlab, start the client:
>> drone = MatWsDrone()
-
Now you can communicate with the drone using one of the following commands:
drone.takeoff()
- make the drone take offdrone.hover()
- make the drone hoverdrone.halt()
- shut down the dronedrone.land()
- land the dronedrone.reset()
- emergency landingdrone.trim()
- flat trim the dronedrone.setSpeed(v)
- set the drone's speeddrone.setSampling(Ts)
- set measurement samplingdrone.move([lr, rb, vv, va])
- set speeddrone.connect()
- opens the websocket (done automatically when creating MatWsDrone() instance)drone.close()
- closes the websocket
Navigation data are transmitted from the drone at a fixed sampling rate (0.5 seconds by default, can be changed by drone.setSampling(Ts)
). The data are available in
>> drone.NavData
ans =
struct with fields:
vy: -14.0373
theta: -5
vx: 55.0681
vz: 0
psi: -53
altitude: 290
battery: 80
num_frames: 0
ctrl_state: 262144
phi: 0
To connect the client to an instance of swsb that runs on a different server, use
>> drone = MatWsDrone('ws://server:port/t/topic')
- Make sure your computer (or the one which runs the
wspydrone
gateway) is connected to the drone via wifi. - Restart
wspydrone
and/orswsb
. - Restart Matlab.
- If problems remain, submit a bug report.
- swsb - Simple Websocket Broker
- wspydrone - Websocket gateway to python-ardrone for AR.Drone firmware 1.5.1
This software is published under the terms of the MIT License: