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

Usage of Casadi SX with Pinocchio #2078

Open
UM-A opened this issue Nov 7, 2023 · 1 comment
Open

Usage of Casadi SX with Pinocchio #2078

UM-A opened this issue Nov 7, 2023 · 1 comment
Assignees

Comments

@UM-A
Copy link

UM-A commented Nov 7, 2023

Hi, I think this question has been asked previously and there were some answers. I want to go from my urdf file to Casadi SX robot equations. As far as I understand, it might be possible to do with pinocchio. However, when I try to use those expressions I get errors. I am sharing the code snippet, in case I am doing something wrong. Looking forward to any responses.

Code:
model=pinocchio.buildModelFromUrdf("RobotURDF.urdf" )
data=model.createData()
q = SX.sym("q", model.nq)

M = pinocchio.computePotentialEnergy(model, data, np.array([q[0],q[1],q[2],q[3]]))

Error:
Python argument types in
pinocchio.pinocchio_pywrap.computePotentialEnergy(Model, Data, numpy.ndarray)
did not match C++ signature:
computePotentialEnergy(struct pinocchio::ModelTpl<double,0,struct pinocchio::JointCollectionDefaultTpl> model, struct pinocchio::DataTpl<double,0,struct pinocchio::JointCollectionDefaultTpl> {lvalue} data)
computePotentialEnergy(struct pinocchio::ModelTpl<double,0,struct pinocchio::JointCollectionDefaultTpl> model, struct pinocchio::DataTpl<double,0,struct pinocchio::JointCollectionDefaultTpl> {lvalue} data, class Eigen::MatrixBase<class Eigen::Matrix<double,-1,1,0,-1,1> > q)

@jorisv jorisv self-assigned this Nov 8, 2023
@jorisv
Copy link
Contributor

jorisv commented Nov 8, 2023

Hello @UM-A,

Pinocchio 2 is only supporting Casadi in C++. The Python support will be added in Pinocchio 3 that is not released and not public.

Hopefully a pre-release is available. You can find instruction in this tutorial.
I recommend you to install it with conda (in a new environment), then to run the setup notebook to test your installation.

Others notebook will show you how to use the Pinocchio Casadi binding (from pinocchio import casadi as cpin).

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

2 participants