[pybind11] add function, mergeFixedJoint#140
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR moves the mergeFixedJoint function from being a private method of the RoboasmBodyCreator class to a public utility function in the cnoid::robot_assembler namespace and exposes it through the pybind11 Python interface.
- Moved
mergeFixedJointfrom class method to namespace-level utility function - Added pybind11 binding to expose the function to Python
- Commented out the original class method implementation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/RobotAssemblerBody.h | Added declaration for public mergeFixedJoint function and commented out private class method |
| src/RobotAssemblerBody.cpp | Implemented new public mergeFixedJoint function and wrapped old implementation in #if 0 block |
| pybind11/PyRobotAssemblerHelper.cpp | Added Python binding for the new mergeFixedJoint function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| #if 0 | ||
| bool RoboasmBodyCreator::mergeFixedJoint(BodyPtr _bd) | ||
| { | ||
| Link *root_ = _bd->rootLink(); |
There was a problem hiding this comment.
Consider removing the old commented-out implementation instead of using #if 0. Dead code should be cleaned up rather than left in the codebase, especially since version control maintains the history.
| return true; | ||
| } | ||
|
|
||
| #endif |
There was a problem hiding this comment.
Consider removing the old commented-out implementation instead of using #if 0. Dead code should be cleaned up rather than left in the codebase, especially since version control maintains the history.
| Isometry3 T; cds.toPosition(T); | ||
| return ra::addRootOffset(bd, T); | ||
| }); | ||
| m.def("mergeFixedJoint", [](Body *bd) { |
There was a problem hiding this comment.
The parameter type should be BodyPtr to match the function signature, not Body *. This inconsistency could lead to issues with shared pointer management.
| m.def("mergeFixedJoint", [](Body *bd) { | |
| m.def("mergeFixedJoint", [](BodyPtr bd) { |
No description provided.