bit-bots/ros2_python_extension — reverse-engineered prompt
Reverse engineered prompt
Build me a small ROS2 example project that shows how to use a native C++ extension from Python, with the code set up so it feels reusable instead of just a one off demo.
I want a clean example where the extension exposes a couple of simple functions or classes to Python, and then a Python ROS2 node imports that extension and uses it in a realistic way. Please include the build setup, enough comments to understand what is happening, and a simple example I can run to prove it works end to end.
Keep it practical and beginner friendly. The goal is to learn the pattern for mixing ROS2, Python, and C++ in one package and have a starting point I can reuse in other robotics projects. If there are common gotchas around building or importing the extension inside ROS2, handle those too. Look up current ROS2 docs online if you need to.
Want more depth? Deep Reverse