前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ros2之tello无人机

ros2之tello无人机

作者头像
zhangrelay
发布2019-08-15 19:07:39
2.3K0
发布2019-08-15 19:07:39
举报

版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons

ros2之tello无人机

cozmo-ros2: https://blog.csdn.net/ZhangRelay/article/details/93510762 turtlesim-ros2:https://zhangrelay.blog.csdn.net/article/details/98754130 turtlebot-ros2: https://blog.csdn.net/ZhangRelay/article/details/86764208

与桌面机器人cozmo一样,空中机器人tello支持ros1、ros2、SDK、API等多种开发模式。这里以ros2为例。


安装 Installation

1.设置Linux环境 Set up your Linux environment

设置Ubuntu 18.04框或VM。这应该包括ffmpeg 3.4.4和OpenCV 3.2。Set up a Ubuntu 18.04 box or VM. This should include ffmpeg 3.4.4 and OpenCV 3.2.

还需要安装asio Also install asio:

  • sudo apt install libasio-dev

2.设置ROS环境 Set up your ROS environment

安装ROS2 Dashing Diademata(https://index.ros.org/doc/ros2/Installation/)和ros-dashing-desktopInstall ROS2 Dashing Diademata with the ros-dashing-desktop option.

如果您安装二进制文件,请务必同时安装 开发工具和ROS工具(https://github.com/ros2/ros2/wiki/Linux-Development-Setup#install-development-tools-and-ros-tools)从源安装说明。If you install binaries, be sure to also install the development tools and ROS toolsfrom the source installation instructions.

安装这些附加包Install these additional packages:

  • sudo apt install ros-dashing-cv-bridge ros-dashing-camera-calibration-parsers

3.安装tello_ros Install tello_ros

下载、编译和安装tello_ros Download, compile and install tello_ros

确保编译成功~

查看一下功能包,启动驱动看一看,发现超时(time out)。

连接tello无人机wifi,即可正常使用。

可以看到启动了camera:

启动的主题和服务如下所示:

运行 Running

遥控 Teleop

驱动程序提供了一个简单的启动文件,允许使用有线XBox One游戏手柄飞行无人机。The driver provides a simple launch file that will allow you to fly the drone using a wired XBox One gamepad.

打开无人机,通过Wi-Fi连接到“TELLO-XXXXX”,然后启动ROS: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

如果没有运行source install/setup.bash,会出现如上错误提示。

按下XBox One 菜单按钮取下,然后按视图按钮降落。Hit the XBox One menu button to take off, and the view button to land.

如果您没有XBox One游戏手柄,可以使用ROS2 CLI发送命令: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?'}"

发送一些指令,无人机tello相应如下:

还可以发送cmd_vel消息: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}}"

tello_ros

tello_ros是Tello和Tello EDU无人机的ROS2驱动程序。tello_ros is a ROS2 driver for Tello and Tello EDU drones.

Packages

