Running an APP on crazyFlie generated using MATLAB's Embedded Coder #1815
-
Hello, I want to validate an MPC (custom controller) on crazyFlie. Following is my workflow,
The issue that I am facing is the crazyFlie boots fine with the custom controller on-board, but when I start running my controller, the drone either reboots or goes into states which are not documented, for example solid red LEDs, just solid blue LEDs etc. I know that the custom controller meets the RAM (~83%) and flash (~30%) and CCM(~95%) requirements. I figured that there is something in my code which makes the hardware reboot or stall, however, the same code works perfectly fine with webbots. Also the code is like 4000 lines, so manual debugging is very painful. Hence my questions are,
Thank you so much for any insights. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The differences between a Webots simulation and flying the real Crazyflie can be significant, depending on your implementation. Using the Python bindings can help bridge this gap, but even then, the simulator isn't running software-in-the-loop, so notable differences remain. Your approach with the app seems correct, but now you need to debug. Since the drone is rebooting (asserting), you should connect to the cfclient and check where it asserted—that will give you a clue about what’s going wrong. As for best practices, this situation isn't primarily about coding standards; it's about identifying and resolving a critical failure. I think that focusing on debugging will be more productive than refining practices at this stage. If you suspect a memory issue, you can disable features in Kconfig, or otherwise manually modify the firmware to save resources. For those starting with new sim->real projects, employing a software-in-the-loop simulator like CrazySim can be beneficial. CrazySim runs (a modified version of) the Crazyflie firmware in a simulated environment. |
Beta Was this translation helpful? Give feedback.
The differences between a Webots simulation and flying the real Crazyflie can be significant, depending on your implementation. Using the Python bindings can help bridge this gap, but even then, the simulator isn't running software-in-the-loop, so notable differences remain.
Your approach with the app seems correct, but now you need to debug. Since the drone is rebooting (asserting), you should connect to the cfclient and check where it asserted—that will give you a clue about what’s going wrong.
As for best practices, this situation isn't primarily about coding standards; it's about identifying and resolving a critical failure. I think that focusing on debugging will be more productive t…