当前位置:网站首页>Rust controls Dajiang programmable UAV Tello
Rust controls Dajiang programmable UAV Tello
2022-06-30 23:57:00 【ruonou. com】
The cheapest UAV brand under Dajiang tello It adopts Intel's visual processing chip , Although compared with the Majiang Emperor 、 Wudeng series , The function is simple . But compared with other brands such as Xiaomi and Huaqiangbei , It is a very useful toy .
Big frontier tello The UAV also provides a programmable interface , The government has supported Scratch Graphic programming . From this analysis , We can figure out tello Drones actually provide 2 Interface :tello Text based interface used by UAV Application , And a non-public interface . Because it provides an open interface , To interact with graphical programming , Realize user's programming control . stay tellopilots Forum ( Wechat official account cannot be attached , Please search by yourself ), Some players have done a great job , Yes tello edu app The programming interface of is reverse engineered , Thus, other functions such as python、golang etc. ……
But the protagonist of this article is Rust.
because tello UAVs communicate with operators through network protocols ( mobile phone 、 Handle, etc ) Interactive communication . therefore , We can combine its network protocol to communicate with UAV , And get available metadata .
Of course , In this way, we can expand our thinking , We can also provide a remote control framework , Use keyboard or joystick to control . Even simpler , The command combination is batch processing , Then simply trigger ( Imagine Hollywood blockbusters ).
Let's simply try , Analysis from principle , To coding implementation ——
and tello UAV Communication
First , Please ensure that the UAV flips in a bright environment 、 rebound ……
secondly , Let's analyze and tello The communication principle of UAV : When tello The UAV gets a startup command package (drone.connect(11111);) when ,tello No one has a chance in two UDP Send data on the channel . Command channel A( port :8889) And video channels B(WIP)( port :11111). stay AP In mode ,tello The drone will default ip 192.168.10.1 appear .
Again , All send 、 All calls are completed synchronously . If you want to receive data , You must poll the drone . The following example :
use tello::{Drone, Message, Package, PackageData, ResponseMsg};
use std::time::Duration;
fn main() -> Result<(), String> {
let mut drone = Drone::new("192.168.10.1:8889");
drone.connect(11111);
loop {
if let Some(msg) = drone.poll() {
match msg {
Message::Data(Package {data: PackageData::FlightData(d), ..}) => {
println!("battery {}", d.battery_percentage);
}
Message::Response(ResponseMsg::Connected(_)) => {
println!("connected");
drone.throw_and_go().unwrap();
}
_ => ()
}
}
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 20));
}
}Remote control
When polling the UAV , Not only to receive messages from drones , Some default settings will also be sent 、 Reply to confirm 、 Trigger keyframes , Or send real-time mobile commands and other remote control status .
We can use SDL open windows , Handle keyboard input , And show how to connect the game board or joystick .
But I'm going out to experiment , Remote control will be discussed later :-).
Thank you for reading .
边栏推荐
- The girlfriend said: if you want to understand the three MySQL logs, I will let you heiheihei!
- [designmode] factory pattern
- lvm-snapshot:基于LVM快照的备份之准备工作
- Explain kubernetes backup and recovery tools velero | learn more about carina series phase III
- conv2d详解--在数组和图像中的使用
- 1. crawler's beautifulsoup parsing library & online parsing image verification code
- "Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
- Is it safe to choose mobile phone for stock trading account opening in Hangzhou?
- Pycharm useful shortcut keys
- HP notebook disable touchpad after mouse is inserted
猜你喜欢

女朋友说:你要搞懂了MySQL三大日志,我就让你嘿嘿嘿!

Which is better, server rental or hosting services in the United States?

Zero sample and small sample learning

What is SRM system and how to standardize the internal procurement process of the company

In 2022, the latest JCR officially released the list of the latest global impact factors (top 600)

Prospects of world digitalization and machine intelligence in the next decade

什么是SRM系统,如何规范公司内部采购流程

Bridge emqx cloud data to AWS IOT through the public network

Design e-commerce seckill system

Solve arm_ release_ ver of this libmali is ‘g2p0-01eac0‘,rk_ so_ Ver is' 4 ', libgl1 mesa dev will not be installed, and there are unsatisfied dependencies
随机推荐
5g smart building solution 2021
HP 惠普笔记本电脑 禁用触摸板 在插入鼠标后
深入理解 Jetpack Compose 内核:SlotTable 系统
Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
shell 同时执行多任务下载视频
leetcode 474. Ones and zeroes (medium)
女朋友说:你要搞懂了MySQL三大日志,我就让你嘿嘿嘿!
How to mention hot fix and cherry pick
Mysql database query optimization
Query points in MATLAB Delaunay triangulation
1175. 质数排列 / 剑指 Offer II 104. 排列的数目
网上开华泰证券的股票账户是否安全呢?
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
Understand target detection in one article: r-cnn, fast r-cnn, fast r-cnn, Yolo, SSD "suggestions collection"
When is it appropriate to replace a virtual machine with a virtual machine?
6-1 exploit -ftp exploit
Code de conduite pour la vente de fonds et la gestion de l'information
[NLP] [textcnn] text classification
Detailed explanation of conv2d -- use in arrays and images
Why should VR panoramic shooting join us? Leverage resources to achieve win-win results