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

error when complie function library #86

Open
Czworldy opened this issue Dec 16, 2023 · 0 comments
Open

error when complie function library #86

Czworldy opened this issue Dec 16, 2023 · 0 comments

Comments

@Czworldy
Copy link

Czworldy commented Dec 16, 2023

Hi guys!
I tired to use some pinocchio dynamics function in my code, and i try to use cppadcodegen to get jacobian matrix of my function.

  ad_vector_t qPinocchio = input.head(q_size);
  ad_vector_t vPinocchio = input.tail(v_size);

  pinocchio::forwardKinematics(model, data, qPinocchio, vPinocchio);
  pinocchio::computeJointJacobians(model, data);
  pinocchio::updateFramePlacements(model, data);
  pinocchio::crba(model, data, qPinocchio);
  // data.M.triangularView<Eigen::StrictlyLower>() = data.M.transpose().triangularView<Eigen::StrictlyLower>();

  ad_matrix_t jacobian = ad_matrix_t::Zero(6, model.nv), jacobianXyz = ad_matrix_t::Zero(3, model.nv);

  pinocchio::getFrameJacobian(model, data, 
    model.getBodyId("foot"), pinocchio::LOCAL_WORLD_ALIGNED, jacobian);
  jacobianXyz = jacobian.topRows(3);
  ad_matrix_t Minv = pinocchio::computeMinverse(model, data, qPinocchio);
  Minv.triangularView<Eigen::StrictlyLower>() = Minv.transpose().triangularView<Eigen::StrictlyLower>();

  Eigen::Matrix<ad_scalar_t, 3, 3> JMinvJt = jacobianXyz * Minv * jacobianXyz.transpose() + ad_scalar_t(1e-12) * ad_matrix_t::Identity(3, 3);

  ad_vector_t output = JMinvJt.inverse() * (-ad_scalar_t(config_.r_coeff)-ad_scalar_t(1.0)) * jacobianXyz * vPinocchio;

but when i complie the .c file it gets error, is this cause by my function? do you guys have any idea when using cppadcodegen with pinocchio?

<stdin>:64:12: error: wrong type argument to unary minus
<stdin>:64:27: error: wrong type argument to unary minus
<stdin>:64:42: error: ‘inf’ undeclared (first use in this function); did you mean ‘in’?
<stdin>:64:42: note: each undeclared identifier is reported only once for each function it appears in

Thanks a lot!

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

1 participant