Ming-I Sun details his experience using Understand to navigate the Betaflight codebase and integrate AI into a drone flight controller. Ming is a retired software engineer from Zebra Technologies who possesses extensive experience in hardware, firmware, and software development for embedded systems. He also has a diverse range of interests and hobbies.
When I was looking to replenish my post-retirement project list, I considered learning how to build and operate an FPV quadcopter. During my research, I discovered the vast array of components available for assembling a drone from scratch. Among these, the flight controller emerged as the central hub that integrates all the necessary modules for the drone’s operation. This sparked an idea: why not enhance the flight controller with autonomous flying capabilities powered by AI?
In theory, this could be achieved by feeding video input into an AI system embedded on the flight controller board or routing the video to an external specialized board for analysis. The AI would then generate simulated control signals, replicating the manual inputs typically made via the ground control station (GCS) sticks.
With budget constraints in mind, my online research pointed to open-source Betaflight controller boards as a promising starting point. However, deeper exploration and analysis were necessary. Betaflight is a versatile codebase supporting various microcontroller platforms, each with multiple variations. The project also involves additional complexities, such as compatibility with different RF TX/RX boards, sensor boards, electronic speed controllers (ESCs), servos, I/O pins, interface buses, and control protocols.
Initially, I used the Eclipse IDE to explore the Betaflight project since I was familiar with it. However, integrating plugins to visualize the entire project proved challenging, and my progress was slow. Switching to Understand by SciTools transformed my workflow. This tool’s well integrated features were intuitive, even for a first-time user like me, significantly increasing my productivity and making the exploration process much smoother.
Key Benefits of Using Understand
File Dependency Graphs
The File Dependency Graph feature displayed the project’s source code as clusters, making the structure clear. For example, I quickly identified that a significant portion of the code was dedicated to USB-related functionality, which was not central to the flight
controller’s operation. This allowed me to focus on more relevant aspects of the project.
Efficient Entity Search and Intuitive Interface
The speed of searching for entities within the project was remarkable. The user interface provided detailed, intuitive insights into each entity’s properties. The right click pop-up menu was particularly useful, offering a comprehensive set of exploration options. Visualizing entities through call flows, caller-callee relationships, and other graphing options helped prioritize areas for deeper understanding.
Macro and Configuration Analysis
Using the search feature, I could quickly identify hardware features denied by compiler macros and software configuration options adjustable at runtime. Call and called-by graphs were particularly helpful in analyzing function pointers, which are often used for parsing commands and data from various protocols and interfaces.
Results and Reflections
Using Understand significantly boosted my productivity, saving time and maintaining momentum as I transitioned the project from exploration to implementation. Its robust features allowed me to analyze the Betaflight project efficiently, even as a newcomer, and focus on the most impactful areas. This tool has been invaluable in my journey toward building an autonomous FPV quadcopter, combining a passion for drones with the challenge of integratingAI-powered autonomy.
How has Understand helped you in your coding journey? We’d love to hear about it!