Skip to content

Latest commit

 

History

History
356 lines (256 loc) · 8.82 KB

File metadata and controls

356 lines (256 loc) · 8.82 KB

DJITelloROS

License ROS Version Python

简体中文 | English

A ROS (Robot Operating System) driver project for DJI Tello drones, providing full drone control, telemetry data reception, and video stream processing.

Overview

DJITelloROS is a Tello drone driver developed with Python 3 and ROS Noetic, using the DJITelloPy library as the underlying interface. The project features a modular design, including message definitions, driver nodes, teleoperation nodes, and robot descriptions.

Features

  • Full drone control support (takeoff, land, move, flip)
  • Real-time telemetry data reception (battery, attitude, speed, altitude, temperature, etc.)
  • Video stream processing and publishing
  • Joystick control support (XBox compatible)
  • Standard ROS interfaces and message types
  • URDF robot model description

Project Structure

tello_ws/                      # ROS workspace root
├── build/                     # Build intermediate files
├── devel/                     # Build executables and environment variables
├── logs/                      # Build logs
└── src/                       # Source code directory
    └── tello_base/            # Project root directory (Git repository)
        ├── tello_driver/      # Tello hardware driver package
        ├── tello_teleop/      # Tello teleoperation package
        ├── tello_description/ # Tello URDF robot description
        ├── tello_msgs/        # Tello custom message types
        └── tello_base/        # Tello meta-package

Test Environment

  • Operating System: Ubuntu 20.04
  • ROS: ROS Noetic
  • Python: 3.8
  • Drone: RoboMaster Tello Talent (RMTT)

Dependencies

ROS Dependencies

ROS dependencies can be automatically installed via the meta-package. To install individually:

sudo apt install -y \
    ros-noetic-cv-bridge \
    ros-noetic-geometry-msgs \
    ros-noetic-sensor-msgs \
    ros-noetic-std-msgs \
    ros-noetic-joy \
    ros-noetic-rospy \
    ros-noetic-visualization-msgs

Python Dependencies

Option 1: Using Conda (Recommended)

The Conda environment automatically installs all necessary packages, including ROS build dependencies:

# Create and activate conda environment
conda env create -f environment.yml
conda activate tello

Included packages:

  • Core dependencies: djitellopy, numpy, opencv-python, pillow, av
  • ROS related: empy, catkin_pkg, yaml, pyyaml, rospkg
  • Build tools: uv, pip

Option 2: Installation without Conda

Use pip to install core dependencies only; ROS-related dependencies should be installed via the system package manager:

# Install core Python dependencies
pip install -r requirements.txt

# Install ROS-related Python dependencies
pip install empy catkin_pkg pyyaml rospkg

Core dependencies:

  • djitellopy
  • opencv-python
  • numpy
  • pillow
  • av

ROS-related dependencies:

  • empy
  • catkin_pkg
  • pyyaml
  • rospkg

Installation

1. Create catkin workspace

mkdir -p ~/tello_ws/src
cd ~/tello_ws/src
git clone https://github.com/FallThrive/DJITelloROS.git tello_base

2. Initialize and Build

Using catkin_tools (Recommended):

# Initialize catkin_tools (required for first use)
cd ~/tello_ws/src
catkin init

# Build workspace
catkin build

Or using catkin_make (Legacy):

cd ~/tello_ws/src
catkin_make

3. Source Workspace

source devel/setup.bash

Or add to ~/.bashrc:

echo "source ~/tello_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

Usage

Connecting Tello

  1. Connect to Tello's WiFi network (TELLO-XXXXXX)
  2. Ensure Tello is powered on

Joystick Control

Check joystick mapping accuracy before first use!

1. Check Joystick Device

# List all connected input devices
ls /dev/input/js*

# Test joystick device (X is the device number, usually 0)
sudo jstest /dev/input/jsX

Press buttons and axes to confirm responsiveness.

2. View Joystick Input

Start joy_node and view input:

