·Opinion
Why Mechatronics Students Should Learn Rust
Embedded C is fine. Rust gives you the same control plus a borrow checker that catches the bugs that actually take down your robot.
The argument in one paragraph
Your robot crashes not because the algorithm is wrong but because two tasks touched the same buffer at the wrong time, or a pointer outlived its owner, or an interrupt fired during a non-reentrant call. Rust's ownership model makes these specific bug classes impossible to compile. You still write firmware. You just stop debugging the ones that ruin demo day.
What you give up
- A larger toolchain footprint
- Some HAL libraries are less mature than their C equivalents
- Async on embedded is still evolving (Embassy is good, but new)
What you gain
Send/Syncmarkers catch concurrency mistakes at compile time- Cargo replaces a hand-rolled Makefile + vendored libraries
- A package ecosystem that doesn't require copy-pasting from forum posts
A pragmatic path
Don't rewrite your team's codebase. Start with a single peripheral driver — an IMU, an encoder, a motor controller — in Rust. Talk to the rest of the firmware over a defined interface. Measure flash and RAM. Decide from there.