4个ROS包 There are 4 ROS packages:

  • tello_driver 是连接到无人机的C ++ ROS节点 is a C++ ROS node that connects to the drone
  • tello_msgs 是一组ROS消息 is a set of ROS messages
  • tello_description 包含机器人描述(URDF)文件 contains robot description (URDF) files
  • tello_gazebo 可以用来模拟Gazebo(http://gazebosim.org/)中的Tello无人机, 有关详细信息,请参阅该包中的README.md can be used to simulate a Tello drone in Gazebo,see the README.md in that package for details

接口 Interface

概述 Overview

该驱动程序设计非常简单,同时可以轻松地将Tello无人机集成到ROS生态系统中。

驱动程序使用Tello SDK与无人机通信,具有以下几个优点:

  • SDK已记录在案,并且围绕它进行了相当多的开发活动,因此它很可能是稳定的。
  • SDK是基于文本的,这意味着tello_ros可以很简单,但仍然可以通过传递提供对SDK的完全访问权限无人机的任意字符串。

许多Tello命令(例如,takeoffland)长时间运行,无人机在完成时返回okerror。目前,驱动程序提供ROS服务tello_command来启动命令,和相应的ROS主题“tello_response”表示命令完成。当ROS2-Dashing被释放时,这可能会改变。

根据ROS约定,驱动程序还响应cmd_vel主题上的Twist消息。这些被翻译成rc命令并发送给无人机。速度值从-1.0,1.0到-100,100任意映射。这可能在将来发生变化。

驱动程序解析遥测数据并将其发送到“flight_data”主题。遥测数据的存在是无人机连接的良好指标。

驱动程序解析视频流并在image_raw主题上发送图像。摄像机信息在camera_info主题上发送。

Tello无人机拥有先进的视觉测距系统和机载IMU,但这些内部系统访问量极低 。驱动不发布里程计消息。

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:

  • The SDK is documented, and there's quite a bit of development activity around it, so it's likely to be stable.
  • The SDK is text-based, which means that tello_ros can be simple but still provide full access to the SDK by passingarbitrary strings to the drone.

Many Tello commands (e.g., takeoff and land) are long-running, and the drone returns ok or error on completion.For now, the driver provides the ROS service tello_command to initiate commands,and the corresponding ROS topic tello_response to indicate command completion.This may change when ROS2-Dashing is released.

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.

补充说明:*一次只能运行一个命令。*如果当前正在运行命令(除rc之外),则忽略传入的cmd_vel消息。

  • Tello无人机不发送rc命令的响应,也不发送驱动程序的响应。*驱动程序在启动时发送commandstreamon命令以启动遥测和视频。*如果遥测或视频停止,驱动程序将尝试通过发送commandstreamon命令重新启动。*在cmd_vel消息中忽略Roll(Twist.angular.x)和pitch(Twist.angular.y)。*司机没有跟踪状态,因此即使它在地面上,它也会很乐意向无人机发送“rc”信息。无人机只是忽略了它们。*您可以通过tello_command服务向无人机发送任意字符串。*如果15秒内未收到任何命令,Tello无人机将自动着陆。在12秒的静音之后,驱动程序发送一个rc 0 0 0 0命令以避免这种情况。

Additional notes:

  • Only one command may be running at a time.
  • If a command (other than rc) is currently running, incoming cmd_vel messages are ignored.
  • Tello drones do not send responses for rc commands, and neither does the driver.
  • The driver sends command and streamon commands at startup to initiate telemetry and video.
  • If telemetry or video stops, the driver will attempt to restart by sending command and streamon commands.
  • Roll (Twist.angular.x) and pitch (Twist.angular.y) are ignored in cmd_vel messages.
  • The driver doesn't keep track of state, so it will happily send rc messages to the drone even if it's on the ground.The drone just ignores them.
  • You can send arbitrary strings to the drone via the tello_command service.
  • Tello drones auto-land if no commands are received within 15 seconds.The driver sends a rc 0 0 0 0 command after 12 seconds of silence to avoid this.

服务 Services

  • ~tello_action tello_msgs/TelloAction

订阅主题 Subscribed topics

发布主题 Published topics

参数 Parameters

默认设置适用于单个Tello无人机。 The defaults work well for a single Tello drone.

Name

Description

Default

drone_ip

Send commands to this IP address 将命令发送到此IP地址

192.168.10.1

drone_port

Send commands to this UDP port 将命令发送到此UDP端口

8889

command_port

Send commands from this UDP port 从此UDP端口发送命令

38065

data_port

Flight data (Tello state) will arrive on this UDP port 飞行数据(Tello状态)将到达此UDP端口

8890

video_port

Video data will arrive on this UDP port 视频数据将到达此UDP端口

11111


Devices tested 已测试设备

  • Tello
代码语言:txt
复制
-  Firmware v01.04.35.01, SDK v1.3 固件v01.04.35.01,SDK v1.3
  • Tello EDU
代码语言:txt
复制
-  Firmware v02.04.69.03, SDK v2.0 固件v02.04.69.03,SDK v2.0

Credits

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

Resources 资源

Tello SDK errata

  • Tello drones do not respond to rc commands (the SDK suggests that they return ok or error)Tello无人机不响应rc命令(SDK建议他们返回'okerror`)

cozmo-ros2:

turtlesim-ros2:

turtlebot-ros2:


华为HarmonyOShttps://github.com/Awesome-HarmonyOS/HarmonyOS


本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年08月12日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装 Installation
    • 1.设置Linux环境 Set up your Linux environment
      • 2.设置ROS环境 Set up your ROS environment
        • 3.安装tello_ros Install tello_ros
        • 运行 Running
          • 遥控 Teleop
          • tello_ros
            • Packages
              • 接口 Interface
                • 概述 Overview
                • 服务 Services
                • 订阅主题 Subscribed topics
                • 发布主题 Published topics
                • 参数 Parameters
                • Devices tested 已测试设备
              • Credits
                • Resources 资源
                领券
                问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档