pyomeca / biorbd

Biomechanical add-ons to the RigidBody Dynamics Library
https://pyomeca.github.io/Documentation/biorbd/index.html
MIT License
68 stars 45 forks source link

SetLocalJCS crash in biorbd_casadi #343

Closed Ipuch closed 7 months ago

Ipuch commented 7 months ago

We (with @SamHybz) need to set symbolic parameters in the biorbd_model but we failed to do it. here is a minimal example. It works for segment with DOF but not if there is no DOF.

import biorbd_casadi as biorbd
from biorbd_casadi import RotoTrans

# Fail Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)
sym_rototranslation_matrix = RotoTrans(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
biorbd_model.segment(1).setLocalJCS(biorbd_model, sym_rototranslation_matrix)

# Ideally but fails too
z_rotation_angle = MX.sym("z_rot", 1, 1)
sym_rototranslation_matrix = RotoTrans.fromEulerAngles(rot=angles, trans=MX.zeros(3, 1), seq="xyz")
biorbd_model.segment(1).setLocalJCS(biorbd_model, sym_rototranslation_matrix)

With the pendulum

    rt 0 0 0 xyz 0 0 0
    translations    y
    rotations   x
    ranges
        -1 5
        -2*pi 2*pi
    mass 1
    inertia
        0.0391  0.0000  0.0000
        0.0000  0.0335  -0.0032
        0.0000  -0.0032 0.0090
    com  -0.0005 0.0688 -0.9542
    meshfile mesh/pendulum.STL
endsegment

segment Seg2
    rt 0 0 0 xyz 0 0 0
    mass 1
    inertia
        0.0391  0.0000  0.0000
        0.0000  0.0335  -0.0032
        0.0000  -0.0032 0.0090
    com  -0.0005 0.0688 -0.9542
    meshfile mesh/pendulum.STL
endsegment