Code Monkey home page Code Monkey logo

Comments (7)

jorisv avatar jorisv commented on July 27, 2024 2

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 pkg-config you're not giving the -DNDEBUG flags and asserts are then activated.
It's a good thing, because the assert had detect that you give an unnormalized quaternion in the freeflyer.

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 pinocchio::neutral instead of Eigen::Zero to initialize q. This ensure an unit quaternion for the freeflyer joint.

I'm still available if you have anymore questions.

from pinocchio.

jorisv avatar jorisv commented on July 27, 2024 2

@someilay,

I check again your example and I answered too fast.
You don't have freeflyier joint (by default buildModel add a Fixed joint as robot base), but you have continuous joints.

Here the description of this joint in the URDF documentation:

a continuous hinge joint that rotates around the axis and has no upper and lower limits.

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.
The continuous joint can then rotate indefinitely without reaching infinity.
It's why the 0 configuration you give at the beginning wasn't working.

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.
q will then be a size 2 vector that will contains angle1 and angle2.

from pinocchio.

nim65s avatar nim65s commented on July 27, 2024

@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

from pinocchio.

nim65s avatar nim65s commented on July 27, 2024

Oh, I guess it is "working" in python because the module is compiled in release mode.

What happen if you add -O2 to your compilation line ?

from pinocchio.

someilay avatar someilay commented on July 27, 2024

@nim65s. Thank you for response. With minimal CMake this code starts to work). Can you explain why manual compiled code fails?

from pinocchio.

someilay avatar someilay commented on July 27, 2024

@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.

from pinocchio.

someilay avatar someilay commented on July 27, 2024

@jorisv, now it makes senses. Thank you

from pinocchio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.