Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure on crocoddyl on macos: TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptr<pinocchio::ModelTpl<double, 0, pinocchio::JointCollectionDefaultTpl>> #2563

Closed
nim65s opened this issue Jan 29, 2025 · 5 comments

Comments

@nim65s
Copy link
Contributor

nim65s commented Jan 29, 2025

Hi,

crocoddyl v2.1.0 was building fine on macos with pinocchio v3.3.0, but some tests are failing with pinocchio v3.3.1:

crocoddyl> The following tests FAILED:
crocoddyl>       29 - test_pybinds_actuations (Failed)
crocoddyl>       30 - test_pybinds_actions (Failed)
crocoddyl>       31 - test_pybinds_shooting (Failed)
crocoddyl>       33 - test_pybinds_costs (Failed)
crocoddyl>       34 - test_pybinds_contacts (Failed)
crocoddyl>       35 - test_pybinds_impulses (Failed)
crocoddyl>       37 - test_pybinds_copy (Failed)

with eg.

crocoddyl> ======================================================================
crocoddyl> ERROR: test_calc (__main__.TalosArmShootingTest.test_calc)
crocoddyl> ----------------------------------------------------------------------
crocoddyl> Traceback (most recent call last):
crocoddyl>   File "…/unittest/bindings/test_shooting.py", line 30, in setUp
crocoddyl>     self.PROBLEM_DER = crocoddyl.ShootingProblem(
crocoddyl>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
crocoddyl>   File "…/unittest/bindings/factory.py", line 445, in createData
crocoddyl>     data = DifferentialFreeFwdDynamicsDataDerived(self)
crocoddyl>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
crocoddyl>   File "…/unittest/bindings/factory.py", line 459, in __init__
crocoddyl>     self.pinocchio = pinocchio.Model.createData(model.state.pinocchio)
crocoddyl>                                                 ^^^^^^^^^^^^^^^^^^^^^
crocoddyl> TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptr<pinocchio::ModelTpl<double, 0, pinocchio::JointCollectionDefaultTpl>>

Reverting 2e80bdc fixes that issue.
Ref. #2469 #2462

@jcarpent
Copy link
Contributor

I don't understand this fix.
For me, when using Boost.Python, you need to declare converters support for shared_ptr, like that:

boost::python::register_ptr_to_python<boost::shared_ptr<T>>()

@cmastalli
Copy link
Member

I don't understand this fix. For me, when using Boost.Python, you need to declare converters support for shared_ptr, like that:

boost::python::register_ptr_to_python<boost::shared_ptr>()

I agree with @jcarpent. For me, the solution should be registering the pointer, and should be done in Pinocchio to avoid doing this in each project.

@jcarpent
Copy link
Contributor

For me, the solution should be registering the pointer, and should be done in Pinocchio to avoid doing this in each project.

For std::shared_ptr, yes. For boost::shared_ptr, I would say that is legacy and should be avoided.

@nim65s
Copy link
Contributor Author

nim65s commented Jan 29, 2025

I also agree :)

This issue is documenting a regression, not proposing a fix that would revert a good commit.

I think crocoddyl was missing something, but crocoddyl was working fine until v3.3.1. When pinocchio upgrade to v3.3.1 broke crocoddyl, this unveil that the pinocchio upgrade was in fact a breaking change, even if that was not expected.

We'll fix that properly in crocoddyl, and close this issue, but if anybody else has a similar problem, they will easily find this as documentation: a hotfix is to revert that commit, and the proper fix is to expose correctly the shared pointers.

edit: hum, yes, for std pointers, it would be even better to fix this in pinocchio instead of crocoddyl.

@jcarpent
Copy link
Contributor

Solved via #2566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants