this post was submitted on 18 Oct 2023
3 points (100.0% liked)
MICROCONTROLLERS
848 readers
1 users here now
Everything microcontrollers: projects, questions, new releases, etc.
dragontamer's Beginner Guides:
Beginner Series I: What is a Microcontroller?
Beginner Series II: The "Generic" Microcontroller
Beginner Sidenote: Microchip's Signal Chain Design Guide
Beginner Series III: Skills and Complexity Tiers
Beginner Series IV: Deep Dive into Microchip's AVR EA
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
MicroPython is significantly slower than C.
I mean this is very impressive. But good grief. Was it really easier to do this all in MicroPython? 250Hz is still pretty slow. That's an update every 4-miliseconds, or roughly every 800,000 clock ticks on this 200+MHz overclocked RP2040.
I can't say I'm into robotics or drones, but I do know that STM32F3 / CortexM4F chips are common flight controllers in the drone community at only 72MHz or so (albeit with hardware FPU units). Micropython needs to probably change all the floating-point math into fixed-point to work on the CortexM0+ (no FPU), and then deal with the severe inefficiencies associated with an interpreter.
EDIT: I should note that reading over the flight-dynamics / this whole problem and blog is making me want to make my own quadcopter. Apparently quadcopters are all just relatively basic control theory. Somehow I thought they were far more complicated than this. But this kind of simple poll data / math out some PID controllers / send-data-to-motors loop is the bread-and-butter of electrical-and-computer engineering today.