Adding BallJoint breaks simulation (updated again).

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Adding BallJoint breaks simulation (updated again).

Post by Sietse Achterop » Tue Nov 02, 2021 3:29 am

Hello,
Created a model, 20 bodies, 20 joints, all very straightforward. Until now simulations work nicely.
But when adding the next body and (for the first time) BallJoint, the simulation does not work properly.
In the very first step of the simulation the model is vanished completely!
  • There is NO error or warning at all.
  • If I use another joint like Weld, Pin of Slider, everything works just fine.
  • Just as an extra test, when using a Freejoint the simulator crashes.

    Code: Select all

    ForwardTool::run() caught an exception:
     SimTK Exception thrown at Integrator.cpp:431:
      Integrator initialization failed apparently because:
    SimTK Exception thrown at SmallMatrixMixed.h:878:
      Error detected by Simbody method lapackInverse(Mat<>): Matrix is singular so can't be inverted (Lapack getrf info=2).
      (Required condition 'info==0' was not met.)
    
  • A Customjoint with the same behavior as a Balljoint has the same probem.
The code bootbaljoint.py (line 756) and model Bootbaljoint.osim can be found here
Here a screenshot of the model.
bootbaljoint.png
bootbaljoint.png (267.57 KiB) Viewed 308 times
The single upperarm in the model that is added as the latest has the BallJoint that gives me trouble.
The model actually is very straightforward. What could I be doing wrong?
Thanks in advance, Sietse
Last edited by Sietse Achterop on Thu Nov 04, 2021 4:50 am, edited 1 time in total.

Tags:

User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Re: Adding BallJoint breaks simulation (updated).

Post by Sietse Achterop » Thu Nov 04, 2021 4:49 am

I simplified the model and the problem still persists!
There now only is ONE body and ONE joint.
The complete code is:

Code: Select all

import opensim as osim
import math
pi = math.pi

bbaan = osim.Model()
bbaan.setName("BootBaan")
bbaan.setGravity(osim.Vec3(0, -9.90665, 0))

upperal = osim.Body("Upper_Arm_Left",
                    1,
                    osim.Vec3(0, 0, 0),
                    osim.Inertia(0, 0, 0))

upperalGeometry = osim.Brick(osim.Vec3(0.04, 0.4, 0.04))
upperal.attachGeometry(upperalGeometry)
upperalGeometry.setColor(osim.Vec3(1, 1, 1))
bbaan.addBody(upperal)

uarmlJoint = osim.BallJoint("upper_arm_left_Joint",
                            bbaan.getGround(),
                            osim.Vec3(0, 1, 0.4),
                            osim.Vec3(0, 0, pi/2),
                            upperal,
                            osim.Vec3(0, -0.4, 0),
                            osim.Vec3(0, 0, 0))
bbaan.addJoint(uarmlJoint)

bbaan.finalizeConnections()
bbaan.printToXML("BootBaan.osim")
I really am puzzled, is there something wrong with BallJoints?

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Adding BallJoint breaks simulation (updated again).

Post by Thomas Uchida » Thu Nov 04, 2021 9:17 am

The O(n) formulation used by Simbody requires terminal bodies to have nonzero mass/inertia. Here, you have defined the mass to be 1 but the inertia matrix is all zeros. Replacing "osim.Inertia(0, 0, 0)" with "osim.Inertia(1, 1, 1)" on line 12 should give you a pendulum.

User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Re: Adding BallJoint breaks simulation (updated again).

Post by Sietse Achterop » Thu Nov 04, 2021 9:44 am

It does. Thanks!

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

Re: Adding BallJoint breaks simulation (updated again).

Post by Ayman Habib » Thu Nov 04, 2021 1:41 pm

Thanks Tom,

Sietse, do we need to do more investigation on our side or was this the same problem with your original model and now is fixed?

Thank you,
-Ayman

User avatar
Sietse Achterop
Posts: 72
Joined: Tue Sep 14, 2021 3:01 am

Re: Adding BallJoint breaks simulation (updated again).

Post by Sietse Achterop » Thu Nov 04, 2021 2:40 pm

Yes, i gave all bodies a non-zero inertia and the original model is working fine now.
Now I can go to the next step, adding some constraints to complete this first version of the boat.
Thanks!

POST REPLY