# py-binding-tools **Repository Path**: agiros/py-binding-tools ## Basic Information - **Project Name**: py-binding-tools - **Description**: No description available - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-13 - **Last Updated**: 2025-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Python binding tools for C++ This package provides some tools to facilitate the generation of python bindings for C++ code, based on [pybind11](https://github.com/pybind/pybind11). ### Automatic type conversion for ROS message types Conversion between native C++ and python types is performed via ROS message serialization and deserialization, which is implemented via C++ templates. It suffices to include: ```cpp #include ``` The `PoseStamped` message from the `geometry_msgs` package also accepts a single string as an argument. In this case, the string is interpreted as the `header.frame_id` field of the message and the pose becomes the identity transform. To use this extension, include the following header instead: ```cpp #include ``` ### C++ ROS initialization C++ and Python use their own RCL implementations (`rclpy` and `rclcpp`). Thus, it is necessary to initialize ROS in the C++ domain additionally to the Python domain before calling any ROS-related functions from wrapped C++ functions or classes. To this end, the package provides the python function `rclcpp.init()` and the C++ class `RCLInitializer`. The latter is intended to be used as a base class for your python wrapper classes: ```cpp class FooWrapper : protected RCLInitializer, public Foo { // ... }; ``` to ensure that the ROS infrastructure is initialized before usage in the wrapped C++ class. Ensure to list `RCLInitializer` as the _first_ base class, if ROS functionality is required in the constructor already!