Most of the text is almost literally transcribed from the AR.Drone Developer Guide (SDK 2.0). For further information see http://developer.parrot.com/.
Controlling the AR.Drone is done through 3 main communication services.
Controlling and configuring the drone is done by sending AT commands on UDP port 5556. The transmission latency of the control commands is critical to the user experience. Those commands are to be sent on a regular basis (usually 30 times per second). The list of available commands and their syntax is discussed in chapter 6.
Information about the drone (like its status, its position, speed, engine rotation speed, etc.), called navdata, are sent by the drone to its client on UDP port 5554. These navdata also include tags detection information that can be used to create augmented reality games. They are sent approximatively 15 times per second in demo mode, and 200 times per second in full (debug) mode.
A video stream is sent by the AR.Drone to the client device on port 5555 (UDP for AR.Drone 1.0 , TCP for AR.Drone 2.0 ). Images from this video stream can be decoded using the codec included in this SDK. Its encoding format is discussed in section 7.2.
A fourth communication channel, called control port, can be established on TCP port 5559 to transfer critical data, by opposition to the other data that can be lost with no dangerous effect. It is used to retrieve configuration data, and to acknowledge important information such as the sending of configuration information.
The AR.Drone 2.0 can be controlled from any client device supporting Wifi. The following process is followed :
- the AR.Drone creates a WIFI network with an ESSID usually called adrone2\_xxx and self allocates a free, odd IP address (typically 192.168.1.1).
- the user connects the client device to this ESSID network.
- the client device requests an IP address from the drone DHCP server.
- the AR.Drone DHCP server grants the client with an IP address which is the drone own IP address plus a number between 1 and 4.
- the client device can start sending requests the AR.Drone IP address and its services ports.
Changing the Wifi channel
The AR.Drone uses the WIFI channel 6 by default. This can be changed through a telnet connection with:
- telnet 192.168.1.1
- iwconfig ath0 channel 8 commit
Channel 8 is usually the best one in the lab.
After the robot is reset the channel will be back to number 6.
AR.Drone 2.0 use H264 (MPEG4.10 AVC) baseline profile for high quality video streaming and video recording.
The following parameters can be adjusted for the live H264 stream :
- FPS : Between 15 and 30
- Bitrate : Between 250kbps and 4Mbps
- Resolution : 360p (640x360) or 720p (1280*720)
These parameters are fixed to 720p, 30FPS, 4Mbps for the record stream, regardless of the device.
AR.Drone 2.0 video stream is transmitted on TCP socket 5555. AR.Drone 2.0 will start sending frame immediatly when a client connects to the socket.
When using the bitrate control mode in VBC_MANUAL, sets the bitrate of the video transmission (kilobits per second). Typical values range from 500 to 4000 kbps, Default is 1000 kbps.
Note: This value is dynamically changed when bitrate_control_mode is set to VBC_MODE_DYNAMIC.
Maximum bitrate that the device can decode. This is set as the upper bound for drone bitrate values. Default value is 4000 kbps.
Note: When using the bitrate control mode in VBC_MANUAL, this maximum bitrate is ignored.
Note : When using the bitrate control mode in VBC_MODE_DISABLED, the bitrate is fixed to this maximum bitrate.
Enables the automatic bitrate control of the video stream. Enabling this configuration will reduce the bandwidth used by the video stream under bad Wi-Fi conditions, reducing the commands latency.
Possible values are (see ardrone_api.h):
- VBC_MODE_DISABLED Bitrate set to max_bitrate.
- VBC_MODE_DYNAMIC Video bitrate varies in bytes per frame [250;max_bitrate] kbps
- VBC_MANUAL Video stream bitrate is fixed by the bitrate key.
In ardrone_api.h it can be found:
VBC_MODE_DISABLED = 0, /*<! no video bitrate control */
VBC_MODE_DYNAMIC, /*<! video bitrate control active */
VBC_MANUAL /*<! video bitrate control active */
Thus, VBC_MODE_DISABLED = 0, VBC_MODE_DYNAMIC = 1 and VBC_MANUAL = 2.
ROS: the ardrone_autonomy node
Decreasing the video latency
The ROS node ardrone_autonomy (http://ardrone-autonomy.readthedocs.org/en/) can configure the bittrate, max_bitrate and bitrate_control_mode parameters.
This can be done by changing the code and recompiling in the file ./src/ardrone_sdk.cpp (line 93) as:
ardrone_application_default_config.bitrate_ctrl_mode = VBC_MODE_DYNAMIC;
ardrone_application_default_config.max_bitrate = 1000;
It can also be done through the corresponding ROS parameters "bitrate_ctrl_mode" and "max_bitrate", as in the launch file "ardrone.launch", with the lines:
<param name="max_bitrate" value="1000" />