Page 1 of 1

Adding BallJoint breaks simulation (updated again).

Posted: Tue Nov 02, 2021 3:29 am
by sietse
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 312 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

Re: Adding BallJoint breaks simulation (updated).

Posted: Thu Nov 04, 2021 4:49 am
by sietse
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?

Re: Adding BallJoint breaks simulation (updated again).

Posted: Thu Nov 04, 2021 9:17 am
by tkuchida
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.

Re: Adding BallJoint breaks simulation (updated again).

Posted: Thu Nov 04, 2021 9:44 am
by sietse
It does. Thanks!

Re: Adding BallJoint breaks simulation (updated again).

Posted: Thu Nov 04, 2021 1:41 pm
by aymanh
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

Re: Adding BallJoint breaks simulation (updated again).

Posted: Thu Nov 04, 2021 2:40 pm
by sietse
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!