-
Notifications
You must be signed in to change notification settings - Fork 357
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
crba is not working in c++, but works in python #2120
Comments
@someilay : I can't test why your version is not working right now, but could you test your code with CMake instead of pkg-config ? We have an example here: https://github.com/stack-of-tasks/pinocchio-minimal |
Oh, I guess it is "working" in python because the module is compiled in release mode. What happen if you add |
@nim65s. Thank you for response. With minimal CMake this code starts to work). Can you explain why manual compiled code fails? |
Hello @someilay, Thanks for the nice reproduction steps you have give. I have been able to reproduce your issue easily. There is no issue with the compilation. When building with If you change your code with the following code then the assert is not raised anymore: #include <iostream>
#include "pinocchio/parsers/urdf.hpp"
#include "pinocchio/algorithm/contact-dynamics.hpp"
#include "pinocchio/algorithm/joint-configuration.hpp"
int main() {
pinocchio::Model model;
pinocchio::urdf::buildModel("./example.xml", model);
pinocchio::Data data(model);
auto q = pinocchio::neutral(model);
std::cout << pinocchio::crba(model, data, q) << "\n";
return 0;
} Here, I just call I'm still available if you have anymore questions. |
@jorisv. Thank you for clarifying the compilation process. However, I didn't get why such simple system needs quaternions. Moreover, suggested solution doesn't explain how to set manual configuration. |
I check again your example and I answered too fast. Here the description of this joint in the URDF documentation:
So... it seem to be a revolute joint without limits. But, it's a little more complicated than that. This kind of joint can be used to model wheel. Issue is the value of this joint, since it doesn't have limits, can reach a really high value. So instead of using joint angle to model the joint configuration we use the cos(angle) and sin(angle) value. If you want to manually set the configuration you can just wrote: Eigen::VectorXd q(4);
q << std::cos(angle1), std::sin(angle1), std::cos(angle2), std::sin(angle2); Also, if you finally don't need continuous joints, you can use revolute joints. |
@jorisv, now it makes senses. Thank you |
Bug description
crba
is not working inC++
, but works inPython
Reproduction steps
C++
code:Compiled by
g++ -std=c++11 main.cpp -o main $(pkg-config --cflags --libs pinocchio)
Python
code:Runned by
python3.9 main.py
example.xml
:Running
C++
version leads to:Running
Python
version:Additional info:
Pinocchio installed according to this
System
Ubuntu 22.04.3 LTS
The text was updated successfully, but these errors were encountered: