Physical Hardware Experiments
Wolfgang Hönig
November 15, 2024
Open loop control for UAVs impossible!
f32
, not f64
(the real hardware
has a single-precision FPU)target
folder; use .gitignore
)Flow-Deck
uSD-deck
AI Deck
Install Rust for our target:
rustup target add thumbv7em-none-eabihf
Build official example:
git clone git@github.com:bitcraze/crazyflie-firmware.git
cd crazyflie-firmware
git submodule update --init
cd examples/app_hello_rs
make clean
make
Flash:
make cload
How can we cross the language barrier?
extern C
and disable name manglingExport a function written in Rust
Call the function from C
C function to import
Rust code to call that function
#![no_std]
use panic_halt as _;
extern "C" {
pub fn vTaskDelay(ticks: u32);
pub fn consolePutchar(ch: i32) -> i32;
}
fn console_print(msg: &str) {
for c in msg.as_bytes() {
unsafe{ consolePutchar(*c as i32); }
}
}
#[no_mangle]
pub extern "C" fn appMain() -> i32 {
console_print("Hello from Rust2!\n");
loop {
unsafe { vTaskDelay(1000); }
}
}
sinf
,
cosf
etc. from Cbindgen
stabilizer_types.h
and only include the structs that you
needNext Week
Controls lecture and Assignment 2.
?