Search papers, labs, and topics across Lattice.
This paper explores using Large Language Models (LLMs) to automate the generation of Python bindings for large C++ robotics libraries, specifically focusing on the Open Motion Planning Library (OMPL). The approach scaffolds wrapper files mirroring the C++ structure and uses LLMs to generate nanobind definitions, followed by expert review and refinement. The resulting bindings achieve runtime performance comparable to legacy solutions, while also providing insights into common LLM failure modes in this context and strategies to mitigate them.
LLMs can generate performant Python bindings for large C++ robotics libraries, but watch out for shared pointers and trampolines.
Python bindings are a critical bridge between high-performance C++ libraries and the flexibility of Python, enabling rapid prototyping, reproducible experiments, and integration with simulation and learning frameworks in robotics research. Yet, generating bindings for large codebases is a tedious process that creates a heavy burden for a small group of maintainers. In this work, we investigate the use of Large Language Models (LLMs) to assist in generating nanobind wrappers, with human experts kept in the loop. Our workflow mirrors the structure of the C++ codebase, scaffolds empty wrapper files, and employs LLMs to fill in binding definitions. Experts then review and refine the generated code to ensure correctness, compatibility, and performance. Through a case study on a large C++ motion planning library, we document common failure modes, including mismanaging shared pointers, overloads, and trampolines, and show how in-context examples and careful prompt design improve reliability. Experiments demonstrate that the resulting bindings achieve runtime performance comparable to legacy solutions. Beyond this case study, our results provide general lessons for applying LLMs to binding generation in large-scale C++ projects.