# Start joy_node
rosrun joy joy_node

# View joy data in another terminal
rostopic echo /joy

Observe index and axis values to match with configuration files.

3. Configure Mappings

If mappings are incorrect, edit the configuration file:

# Edit joystick mapping config
nano ~/tello_ws/src/tello_base/tello_teleop/config/xbox_mappings.yaml

Config Description:

# Axes
joy_axis_left_lr: 0       # Left stick L/R
joy_axis_left_fb: 1       # Left stick F/B
joy_axis_right_lr: 3      # Right stick L/R
joy_axis_right_fb: 4      # Right stick F/B

# Buttons
joy_button_a: 0           # A button
joy_button_b: 1           # B button
joy_button_y: 2           # Y button
joy_button_x: 3           # X button
joy_button_view: 8        # View button (Land)
joy_button_menu: 9        # Menu button (Takeoff)

Adjust indices based on rostopic echo /joy output.

4. Launch Teleop

roslaunch tello_teleop teleop.launch

Control Layout (XBox One):

Button/Axis Function
Left Stick L/R Yaw (Rotate)
Left Stick F/B Vertical/Forward (Modes)
Right Stick L/R Roll (Side move)
Right Stick F/B Forward/Vertical (Modes)
Menu Button Takeoff
View Button Land
Y/X/B/A Flip Forward/Left/Right/Back

Optional Parameters:

# Left-handed mode
roslaunch tello_teleop teleop.launch left_handed:=true

# Custom trim speed
roslaunch tello_teleop teleop.launch trim_speed:=0.3

# Disable video stream
roslaunch tello_teleop teleop.launch stream_on:=false

Manual Command Control

# Takeoff
rostopic pub /takeoff std_msgs/Empty "{}"

# Land
rostopic pub /land std_msgs/Empty "{}"

# Forward
rostopic pub /cmd_vel geometry_msgs/Twist "{linear: {x: 0.5, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"

# Flip Right
rostopic pub /flip tello_msgs/Flip "{flip_command: 3}"

# View Flight Data
rostopic echo /flight_data

# View Video Stream
rosrun image_view image_view image:=/image_raw

Environment Test (Stand-alone)

python3 src/tello_driver/scripts/environment_test.py

ROS Topics

Published by tello_driver

Topic Type Description
/flight_data tello_msgs/FlightData Flight status data
/image_raw sensor_msgs/Image Video stream (BGR)

Subscribed by tello_driver

Topic Type Description
/cmd_vel geometry_msgs/Twist Velocity control commands
/takeoff std_msgs/Empty Takeoff command
/land std_msgs/Empty Land command
/flip tello_msgs/Flip Flip command

Custom Messages

FlightData.msg

int32 battery_percent                   # Battery percentage (0-100)
int32 pitch                             # Pitch (degree)
int32 roll                              # Roll (degree)
int32 yaw                               # Yaw (degree)
int32 speed_x                           # X speed
int32 speed_y                           # Y speed
int32 speed_z                           # Z speed
float32 acceleration_x                  # X acceleration
float32 acceleration_y                  # Y acceleration
float32 acceleration_z                  # Z acceleration
int32 height                            # Height (cm)
int32 tof_distance                      # TOF distance (cm)
float32 barometer                       # Barometer altitude (cm)
int32 flight_time                       # Flight time (sec)
int32 temperature_low                   # Low temperature (°C)
int32 temperature_high                  # High temperature (°C)

Flip.msg

uint8 FLIP_FORWARD=0
uint8 FLIP_LEFT=1
uint8 FLIP_BACK=2
uint8 FLIP_RIGHT=3
uint8 flip_command

Coordinate System

Following ROS conventions (FLU - Forward Left Up):

  • +x: Forward
  • +y: Left
  • +z: Up
  • +yaw: Counter-clockwise

References

Resources

License

BSD License

Maintainer

FallThrive (fallthrive@outlook.com)


Note: Please comply with local laws and regulations and fly safely.