翻译[5]-基于rust和embassy异步框架的飞控固件: Holsatus Flight
基于rust和embassy异步框架的飞控固件: Holsatus Flight
- 原文地址: [https://github.com/holsatus/holsatus-flight]和[https://github.com/peterkrull/quad]
- 原作者: peterkrull
- 许可: Apache-2.0 license
✨ 序言 ✨
大家好!今天给大家种草一款超酷的飞行控制器——Holsatus 🦀 Flight!这款控制器是用 Rust 语言编写的,不仅高效,还特别适合四轴飞行器爱好者。它支持 RP2040 芯片,价格不到 1 美元,性价比超高!🚀
Holsatus Flight 内置了超多实用功能,比如交互式 Shell 界面、Mavlink 服务器、自动校准程序等等。最棒的是,它的扩展性超强,只需定义一个新任务就能添加新功能,简直是 DIY 爱好者的福音!💡
如果你也是飞行器爱好者,或者对 Rust 编程感兴趣,不妨试试 Holsatus Flight。它的开源许可证让你可以自由使用和修改,欢迎大家一起贡献代码,让这个项目变得更强大!💪
快来加入 Holsatus Flight 的社区,一起探索飞行的乐趣吧!🦀✨
| 基于Holsatus Flight的四轴无人机 | 
|---|
|  | 
🌟 Holsatus 🦀 Flight 飞行控制器 🌟
Holsatus Flight 是一款用纯 Rust 编写的创新自动驾驶仪。其固件基于 Embassy 框架,并广泛使用 async 功能,以实现前所未有的高效性和高功能性。
当前版本专为四轴飞行器设计,运行在 Raspberry Pi RP2040 芯片上(价格不到 1 美元!),但未来计划支持其他配置和硬件。
功能亮点
- Holsatus Shell - 一个用于配置和校准的交互式环境。
- Mavlink - 内置 Mavlink 服务器,可与标准 GCS 软件交互。
- 校准 - 内置陀螺仪、加速度计和磁力计的校准程序。
- 配置 - 完全可配置的 RC 映射、PID 增益等,运行时保存到闪存。
- 安全启动 - 多种检查确保飞行器在安全条件下启动。
- 调度 - 中断执行器允许高优先级子系统抢占低优先级子系统。
- 速度 - 由于异步的高效性,RP2040 能够稳定运行 1000 Hz 的控制循环。
- 扩展性 - 只需定义一个新的 Embassy 任务并启动它,即可添加新功能。
Holsatus Shell
内置的 Shell 界面使得配置、校准和故障排除变得简单,只需使用终端和串口控制台应用程序,如 minicom 或 PuTTY。无论是获取或设置参数、读取传感器数据、读取状态标志,还是进行加速度计校准,简单的终端界面都能轻松搞定。
| shell cli界面 | 
|---|
|  | 
快速开始
如前所述,当前的开发硬件包括 RP2040,安装在 Raspberry Pi Pico 板上。内置驱动程序支持通过 I2C 连接的 ICM20948 IMU+磁力计、通过 UART 连接的 SBUS 接收器、通过 PIO 连接的 4x DShot 电机。建议准备好这些硬件进行测试。
目前推荐的功能是 rp2040,以启用针对该芯片的硬件配置,overclock 以应用 2 倍超频(如果可能),以及 shell 以启用通过 USB 的串行 Shell 服务器进行配置和校准。
cargo run --release --features "rp2040 overclock shell"
Holsatus 是什么意思?
由于这款自动驾驶仪的主要独特之处在于使用了 Rust 编程语言,我觉得向以甲壳类动物为灵感的吉祥物致敬是个不错的主意。我偶然发现了一种叫做 Liocarcinus holsatus 的螃蟹,它的俗名是“飞蟹”,我觉得这很贴切。它似乎也(像我一样)生活在北海。Holsatus 🦀 就是它了!
Holsatus 🦀 Flight
[!NOTE]
A refactor is currently in progress. The readme may be misleading, and stuff might be broken. Stay tuned
Holsatus Flight is a novel autopilot built in pure Rust. The firmware is designed around an the Embassy framework and uses async functionality extensively to enable unprecedented efficiency with a high level of functionality.
The current implementation is designed for quad copters, and runs on the Raspberry Pi RP2040 chip (a sub $1 chip!), but support for other configurations and hardware is intended for the future.
Features
- Holsatus Shell - An interactive environment for configuration and calibration.
- Mavlink - A Mavlink server enables Holsatus Flight to interact with standard GCS software.
- Calibration - Built-in calibration routines for the gyroscope, accelerometer and magnetometer
- Configuration - Fully configurable RC map, PID gains and more, at run-time, saved to flash storage.
- Arming safety - Various checks ensure that the vehicle will not arm in unsafe conditions.
- Scheduling - Interrupt-executors allows for high priority subsystems to preempt lower-priority ones.
- Speed - Due to the high efficiency of async, a modest RP2040 is able to run a steady 1000 Hz control loop.
- Extensibility - Adding new functionality only requires defining a new Embassy task and spawning it.
Holsatus Shell
The inclusion of a shell interface makes configuring, calibrating and troubleshooting easy, only using your terminal and a serial console application, such as minicom or PuTTY. Whether it be getting or setting parameters, reading sensor data, reading status flags or walking through the accelerometer calibration routine, the simple terminal interface makes that easy.
Getting started
As mentioned above, the current development hardware consists of a RP2040, mounted in a Raspberry Pi Pico board. The built-in drivers support the ICM20948 IMU+Magnetometer over I2C, SBUS receiver over UART, 4x DShot motors via PIO. It is recommended to have this hardware available for testing.
The currently recommended features are rp2040, to enable hardware-configuration specific to this chip, overclock to apply a 2x overclock, if possible, and shell to enable the serial-over-USB shell server for configuration and calibration.
cargo run --release --features "rp2040 overclock shell"
What does Holsatus mean?
Since the main unique and novel characteristic of this autopilot is the use of the Rust programming language, I thought a nod to the crustacean-based mascot would be nice. I stumbled across a type of crab called the Liocarcinus holsatus, with the common name of "flying crab", which I found fitting. It is apparently also (like myself) local to the North Sea. Holsatus 🦀 is it!
Project quad
This git repository is a personal project of mine to develop an open-source autonomous quad copter using cheap off-the-shelf components in conjunction with control theory and state estimation. As much as possible, any auxiliary tools and documentation I produce, will also be a part of the repository.
Getting Rusty
The firmware is written in the Rust programming language. This is in contrast to most flight controllers (and embedded devices in general) which use C or C++. The reason for choosing Rust is quite simple: it is a modern language. It can guarantee many things about the validity of memory at compile time, allows for writing high-level code, that runs at low-level speeds, and feels good to write; once you become friendly with the borrow checker.
YouTube : Demo of wireless data plotting and responsive controls
Directory contents
- 3dparts - 3D models used in the project as STEP and .obj files.
- docs - Documentation and learning material used in the project.
- hardware - Schematics, and PCB layouts as well as finished gerber files.
- images - Photos used in readme and some documentation.
- software - Software related to the project, including simulations, firmware, etc.
- tests - Results from test conducted during this project
Related repositories
During this project, some additional tools were developed, that reside in their own repositories.
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号