clydemcqueen / tello_ros

C++ ROS2 driver for DJI Tello drones
BSD 3-Clause "New" or "Revised" License
193 stars 65 forks source link
ros2 ryze tello

tello_ros

tello_ros is a ROS2 driver for Tello and Tello EDU drones.

Packages

There are 4 ROS packages:

Interface

Overview

The driver is designed to very simple while making it easy to integrate Tello drones into the ROS ecosystem.

The driver communicates with the drone using the Tello SDK, which has several advantages:

Many Tello commands (e.g., takeoff and land) are long-running, and the drone returns ok or error on completion. The driver provides the ROS service tello_command to initiate commands, and the corresponding ROS topic tello_response to indicate command completion.

Per ROS convention, the driver also responds to Twist messages on the cmd_vel topic. These are translated into rc commands and sent to the drone. Velocity values are arbitrarily mapped from [-1.0, 1.0] to [-100, 100]. This may change in the future.

The driver parses telemetry data and sends it on the flight_data topic. The presence of telemetry data is a good indicator that the drone is connected.

The driver parses the video stream and sends images on the image_raw topic. Camera information is sent on the camera_info topic.

The Tello drones have a sophisticated visual odometry system and an onboard IMU, but there's minimal access to these internal systems. The driver does not publish odometry.

Additional notes:

Services

Subscribed topics

Published topics

Parameters

The defaults work well for a single Tello drone.

Name Description Default
drone_ip Send commands to this IP address 192.168.10.1
drone_port Send commands to this UDP port 8889
command_port Send commands from this UDP port 38065
data_port Flight data (Tello state) will arrive on this UDP port 8890
video_port Video data will arrive on this UDP port 11111

Installation

1. Set up your Linux environment

Set up a Ubuntu 20.04 box or VM.

Also install asio:

sudo apt install libasio-dev

2. Set up your ROS environment

Install ROS2 Foxy with the ros-foxy-desktop option.

If you install binaries, be sure to also install the development tools and ROS tools from the source installation instructions.

Install these additional packages:

sudo apt install ros-foxy-cv-bridge ros-foxy-camera-calibration-parsers

3. Install tello_ros

Download, compile and install tello_ros:

mkdir -p ~/tello_ros_ws/src
cd ~/tello_ros_ws/src
git clone https://github.com/clydemcqueen/tello_ros.git
git clone https://github.com/ptrmu/ros2_shared.git
cd ..
source /opt/ros/foxy/setup.bash
# If you didn't intall Gazebo, skip tello_gazebo while building:
colcon build --event-handlers console_direct+ --packages-skip tello_gazebo

Teleop

The driver provides a simple launch file that will allow you to fly the drone using a wired XBox One gamepad.

Turn on the drone, connect to TELLO-XXXXX via wi-fi, and launch ROS:

cd ~/tello_ros_ws
source install/setup.bash
ros2 launch tello_driver teleop_launch.py

Hit the XBox One menu button to take off, and the view button to land.

If you don't have an XBox One gamepad, you can send commands using the ROS2 CLI:

ros2 service call /tello_action tello_msgs/TelloAction "{cmd: 'takeoff'}"
ros2 service call /tello_action tello_msgs/TelloAction "{cmd: 'rc 0 0 0 20'}"
ros2 service call /tello_action tello_msgs/TelloAction "{cmd: 'land'}"
ros2 service call /tello_action tello_msgs/TelloAction "{cmd: 'battery?'}"

You can also send cmd_vel messages:

ros2 topic pub /cmd_vel geometry_msgs/Twist  # Sends rc 0 0 0 0
ros2 topic pub /cmd_vel geometry_msgs/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.2}}"

Devices tested

Versions and branches

tello_ros was developed along with several other projects while ROS2 was rapidly changing. All of the related projects adopted similar conventions around branch names:

The following projects and branches were tested together:

Credits

The h264decoder is from: https://github.com/DaWelter/h264decoder

Resources

Tello SDK errata