Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hongyuan Chen
Posts: 8
Joined: Wed Mar 20, 2024 6:37 pm

Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Post by Hongyuan Chen » Thu Sep 12, 2024 1:07 am

Helle, everyone!

I'm having problems using the MobL_ARMS_unimanual model in Upper Extremity Dynamic Model. I have changed the osim file of the model (including range limits and marker point locations).

In some cases this works, but in some cases, after I successfully run the inverse kinematics tool, the inverse solved gesture motion actions do not show up under motion. I also tried loading the mot file obtained from the inverse solution via load_motion, but again the model is stuck. The modified model and trc, xml, mot files have been added in the appendix. Very much looking forward for someone to solve my problem! Thanks!
Attachments
attachedFiles.zip
osim+trc+xml+mot
(607.04 KiB) Downloaded 23 times

Tags:

User avatar
Hongyuan Chen
Posts: 8
Joined: Wed Mar 20, 2024 6:37 pm

Re: Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Post by Hongyuan Chen » Thu Sep 12, 2024 11:25 pm

I can see the red cross in the right below of the messages window.

A java.lang.ArithmeticException exception has occurred.

Detailed error message:

java.lang.ArithmeticException: / by zero
at org.opensim.threejs.ModelVisualizationJson.calculateWrapPointsToVisualzerPointsMapping(ModelVisualizationJson.java:1843)
at org.opensim.threejs.ModelVisualizationJson.updatePathWithWrapping(ModelVisualizationJson.java:1505)
at org.opensim.threejs.ModelVisualizationJson.appendToFrame(ModelVisualizationJson.java:816)
at org.opensim.threejs.ModelVisualizationJson.createFrameMessageJson(ModelVisualizationJson.java:735)
at org.opensim.view.pub.ViewDB.updateModelDisplayNoRepaint(ViewDB.java:876)
at org.opensim.view.motions.MasterMotionModel.doUpdateAndRepaint(MasterMotionModel.java:83)
at org.opensim.view.motions.MasterMotionModel.applyTime(MasterMotionModel.java:99)
at org.opensim.view.motions.MasterMotionModel.setTime(MasterMotionModel.java:290)
at org.opensim.view.motions.MotionControlJPanel.update(MotionControlJPanel.java:692)
at java.util.Observable.notifyObservers(Observable.java:159)
at org.opensim.view.motions.MotionsDB.setCurrent(MotionsDB.java:267)
at org.opensim.view.motions.MotionsDB.addMotion(MotionsDB.java:238)
at org.opensim.view.motions.MotionsDB.loadMotionStorage(MotionsDB.java:160)
at org.opensim.view.motions.MotionsDB.loadMotionFile(MotionsDB.java:146)
at org.opensim.view.motions.FileLoadMotionMenuAction.loadMotion(FileLoadMotionMenuAction.java:80)
at org.opensim.view.motions.FileLoadMotionMenuAction.performAction(FileLoadMotionMenuAction.java:52)
at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:105)
at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:70)
at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:91)
at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:74)
at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:102)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:882)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:926)
at java.awt.Component.processMouseEvent(Component.java:6539)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6304)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

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

Re: Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Post by Ayman Habib » Fri Sep 13, 2024 9:20 am

Hello,

Looking at the code/line where the exception occurs, it seems to be a corner case where the wrapping algorithm reports that a wrapping has occurred but also reports no actual wrap points. It's an internal inconsistency between the core libraries and the application/GUI that we need to account for. This likely happens for muscles with too many wrap objects that result in scenarios we don't typically encounter (e.g. muscles with more than a couple wrap objects) I'll try to dig deeper into this in the meantime you may be able to get around it by skipping the frame(s) where this error is reported or splitting the motion into sections to zone in on the problem frame(s).

Thanks for reporting,
-Ayman

User avatar
Hongyuan Chen
Posts: 8
Joined: Wed Mar 20, 2024 6:37 pm

Re: Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Post by Hongyuan Chen » Fri Sep 13, 2024 10:47 pm

Hello Ayman,

Thanks for the analysis and answers you gave. Actually, I got the marker position by optitrack acquisition and then solved the individual joint angles inversely by modeling the upper limb. But as I said before, in some cases, after the inverse solution is finished, an entry of the inverse solution will be added at motions in the GUI interface, but when I click on it, it shows No motion in the Motion column of the visualization window, and even if I load the inverse solution mot file, the model doesn't move once it's stuck and I don't know how many segments it needs to be divided into. I don't know how many segments I need to split it into.

Since I want to use this inverse perspective to calculate the kinematic Jacobi matrix and the muscle arm, is this possible? Since I mentioned the gap between the core code and the GUI, can I then remove the muscles from the GUI? Get the joint angle values from the inverse solution, and then go back and compute the moment arm in the model with the muscles?

Thanks for your kind answer!

Best Wishes

Hongyuan Chen

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

Re: Cannot play the animation after inverse kinematics succeed ,even by loading the mot file obtained from the inversion

Post by Ayman Habib » Mon Sep 16, 2024 10:49 am

Hello,

Removing the muscles form the model should be easy though it involves editing the xml file of the model (.osim). You just remove the xml blocks for the corresponding muscles (typically these have the full class names rather than just "Muscle" e.g. "Millard2012EquilibriumMuscle"). If you have no other forces in the model it maybe easier to remove the block for <ForceSet> in it's entirety (both opening and closing tags).

Hope this helps,
-Ayman

POST REPLY